diff --git a/go.mod b/go.mod index 3ed43bef282..d3e08a20eae 100644 --- a/go.mod +++ b/go.mod @@ -16,9 +16,9 @@ require ( github.com/IBM/networking-go-sdk v0.14.0 github.com/IBM/platform-services-go-sdk v0.18.16 github.com/IBM/vpc-go-sdk v1.0.1 - github.com/aliyun/alibaba-cloud-sdk-go v1.61.1154 + github.com/aliyun/alibaba-cloud-sdk-go v1.61.1264 github.com/aliyun/aliyun-oss-go-sdk v2.1.8+incompatible - github.com/aliyun/terraform-provider-alicloud v1.132.0 + github.com/aliyun/terraform-provider-alicloud v1.153.0 github.com/apparentlymart/go-cidr v1.1.0 github.com/awalterschulze/gographviz v0.0.0-20190522210029-fa59802746ab github.com/aws/aws-sdk-go v1.37.4 @@ -89,7 +89,7 @@ require ( google.golang.org/api v0.44.0 google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2 google.golang.org/grpc v1.40.0 - gopkg.in/ini.v1 v1.62.0 + gopkg.in/ini.v1 v1.66.2 gopkg.in/yaml.v2 v2.4.0 k8s.io/api v0.23.0 k8s.io/apiextensions-apiserver v0.23.0 @@ -144,14 +144,14 @@ require ( github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 // indirect github.com/alibabacloud-go/endpoint-util v1.1.0 // indirect github.com/alibabacloud-go/openapi-util v0.0.7 // indirect - github.com/alibabacloud-go/tea v1.1.15 // indirect - github.com/alibabacloud-go/tea-roa v1.2.8 // indirect + github.com/alibabacloud-go/tea v1.1.17 // indirect + github.com/alibabacloud-go/tea-roa v1.3.0 // indirect github.com/alibabacloud-go/tea-roa-utils v1.1.5 // indirect - github.com/alibabacloud-go/tea-rpc v1.1.8 // indirect + github.com/alibabacloud-go/tea-rpc v1.2.0 // indirect github.com/alibabacloud-go/tea-rpc-utils v1.1.2 // indirect github.com/alibabacloud-go/tea-utils v1.3.9 // indirect github.com/aliyun/aliyun-datahub-sdk-go v0.1.5 // indirect - github.com/aliyun/aliyun-log-go-sdk v0.1.21 // indirect + github.com/aliyun/aliyun-log-go-sdk v0.1.27 // indirect github.com/aliyun/aliyun-mns-go-sdk v0.0.0-20210305050620-d1b5875bda58 // indirect github.com/aliyun/aliyun-tablestore-go-sdk v4.1.3+incompatible // indirect github.com/aliyun/credentials-go v1.1.2 // indirect @@ -182,8 +182,8 @@ require ( github.com/coreos/vcontext v0.0.0-20201120045928-b0e13dab675c // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dchest/bcrypt_pbkdf v0.0.0-20150205184540-83f37f9c154a // indirect - github.com/deckarep/golang-set v1.7.1 // indirect - github.com/denverdino/aliyungo v0.0.0-20210518071019-eb3bbb144d8a // indirect + github.com/deckarep/golang-set v1.8.0 // indirect + github.com/denverdino/aliyungo v0.0.0-20211216040745-6cc94847413f // indirect github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect github.com/dimchansky/utfbom v1.1.1 // indirect github.com/dustinkirkland/golang-petname v0.0.0-20191129215211-8e5a1ed0cff0 // indirect diff --git a/go.sum b/go.sum index 7dcf1f2aa0d..69922528556 100644 --- a/go.sum +++ b/go.sum @@ -189,6 +189,8 @@ github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo= github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= +github.com/agiledragon/gomonkey/v2 v2.3.1 h1:k+UnUY0EMNYUFUAQVETGY9uUTxjMdnUkP0ARyJS1zzs= +github.com/agiledragon/gomonkey/v2 v2.3.1/go.mod h1:ap1AmDzcVOAz1YpeJ3TCzIgstoaWLA6jbbgxfB4w2iY= github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412/go.mod h1:WPjqKcmVOxf0XSf3YxCJs6N6AOSrOx3obionmG7T0y0= github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM= github.com/ajeddeloh/go-json v0.0.0-20170920214419-6a2fe990e083 h1:uwcvnXW76Y0rHM+qs7y8iHknWUWXYFNlD6FEVhc47TU= @@ -215,16 +217,16 @@ github.com/alibabacloud-go/openapi-util v0.0.7/go.mod h1:sQuElr4ywwFRlCCberQwKRF github.com/alibabacloud-go/tea v1.1.0/go.mod h1:IkGyUSX4Ba1V+k4pCtJUc6jDpZLFph9QMy2VUPTwukg= github.com/alibabacloud-go/tea v1.1.7/go.mod h1:/tmnEaQMyb4Ky1/5D+SE1BAsa5zj/KeGOFfwYm3N/p4= github.com/alibabacloud-go/tea v1.1.8/go.mod h1:/tmnEaQMyb4Ky1/5D+SE1BAsa5zj/KeGOFfwYm3N/p4= -github.com/alibabacloud-go/tea v1.1.10/go.mod h1:/tmnEaQMyb4Ky1/5D+SE1BAsa5zj/KeGOFfwYm3N/p4= github.com/alibabacloud-go/tea v1.1.11/go.mod h1:/tmnEaQMyb4Ky1/5D+SE1BAsa5zj/KeGOFfwYm3N/p4= -github.com/alibabacloud-go/tea v1.1.15 h1:IaBC1Mm5Ss+l7cWnOXSxCmnWoWrEdeHEtDgQzoCCgjY= github.com/alibabacloud-go/tea v1.1.15/go.mod h1:nXxjm6CIFkBhwW4FQkNrolwbfon8Svy6cujmKFUq98A= -github.com/alibabacloud-go/tea-roa v1.2.8 h1:N5kjn7gYckpCNMZw6syHmNfQYGkdt0UnV1f+1LJieCA= -github.com/alibabacloud-go/tea-roa v1.2.8/go.mod h1:mmXHtSWCuOEUI3saHp0KRAk4zIUom3/RG9tdU+hziEM= +github.com/alibabacloud-go/tea v1.1.17 h1:05R5DnaJXe9sCNIe8KUgWHC/z6w/VZIwczgUwzRnul8= +github.com/alibabacloud-go/tea v1.1.17/go.mod h1:nXxjm6CIFkBhwW4FQkNrolwbfon8Svy6cujmKFUq98A= +github.com/alibabacloud-go/tea-roa v1.3.0 h1:834Mszn4zEibGPG9InAGvyYHoNH4QU/RuOEC2Tnt2ls= +github.com/alibabacloud-go/tea-roa v1.3.0/go.mod h1:Cdv5rQZqx9V8kYbAHSfvCgYR6KXRnbuM12piJOjssYY= github.com/alibabacloud-go/tea-roa-utils v1.1.5 h1:BkZAywim4piCeTA9qmRTq9gkcOI3Gltu3VobZwegnUE= github.com/alibabacloud-go/tea-roa-utils v1.1.5/go.mod h1:7mkMI3FZEm4LGKIR1322y0N6N9EC0R1G/oXvzQjf1fQ= -github.com/alibabacloud-go/tea-rpc v1.1.8 h1:QgHWo5PSOkJ4Fu56caZtTeCocltf4tMqXty75LVX0hg= -github.com/alibabacloud-go/tea-rpc v1.1.8/go.mod h1:C1nOCvQ/WjIn3bVcBCcZY34s+1TqUowR44ovROFvwfw= +github.com/alibabacloud-go/tea-rpc v1.2.0 h1:m3ohmuAT+IdXigKp7enB+lXuksqsor0OFNB5+QB7Isk= +github.com/alibabacloud-go/tea-rpc v1.2.0/go.mod h1:zwKwxuf92liNsPcLOxPdrkvR5Dq6jtX2du6qx8FT094= github.com/alibabacloud-go/tea-rpc-utils v1.1.2 h1:ZTfFREnP2q9D49T2J/1jYYOndepGdrUOgm/JR8/bIQ0= github.com/alibabacloud-go/tea-rpc-utils v1.1.2/go.mod h1:V5HdNi6Xdn0JMpgVhQ19vsFAS51tydr7BqcJtuXH1Yw= github.com/alibabacloud-go/tea-utils v1.3.0/go.mod h1:EI/o33aBfj3hETm4RLiAxF/ThQdSngxrpF8rKUDJjPE= @@ -236,12 +238,12 @@ github.com/alibabacloud-go/tea-utils v1.3.9/go.mod h1:EI/o33aBfj3hETm4RLiAxF/ThQ github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190329064014-6e358769c32a/go.mod h1:T9M45xf79ahXVelWoOBmH0y4aC1t5kXO5BxwyakgIGA= github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190412020505-60e2075261b6/go.mod h1:T9M45xf79ahXVelWoOBmH0y4aC1t5kXO5BxwyakgIGA= github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190620160927-9418d7b0cd0f/go.mod h1:myCDvQSzCW+wB1WAlocEru4wMGJxy+vlxHdhegi1CDQ= -github.com/aliyun/alibaba-cloud-sdk-go v1.61.1154 h1:+6PluSvddiDm8YF4E5LRs8kiXtC1BKCujLi4WrA4Srw= -github.com/aliyun/alibaba-cloud-sdk-go v1.61.1154/go.mod h1:pUKYbK5JQ+1Dfxk80P0qxGqe5dkxDoabbZS7zOcouyA= +github.com/aliyun/alibaba-cloud-sdk-go v1.61.1264 h1:67Ky9Wy6qmYRBrS9DRxlXRYgosNnb/4uEDLu2H554JU= +github.com/aliyun/alibaba-cloud-sdk-go v1.61.1264/go.mod h1:9CMdKNL3ynIGPpfTcdwTvIm8SGuAZYYC4jFVSSvE1YQ= github.com/aliyun/aliyun-datahub-sdk-go v0.1.5 h1:c2TFcJ5PjkqkHr2use7Av2wHB8jVgoKxX1gmLDsysR4= github.com/aliyun/aliyun-datahub-sdk-go v0.1.5/go.mod h1:GwtZxKUD+aLBrtlkEcyPNAx+jRkBioEC7EKOlQ26lTc= -github.com/aliyun/aliyun-log-go-sdk v0.1.21 h1:mreDTFTmqv1I5VG5HNNu9DLQ3Kv3Y2c9hsjbeCOFvF4= -github.com/aliyun/aliyun-log-go-sdk v0.1.21/go.mod h1:aBG0R+MWRTgvlIODQkz+a3/RM9bQYKsmSbKdbIx4vpc= +github.com/aliyun/aliyun-log-go-sdk v0.1.27 h1:fXtaOAcdR3DsqN9GZkfJue8B2Dba0TV+8Ahwq4o+y5g= +github.com/aliyun/aliyun-log-go-sdk v0.1.27/go.mod h1:aBG0R+MWRTgvlIODQkz+a3/RM9bQYKsmSbKdbIx4vpc= github.com/aliyun/aliyun-mns-go-sdk v0.0.0-20210305050620-d1b5875bda58 h1:hX1oYyN7d0y7GHwli6trhovosNAKo9f60uC3FPHMjoQ= github.com/aliyun/aliyun-mns-go-sdk v0.0.0-20210305050620-d1b5875bda58/go.mod h1:eD/mEH7SwtLSwI9p8fP9VTH2cYM3wFSY1WNaxEdLIFU= github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20190103054945-8205d1f41e70/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8= @@ -255,8 +257,8 @@ github.com/aliyun/credentials-go v1.1.2 h1:qU1vwGIBb3UJ8BwunHDRFtAhS6jnQLnde/yk0 github.com/aliyun/credentials-go v1.1.2/go.mod h1:ozcZaMR5kLM7pwtCMEpVmQ242suV6qTJya2bDq4X1Tw= github.com/aliyun/fc-go-sdk v0.0.0-20200925033337-c013428cbe21 h1:0kcRapGFTtwZIgbGSaM+N1y+GrnLaY4Vz78FqPnt164= github.com/aliyun/fc-go-sdk v0.0.0-20200925033337-c013428cbe21/go.mod h1:X4Pc3TFz4LRXaQPhyzBU4Ec8pL/QvaJ36CFtLJsroIM= -github.com/aliyun/terraform-provider-alicloud v1.132.0 h1:neBCKJGbL7XJBkzySQX7GJ2M98a7tju3y8XRY4BJxHA= -github.com/aliyun/terraform-provider-alicloud v1.132.0/go.mod h1:7Ac42rNclVHQRkt91rPHJbHY4Ro1UzbU+sQ3xT9m5ds= +github.com/aliyun/terraform-provider-alicloud v1.153.0 h1:XL8AaFKiS0EMs3NWDYO0lViaaalqMPfvMjacBkS/n28= +github.com/aliyun/terraform-provider-alicloud v1.153.0/go.mod h1:VNIGyQaCSD8U5A3u/OiYEy4snKmil1XzjAtHGqMloD4= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/andybalholm/brotli v1.0.1 h1:KqhlKozYbRtJvsPrrEeXcO+N2l6NYT5A2QAFmSULpEc= github.com/andybalholm/brotli v1.0.1/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= @@ -476,12 +478,12 @@ github.com/davecgh/go-xdr v0.0.0-20161123171359-e6a2ba005892/go.mod h1:CTDl0pzVz github.com/daviddengcn/go-colortext v0.0.0-20160507010035-511bcaf42ccd/go.mod h1:dv4zxwHi5C/8AeI+4gX4dCWOIvNi7I6JCSX0HvlKPgE= github.com/dchest/bcrypt_pbkdf v0.0.0-20150205184540-83f37f9c154a h1:saTgr5tMLFnmy/yg3qDTft4rE5DY2uJ/cCxCe3q0XTU= github.com/dchest/bcrypt_pbkdf v0.0.0-20150205184540-83f37f9c154a/go.mod h1:Bw9BbhOJVNR+t0jCqx2GC6zv0TGBsShs56Y3gfSCvl0= -github.com/deckarep/golang-set v1.7.1 h1:SCQV0S6gTtp6itiFrTqI+pfmJ4LN85S1YzhDf9rTHJQ= -github.com/deckarep/golang-set v1.7.1/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= +github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4= +github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo= github.com/denis-tingajkin/go-header v0.3.1/go.mod h1:sq/2IxMhaZX+RRcgHfCRx/m0M5na0fBt4/CRe7Lrji0= github.com/denisenkom/go-mssqldb v0.0.0-20190412130859-3b1d194e553a/go.mod h1:zAg7JM8CkOJ43xKXIj7eRO9kmWm/TW578qo+oDO6tuM= -github.com/denverdino/aliyungo v0.0.0-20210518071019-eb3bbb144d8a h1:J9+NI0ywi1btTOYseLdmr/H3XxutbC4m2bU48kKpwVs= -github.com/denverdino/aliyungo v0.0.0-20210518071019-eb3bbb144d8a/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0= +github.com/denverdino/aliyungo v0.0.0-20211216040745-6cc94847413f h1:umutxmMv53KWjVv2JsJQzC7kcPAkzifajj6jflUiWfk= +github.com/denverdino/aliyungo v0.0.0-20211216040745-6cc94847413f/go.mod h1:VVxx1gyGhdt369208nKOYLI0PVgrZqbU+EuWBZJQ1ZQ= github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= @@ -920,7 +922,6 @@ github.com/gophercloud/utils v0.0.0-20210720165645-8a3ad2ad9e70 h1:9UYK3/bQIZ9Ef github.com/gophercloud/utils v0.0.0-20210720165645-8a3ad2ad9e70/go.mod h1:wx8HMD8oQD0Ryhz6+6ykq75PJ79iPyEqYHfwZ4l7OsA= github.com/gopherjs/gopherjs v0.0.0-20180628210949-0892b62f0d9f/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 h1:l5lAOZEym3oK3SQ2HBHWsJUfbNBiTXJDeW2QDxw9AQ0= github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorhill/cronexpr v0.0.0-20180427100037-88b0669f7d75/go.mod h1:g2644b03hfBX9Ov0ZBDgXXens4rxSxmqFBbhvKv2yVA= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= @@ -1197,7 +1198,6 @@ github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHm github.com/jstemmer/go-junit-report v0.9.1 h1:6QPYqodiu3GuPL+7mfx+NwDdp2eTkp9IfEUpgAwUN0o= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= @@ -1782,12 +1782,10 @@ github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/smartystreets/assertions v0.0.0-20180725160413-e900ae048470/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/assertions v1.1.0 h1:MkTeG1DMwsrdH7QtLXy5W+fUxWq+vmb6cLmyJ7aRtF0= github.com/smartystreets/assertions v1.1.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo= github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s= github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa/go.mod h1:2RVY1rIf+2J2o/IM9+vPq9RzmHDSseB7FoXiSNIUsoU= github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/softlayer/softlayer-go v1.0.3 h1:9FONm5xzQ9belQtbdryR6gBg4EF6hX6lrjNKi0IvZkU= github.com/softlayer/softlayer-go v1.0.3/go.mod h1:6HepcfAXROz0Rf63krk5hPZyHT6qyx2MNvYyHof7ik4= @@ -1930,6 +1928,7 @@ github.com/vmware/govmomi v0.24.0 h1:G7YFF6unMTG3OY25Dh278fsomVTKs46m2ENlEFSbmbs github.com/vmware/govmomi v0.24.0/go.mod h1:Y+Wq4lst78L85Ge/F8+ORXIWiKYqaro1vhAulACy9Lc= github.com/vmware/vmw-guestinfo v0.0.0-20170707015358-25eff159a728/go.mod h1:x9oS4Wk2s2u4tS29nEaDLdzvuHdB19CvSGJjPgkZJNk= github.com/vmware/vmw-ovflib v0.0.0-20170608004843-1f217b9dc714/go.mod h1:jiPk45kn7klhByRvUq5i2vo1RtHKBHj+iWGFpxbXuuI= +github.com/waigani/diffparser v0.0.0-20190828052634-7391f219313d/go.mod h1:BzSc3WEF8R+lCaP5iGFRxd5kIXy4JKOZAwNe1w0cdc0= github.com/xanzy/ssh-agent v0.2.1 h1:TCbipTQL2JiiCprBWx9frJ2eJlCYT00NmctrHxVAr70= github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= @@ -2495,8 +2494,9 @@ gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.56.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU= gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.66.2 h1:XfR1dOYubytKy4Shzc2LHrrGhU0lDCfDGG1yLPmpgsI= +gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/jcmturner/aescts.v1 v1.0.1 h1:cVVZBK2b1zY26haWB4vbBiZrfFQnfbTVrE3xZq6hrEw= gopkg.in/jcmturner/aescts.v1 v1.0.1/go.mod h1:nsR8qBOg+OucoIW+WMhB3GspUQXq9XorLnQb9XtvcOo= gopkg.in/jcmturner/dnsutils.v1 v1.0.1 h1:cIuC1OLRGZrld+16ZJvvZxVJeKPsvd5eUIvxfoN5hSM= diff --git a/pkg/asset/installconfig/alibabacloud/client.go b/pkg/asset/installconfig/alibabacloud/client.go index 153264eb0b0..64fe39c6f69 100644 --- a/pkg/asset/installconfig/alibabacloud/client.go +++ b/pkg/asset/installconfig/alibabacloud/client.go @@ -136,15 +136,7 @@ func askCredentials() (auth.Credential, error) { } func (client *Client) doActionWithSetDomain(request requests.AcsRequest, response responses.AcsResponse) (err error) { - endpoint, err := endpoints.Resolve(&endpoints.ResolveParam{ - Product: strings.ToLower(request.GetProduct()), - RegionId: strings.ToLower(client.RegionID), - }) - - if err != nil { - endpoint = defaultEndpoint()[strings.ToLower(request.GetProduct())] - } - + endpoint := getEndpoint(strings.ToLower(request.GetProduct()), strings.ToLower(client.RegionID)) request.SetDomain(endpoint) err = client.DoAction(request, response) return @@ -331,6 +323,23 @@ func (client *Client) GetAvailableZonesByInstanceType(instanceType string) ([]st return zones, nil } +func getEndpoint(productName string, regionID string) string { + if additionEndpoint, ok := additionEndpoint(productName, regionID); ok { + return additionEndpoint + } + + endpoint, err := endpoints.Resolve(&endpoints.ResolveParam{ + Product: productName, + RegionId: regionID, + }) + + if err != nil { + endpoint = defaultEndpoint()[productName] + } + + return endpoint +} + func defaultEndpoint() map[string]string { return map[string]string{ "pvtz": "pvtz.aliyuncs.com", @@ -339,6 +348,24 @@ func defaultEndpoint() map[string]string { } } +func additionEndpoint(productName string, regionID string) (string, bool) { + endpoints := map[string]map[string]string{ + "ecs": { + "cn-wulanchabu": "ecs.cn-wulanchabu.aliyuncs.com", + "cn-guangzhou": "ecs.cn-guangzhou.aliyuncs.com", + "ap-southeast-6": "ecs.ap-southeast-6.aliyuncs.com", + "cn-heyuan": "ecs.cn-heyuan.aliyuncs.com", + "cn-chengdu": "ecs.cn-chengdu.aliyuncs.com", + }, + } + if regionEndpoints, ok := endpoints[productName]; ok { + if endpoint, ok := regionEndpoints[regionID]; ok { + return endpoint, true + } + } + return "", false +} + func storeCredentials(accessKeyID string, accessKeySecret string) (err error) { dirPath, ok := os.LookupEnv(envCredentialFile) if !ok || dirPath == "" { diff --git a/vendor/github.com/alibabacloud-go/tea-roa/client/client.go b/vendor/github.com/alibabacloud-go/tea-roa/client/client.go index 447ce85efdc..09f6fca5e82 100644 --- a/vendor/github.com/alibabacloud-go/tea-roa/client/client.go +++ b/vendor/github.com/alibabacloud-go/tea-roa/client/client.go @@ -50,6 +50,10 @@ type Config struct { // Deprecated // credential type Type *string `json:"type,omitempty" xml:"type,omitempty"` + // source ip + SourceIp *string `json:"sourceIp,omitempty" xml:"sourceIp,omitempty"` + // secure transport + SecureTransport *string `json:"secureTransport,omitempty" xml:"secureTransport,omitempty"` } func (s Config) String() string { @@ -145,23 +149,35 @@ func (s *Config) SetType(v string) *Config { return s } +func (s *Config) SetSourceIp(v string) *Config { + s.SourceIp = &v + return s +} + +func (s *Config) SetSecureTransport(v string) *Config { + s.SecureTransport = &v + return s +} + type Client struct { - Protocol *string - ReadTimeout *int - ConnectTimeout *int - HttpProxy *string - HttpsProxy *string - NoProxy *string - MaxIdleConns *int - EndpointHost *string - Network *string - EndpointRule *string - EndpointMap map[string]*string - Suffix *string - ProductId *string - RegionId *string - UserAgent *string - Credential credential.Credential + Protocol *string + ReadTimeout *int + ConnectTimeout *int + HttpProxy *string + HttpsProxy *string + NoProxy *string + MaxIdleConns *int + EndpointHost *string + Network *string + EndpointRule *string + EndpointMap map[string]*string + Suffix *string + ProductId *string + RegionId *string + UserAgent *string + SourceIp *string + SecureTransport *string + Credential credential.Credential } /** @@ -215,6 +231,8 @@ func (client *Client) Init(config *Config) (_err error) { return _err } + client.SourceIp = config.SourceIp + client.SecureTransport = config.SecureTransport client.RegionId = config.RegionId client.Protocol = config.Protocol client.EndpointHost = config.Endpoint @@ -288,6 +306,14 @@ func (client *Client) DoRequest(version *string, protocol *string, method *strin "user-agent": util.GetUserAgent(client.UserAgent), // x-sdk-client': helper.DEFAULT_CLIENT }, headers) + if !tea.BoolValue(util.IsUnset(client.SourceIp)) { + request_.Headers["x-acs-source-ip"] = client.SourceIp + } + + if !tea.BoolValue(util.IsUnset(client.SecureTransport)) { + request_.Headers["x-acs-secure-transport"] = client.SecureTransport + } + if !tea.BoolValue(util.IsUnset(body)) { request_.Body = tea.ToReader(util.ToJSONString(body)) request_.Headers["content-type"] = tea.String("application/json; charset=utf-8") @@ -342,9 +368,10 @@ func (client *Client) DoRequest(version *string, protocol *string, method *strin if tea.BoolValue(util.Is4xx(response_.StatusCode)) || tea.BoolValue(util.Is5xx(response_.StatusCode)) { err := util.AssertAsMap(result) _err = tea.NewSDKError(map[string]interface{}{ - "code": tea.ToString(DefaultAny(err["Code"], err["code"])), - "message": "code: " + tea.ToString(tea.IntValue(response_.StatusCode)) + ", " + tea.ToString(DefaultAny(err["Message"], err["message"])) + " request id: " + tea.ToString(DefaultAny(err["RequestId"], err["requestId"])), - "data": err, + "code": tea.ToString(DefaultAny(err["Code"], err["code"])), + "statusCode": tea.IntValue(response_.StatusCode), + "message": "code: " + tea.ToString(tea.IntValue(response_.StatusCode)) + ", " + tea.ToString(DefaultAny(err["Message"], err["message"])) + " request id: " + tea.ToString(DefaultAny(err["RequestId"], err["requestId"])), + "data": err, }) return _result, _err } @@ -428,6 +455,14 @@ func (client *Client) DoRequestWithAction(action *string, version *string, proto "user-agent": util.GetUserAgent(client.UserAgent), // x-sdk-client': helper.DEFAULT_CLIENT }, headers) + if !tea.BoolValue(util.IsUnset(client.SourceIp)) { + request_.Headers["x-acs-source-ip"] = client.SourceIp + } + + if !tea.BoolValue(util.IsUnset(client.SecureTransport)) { + request_.Headers["x-acs-secure-transport"] = client.SecureTransport + } + if !tea.BoolValue(util.IsUnset(body)) { request_.Body = tea.ToReader(util.ToJSONString(body)) request_.Headers["content-type"] = tea.String("application/json; charset=utf-8") @@ -482,9 +517,10 @@ func (client *Client) DoRequestWithAction(action *string, version *string, proto if tea.BoolValue(util.Is4xx(response_.StatusCode)) || tea.BoolValue(util.Is5xx(response_.StatusCode)) { err := util.AssertAsMap(result) _err = tea.NewSDKError(map[string]interface{}{ - "code": tea.ToString(DefaultAny(err["Code"], err["code"])), - "message": "code: " + tea.ToString(tea.IntValue(response_.StatusCode)) + ", " + tea.ToString(DefaultAny(err["Message"], err["message"])) + " request id: " + tea.ToString(DefaultAny(err["RequestId"], err["requestId"])), - "data": err, + "code": tea.ToString(DefaultAny(err["Code"], err["code"])), + "statusCode": tea.IntValue(response_.StatusCode), + "message": "code: " + tea.ToString(tea.IntValue(response_.StatusCode)) + ", " + tea.ToString(DefaultAny(err["Message"], err["message"])) + " request id: " + tea.ToString(DefaultAny(err["RequestId"], err["requestId"])), + "data": err, }) return _result, _err } @@ -566,6 +602,14 @@ func (client *Client) DoRequestWithForm(version *string, protocol *string, metho "user-agent": util.GetUserAgent(client.UserAgent), // x-sdk-client': helper.DEFAULT_CLIENT }, headers) + if !tea.BoolValue(util.IsUnset(client.SourceIp)) { + request_.Headers["x-acs-source-ip"] = client.SourceIp + } + + if !tea.BoolValue(util.IsUnset(client.SecureTransport)) { + request_.Headers["x-acs-secure-transport"] = client.SecureTransport + } + if !tea.BoolValue(util.IsUnset(body)) { request_.Body = tea.ToReader(roautil.ToForm(body)) request_.Headers["content-type"] = tea.String("application/x-www-form-urlencoded") @@ -620,9 +664,10 @@ func (client *Client) DoRequestWithForm(version *string, protocol *string, metho if tea.BoolValue(util.Is4xx(response_.StatusCode)) || tea.BoolValue(util.Is5xx(response_.StatusCode)) { err := util.AssertAsMap(result) _err = tea.NewSDKError(map[string]interface{}{ - "code": tea.ToString(DefaultAny(err["Code"], err["code"])), - "message": "code: " + tea.ToString(tea.IntValue(response_.StatusCode)) + ", " + tea.ToString(DefaultAny(err["Message"], err["message"])) + " request id: " + tea.ToString(DefaultAny(err["RequestId"], err["requestId"])), - "data": err, + "code": tea.ToString(DefaultAny(err["Code"], err["code"])), + "statusCode": tea.IntValue(response_.StatusCode), + "message": "code: " + tea.ToString(tea.IntValue(response_.StatusCode)) + ", " + tea.ToString(DefaultAny(err["Message"], err["message"])) + " request id: " + tea.ToString(DefaultAny(err["RequestId"], err["requestId"])), + "data": err, }) return _result, _err } diff --git a/vendor/github.com/alibabacloud-go/tea-rpc/client/client.go b/vendor/github.com/alibabacloud-go/tea-rpc/client/client.go index d98a509e451..136f2b38928 100644 --- a/vendor/github.com/alibabacloud-go/tea-rpc/client/client.go +++ b/vendor/github.com/alibabacloud-go/tea-rpc/client/client.go @@ -58,6 +58,10 @@ type Config struct { // Deprecated // credential type Type *string `json:"type,omitempty" xml:"type,omitempty"` + // source ip + SourceIp *string `json:"sourceIp,omitempty" xml:"sourceIp,omitempty"` + // secure transport + SecureTransport *string `json:"secureTransport,omitempty" xml:"secureTransport,omitempty"` } func (s Config) String() string { @@ -173,6 +177,16 @@ func (s *Config) SetType(v string) *Config { return s } +func (s *Config) SetSourceIp(v string) *Config { + s.SourceIp = &v + return s +} + +func (s *Config) SetSecureTransport(v string) *Config { + s.SecureTransport = &v + return s +} + type Client struct { Endpoint *string RegionId *string @@ -193,6 +207,8 @@ type Client struct { MaxIdleConns *int EndpointType *string OpenPlatformEndpoint *string + SourceIp *string + SecureTransport *string Credential credential.Credential } @@ -247,6 +263,8 @@ func (client *Client) Init(config *Config) (_err error) { return _err } + client.SourceIp = config.SourceIp + client.SecureTransport = config.SecureTransport client.Network = config.Network client.Suffix = config.Suffix client.Endpoint = config.Endpoint @@ -324,6 +342,14 @@ func (client *Client) DoRequest(action *string, protocol *string, method *string "Version": tea.StringValue(version), "SignatureNonce": tea.StringValue(util.GetNonce()), }, query)) + if !tea.BoolValue(util.IsUnset(client.SourceIp)) { + request_.Query["SourceIp"] = client.SourceIp + } + + if !tea.BoolValue(util.IsUnset(client.SecureTransport)) { + request_.Query["SecureTransport"] = client.SecureTransport + } + // endpoint is setted in product client request_.Headers = map[string]*string{ "x-acs-version": version, @@ -377,9 +403,10 @@ func (client *Client) DoRequest(action *string, protocol *string, method *string res := util.AssertAsMap(obj) if tea.BoolValue(util.Is4xx(response_.StatusCode)) || tea.BoolValue(util.Is5xx(response_.StatusCode)) { _err = tea.NewSDKError(map[string]interface{}{ - "code": tea.ToString(DefaultAny(res["Code"], res["code"])), - "message": "code: " + tea.ToString(tea.IntValue(response_.StatusCode)) + ", " + tea.ToString(DefaultAny(res["Message"], res["message"])) + " request id: " + tea.ToString(DefaultAny(res["RequestId"], res["requestId"])), - "data": res, + "code": tea.ToString(DefaultAny(res["Code"], res["code"])), + "statusCode": tea.IntValue(response_.StatusCode), + "message": "code: " + tea.ToString(tea.IntValue(response_.StatusCode)) + ", " + tea.ToString(DefaultAny(res["Message"], res["message"])) + " request id: " + tea.ToString(DefaultAny(res["RequestId"], res["requestId"])), + "data": res, }) return _result, _err } diff --git a/vendor/github.com/alibabacloud-go/tea/tea/tea.go b/vendor/github.com/alibabacloud-go/tea/tea/tea.go index 1940bceaa51..ac5a7e6848f 100644 --- a/vendor/github.com/alibabacloud-go/tea/tea/tea.go +++ b/vendor/github.com/alibabacloud-go/tea/tea/tea.go @@ -69,11 +69,12 @@ type Response struct { // SDKError struct is used save error code and message type SDKError struct { - Code *string - Message *string - Data *string - Stack *string - errMsg *string + Code *string + StatusCode *int + Message *string + Data *string + Stack *string + errMsg *string } // RuntimeObject is used for converting http configuration @@ -177,6 +178,15 @@ func NewSDKError(obj map[string]interface{}) *SDKError { err.Code = String(val) } + if statusCode, ok := obj["statusCode"].(int); ok { + err.StatusCode = Int(statusCode) + } else if status, ok := obj["statusCode"].(string); ok { + statusCode, err2 := strconv.Atoi(status) + if err2 == nil { + err.StatusCode = Int(statusCode) + } + } + if obj["message"] != nil { err.Message = String(obj["message"].(string)) } @@ -194,8 +204,8 @@ func (err *SDKError) SetErrMsg(msg string) { func (err *SDKError) Error() string { if err.errMsg == nil { - str := fmt.Sprintf("SDKError:\n Code: %s\n Message: %s\n Data: %s\n", - StringValue(err.Code), StringValue(err.Message), StringValue(err.Data)) + str := fmt.Sprintf("SDKError:\n StatusCode: %d\n Code: %s\n Message: %s\n Data: %s\n", + IntValue(err.StatusCode), StringValue(err.Code), StringValue(err.Message), StringValue(err.Data)) err.SetErrMsg(str) } return StringValue(err.errMsg) @@ -209,7 +219,9 @@ func (err *CastError) Error() string { // Convert is use convert map[string]interface object to struct func Convert(in interface{}, out interface{}) error { byt, _ := json.Marshal(in) - err := jsonParser.Unmarshal(byt, out) + decoder := jsonParser.NewDecoder(bytes.NewReader(byt)) + decoder.UseNumber() + err := decoder.Decode(&out) return err } @@ -765,10 +777,10 @@ func Retryable(err error) *bool { return Bool(false) } if realErr, ok := err.(*SDKError); ok { - code, err := strconv.Atoi(StringValue(realErr.Code)) - if err != nil { - return Bool(true) + if realErr.StatusCode == nil { + return Bool(false) } + code := IntValue(realErr.StatusCode) return Bool(code >= http.StatusInternalServerError) } return Bool(true) diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/client.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/client.go index 8d5cc73e2ad..56376b58407 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/client.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/client.go @@ -22,6 +22,7 @@ import ( "net/http" "net/url" "os" + "reflect" "regexp" "runtime" "strconv" @@ -57,24 +58,26 @@ var hookDo = func(fn func(req *http.Request) (*http.Response, error)) func(req * // Client the type Client type Client struct { - isInsecure bool - regionId string - config *Config - httpProxy string - httpsProxy string - noProxy string - logger *Logger - userAgent map[string]string - signer auth.Signer - httpClient *http.Client - asyncTaskQueue chan func() - readTimeout time.Duration - connectTimeout time.Duration - EndpointMap map[string]string - EndpointType string - Network string - Domain string - isOpenAsync bool + SourceIp string + SecureTransport string + isInsecure bool + regionId string + config *Config + httpProxy string + httpsProxy string + noProxy string + logger *Logger + userAgent map[string]string + signer auth.Signer + httpClient *http.Client + asyncTaskQueue chan func() + readTimeout time.Duration + connectTimeout time.Duration + EndpointMap map[string]string + EndpointType string + Network string + Domain string + isOpenAsync bool } func (client *Client) Init() (err error) { @@ -320,9 +323,28 @@ func (client *Client) InitClientConfig() (config *Config) { } func (client *Client) DoAction(request requests.AcsRequest, response responses.AcsResponse) (err error) { + if (client.SecureTransport == "false" || client.SecureTransport == "true") && client.SourceIp != "" { + t := reflect.TypeOf(request).Elem() + v := reflect.ValueOf(request).Elem() + for i := 0; i < t.NumField(); i++ { + value := v.FieldByName(t.Field(i).Name) + if t.Field(i).Name == "requests.RoaRequest" { + request.GetHeaders()["x-acs-proxy-source-ip"] = client.SourceIp + request.GetHeaders()["x-acs-proxy-secure-transport"] = client.SecureTransport + return client.DoActionWithSigner(request, response, nil) + } else if t.Field(i).Name == "PathPattern" && !value.IsZero() { + request.GetHeaders()["x-acs-proxy-source-ip"] = client.SourceIp + request.GetHeaders()["x-acs-proxy-secure-transport"] = client.SecureTransport + return client.DoActionWithSigner(request, response, nil) + } else if i == t.NumField()-1 { + request.GetQueryParams()["SourceIp"] = client.SourceIp + request.GetQueryParams()["SecureTransport"] = client.SecureTransport + return client.DoActionWithSigner(request, response, nil) + } + } + } return client.DoActionWithSigner(request, response, nil) } - func (client *Client) GetEndpointRules(regionId string, product string) (endpointRaw string, err error) { if client.EndpointType == "regional" { if regionId == "" { diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/logger.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/logger.go index a01a7bbc980..49e49833d2c 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/logger.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/logger.go @@ -2,12 +2,13 @@ package sdk import ( "encoding/json" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/utils" "io" "log" "os" "strings" "time" + + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/utils" ) var logChannel string diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests/acs_request.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests/acs_request.go index 5cd7cd1a6f2..d055c75428f 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests/acs_request.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests/acs_request.go @@ -342,6 +342,21 @@ func flatRepeatedList(dataValue reflect.Value, request AcsRequest, position, pre if err != nil { return } + } else if typeTag == "Map" { + err = handleMap(request, dataValue, prefix, name, fieldPosition, i) + if err != nil { + return err + } + } else if typeTag == "Json" { + byt, err := json.Marshal(dataValue.Field(i).Interface()) + if err != nil { + return err + } + key := prefix + name + err = addParam(request, fieldPosition, key, string(byt)) + if err != nil { + return err + } } } } @@ -375,6 +390,65 @@ func handleRepeatedParams(request AcsRequest, dataValue reflect.Value, prefix, n return nil } +func handleParam(request AcsRequest, dataValue reflect.Value, prefix, key, fieldPosition string) (err error) { + if dataValue.Type().String() == "[]string" { + if dataValue.IsNil() { + return + } + for j := 0; j < dataValue.Len(); j++ { + err = addParam(request, fieldPosition, key+"."+strconv.Itoa(j+1), dataValue.Index(j).String()) + if err != nil { + return + } + } + } else { + if dataValue.Type().Kind().String() == "string" { + value := dataValue.String() + err = addParam(request, fieldPosition, key, value) + if err != nil { + return + } + } else if dataValue.Type().Kind().String() == "struct" { + err = flatRepeatedList(dataValue, request, fieldPosition, key+".") + if err != nil { + return + } + } else if dataValue.Type().Kind().String() == "int" { + value := dataValue.Int() + err = addParam(request, fieldPosition, key, strconv.Itoa(int(value))) + if err != nil { + return err + } + } + } + return nil +} + +func handleMap(request AcsRequest, dataValue reflect.Value, prefix, name, fieldPosition string, index int) (err error) { + valueField := dataValue.Field(index) + if valueField.IsValid() && !valueField.IsNil() { + iter := valueField.MapRange() + for iter.Next() { + k := iter.Key() + v := iter.Value() + key := prefix + name + ".#" + strconv.Itoa(k.Len()) + "#" + k.String() + if v.Kind() == reflect.Ptr || v.Kind() == reflect.Interface { + elementValue := v.Elem() + err = handleParam(request, elementValue, prefix, key, fieldPosition) + if err != nil { + return err + } + } else if v.IsValid() && v.IsNil() { + err = handleParam(request, v, prefix, key, fieldPosition) + if err != nil { + return err + } + } + } + } + return nil +} + func handleStruct(request AcsRequest, dataValue reflect.Value, prefix, name, fieldPosition string, index int) (err error) { valueField := dataValue.Field(index) if valueField.IsValid() && valueField.String() != "" { @@ -410,9 +484,17 @@ func handleStruct(request AcsRequest, dataValue reflect.Value, prefix, name, fie if repeatedFieldValue.IsValid() && !repeatedFieldValue.IsNil() { for m := 0; m < repeatedFieldValue.Len(); m++ { elementValue := repeatedFieldValue.Index(m) - err = flatRepeatedList(elementValue, request, fieldPosition, key+"."+strconv.Itoa(m+1)+".") - if err != nil { - return + if elementValue.Type().Kind().String() == "string" { + value := elementValue.String() + err := addParam(request, fieldPosition, key+"."+strconv.Itoa(m+1), value) + if err != nil { + return err + } + } else { + err = flatRepeatedList(elementValue, request, fieldPosition, key+"."+strconv.Itoa(m+1)+".") + if err != nil { + return + } } } } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/add_account_relation.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/add_account_relation.go new file mode 100644 index 00000000000..ac64fca8d61 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/add_account_relation.go @@ -0,0 +1,109 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// AddAccountRelation invokes the bssopenapi.AddAccountRelation API synchronously +func (client *Client) AddAccountRelation(request *AddAccountRelationRequest) (response *AddAccountRelationResponse, err error) { + response = CreateAddAccountRelationResponse() + err = client.DoAction(request, response) + return +} + +// AddAccountRelationWithChan invokes the bssopenapi.AddAccountRelation API asynchronously +func (client *Client) AddAccountRelationWithChan(request *AddAccountRelationRequest) (<-chan *AddAccountRelationResponse, <-chan error) { + responseChan := make(chan *AddAccountRelationResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.AddAccountRelation(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// AddAccountRelationWithCallback invokes the bssopenapi.AddAccountRelation API asynchronously +func (client *Client) AddAccountRelationWithCallback(request *AddAccountRelationRequest, callback func(response *AddAccountRelationResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *AddAccountRelationResponse + var err error + defer close(result) + response, err = client.AddAccountRelation(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// AddAccountRelationRequest is the request struct for api AddAccountRelation +type AddAccountRelationRequest struct { + *requests.RpcRequest + ChildNick string `position:"Query" name:"ChildNick"` + RelationType string `position:"Query" name:"RelationType"` + ParentUserId requests.Integer `position:"Query" name:"ParentUserId"` + ChildUserId requests.Integer `position:"Query" name:"ChildUserId"` + RequestId string `position:"Query" name:"RequestId"` + PermissionCodes *[]string `position:"Query" name:"PermissionCodes" type:"Repeated"` + RoleCodes *[]string `position:"Query" name:"RoleCodes" type:"Repeated"` +} + +// AddAccountRelationResponse is the response struct for api AddAccountRelation +type AddAccountRelationResponse struct { + *responses.BaseResponse + Code string `json:"Code" xml:"Code"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Message string `json:"Message" xml:"Message"` + Data Data `json:"Data" xml:"Data"` +} + +// CreateAddAccountRelationRequest creates a request to invoke AddAccountRelation API +func CreateAddAccountRelationRequest() (request *AddAccountRelationRequest) { + request = &AddAccountRelationRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("BssOpenApi", "2017-12-14", "AddAccountRelation", "", "") + request.Method = requests.POST + return +} + +// CreateAddAccountRelationResponse creates a response to parse from AddAccountRelation response +func CreateAddAccountRelationResponse() (response *AddAccountRelationResponse) { + response = &AddAccountRelationResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/apply_invoice.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/apply_invoice.go index 045c7270700..c4c3ede40d1 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/apply_invoice.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/apply_invoice.go @@ -80,6 +80,7 @@ type ApplyInvoiceRequest struct { InvoiceByAmount requests.Boolean `position:"Query" name:"InvoiceByAmount"` CustomerId requests.Integer `position:"Query" name:"CustomerId"` SelectedIds *[]string `position:"Query" name:"SelectedIds" type:"Repeated"` + UserRemark string `position:"Query" name:"UserRemark"` } // ApplyInvoiceResponse is the response struct for api ApplyInvoice diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/confirm_relation.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/confirm_relation.go new file mode 100644 index 00000000000..ead2f505f2d --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/confirm_relation.go @@ -0,0 +1,108 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ConfirmRelation invokes the bssopenapi.ConfirmRelation API synchronously +func (client *Client) ConfirmRelation(request *ConfirmRelationRequest) (response *ConfirmRelationResponse, err error) { + response = CreateConfirmRelationResponse() + err = client.DoAction(request, response) + return +} + +// ConfirmRelationWithChan invokes the bssopenapi.ConfirmRelation API asynchronously +func (client *Client) ConfirmRelationWithChan(request *ConfirmRelationRequest) (<-chan *ConfirmRelationResponse, <-chan error) { + responseChan := make(chan *ConfirmRelationResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ConfirmRelation(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ConfirmRelationWithCallback invokes the bssopenapi.ConfirmRelation API asynchronously +func (client *Client) ConfirmRelationWithCallback(request *ConfirmRelationRequest, callback func(response *ConfirmRelationResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ConfirmRelationResponse + var err error + defer close(result) + response, err = client.ConfirmRelation(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ConfirmRelationRequest is the request struct for api ConfirmRelation +type ConfirmRelationRequest struct { + *requests.RpcRequest + RelationType string `position:"Query" name:"RelationType"` + ParentUserId requests.Integer `position:"Query" name:"ParentUserId"` + ConfirmCode string `position:"Query" name:"ConfirmCode"` + ChildUserId requests.Integer `position:"Query" name:"ChildUserId"` + RequestId string `position:"Query" name:"RequestId"` + PermissionCodes *[]string `position:"Query" name:"PermissionCodes" type:"Repeated"` +} + +// ConfirmRelationResponse is the response struct for api ConfirmRelation +type ConfirmRelationResponse struct { + *responses.BaseResponse + Code string `json:"Code" xml:"Code"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Message string `json:"Message" xml:"Message"` + Data Data `json:"Data" xml:"Data"` +} + +// CreateConfirmRelationRequest creates a request to invoke ConfirmRelation API +func CreateConfirmRelationRequest() (request *ConfirmRelationRequest) { + request = &ConfirmRelationRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("BssOpenApi", "2017-12-14", "ConfirmRelation", "", "") + request.Method = requests.POST + return +} + +// CreateConfirmRelationResponse creates a response to parse from ConfirmRelation response +func CreateConfirmRelationResponse() (response *ConfirmRelationResponse) { + response = &ConfirmRelationResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/create_cost_unit.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/create_cost_unit.go index 08ab5739b31..9afc9d909e5 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/create_cost_unit.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/create_cost_unit.go @@ -84,11 +84,11 @@ type CreateCostUnitUnitEntityList struct { // CreateCostUnitResponse is the response struct for api CreateCostUnit type CreateCostUnitResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Message string `json:"Message" xml:"Message"` - Code string `json:"Code" xml:"Code"` - Success bool `json:"Success" xml:"Success"` - Data DataInCreateCostUnit `json:"Data" xml:"Data"` + RequestId string `json:"RequestId" xml:"RequestId"` + Message string `json:"Message" xml:"Message"` + Code string `json:"Code" xml:"Code"` + Success bool `json:"Success" xml:"Success"` + Data Data `json:"Data" xml:"Data"` } // CreateCreateCostUnitRequest creates a request to invoke CreateCostUnit API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_instance_bill.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_instance_bill.go index 65c01103379..ec04d5fe21f 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_instance_bill.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_instance_bill.go @@ -89,11 +89,11 @@ type DescribeInstanceBillRequest struct { // DescribeInstanceBillResponse is the response struct for api DescribeInstanceBill type DescribeInstanceBillResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Success bool `json:"Success" xml:"Success"` - Code string `json:"Code" xml:"Code"` - Message string `json:"Message" xml:"Message"` - Data DataInDescribeInstanceBill `json:"Data" xml:"Data"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data Data `json:"Data" xml:"Data"` } // CreateDescribeInstanceBillRequest creates a request to invoke DescribeInstanceBill API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_pricing_module.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_pricing_module.go index f7fd350da4c..c5f2cd50c9c 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_pricing_module.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_pricing_module.go @@ -80,11 +80,11 @@ type DescribePricingModuleRequest struct { // DescribePricingModuleResponse is the response struct for api DescribePricingModule type DescribePricingModuleResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Success bool `json:"Success" xml:"Success"` - Code string `json:"Code" xml:"Code"` - Message string `json:"Message" xml:"Message"` - Data Data `json:"Data" xml:"Data"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data DataInDescribePricingModule `json:"Data" xml:"Data"` } // CreateDescribePricingModuleRequest creates a request to invoke DescribePricingModule API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_resource_coverage_detail.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_resource_coverage_detail.go new file mode 100644 index 00000000000..b64a0112c30 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_resource_coverage_detail.go @@ -0,0 +1,109 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeResourceCoverageDetail invokes the bssopenapi.DescribeResourceCoverageDetail API synchronously +func (client *Client) DescribeResourceCoverageDetail(request *DescribeResourceCoverageDetailRequest) (response *DescribeResourceCoverageDetailResponse, err error) { + response = CreateDescribeResourceCoverageDetailResponse() + err = client.DoAction(request, response) + return +} + +// DescribeResourceCoverageDetailWithChan invokes the bssopenapi.DescribeResourceCoverageDetail API asynchronously +func (client *Client) DescribeResourceCoverageDetailWithChan(request *DescribeResourceCoverageDetailRequest) (<-chan *DescribeResourceCoverageDetailResponse, <-chan error) { + responseChan := make(chan *DescribeResourceCoverageDetailResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeResourceCoverageDetail(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeResourceCoverageDetailWithCallback invokes the bssopenapi.DescribeResourceCoverageDetail API asynchronously +func (client *Client) DescribeResourceCoverageDetailWithCallback(request *DescribeResourceCoverageDetailRequest, callback func(response *DescribeResourceCoverageDetailResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeResourceCoverageDetailResponse + var err error + defer close(result) + response, err = client.DescribeResourceCoverageDetail(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeResourceCoverageDetailRequest is the request struct for api DescribeResourceCoverageDetail +type DescribeResourceCoverageDetailRequest struct { + *requests.RpcRequest + PeriodType string `position:"Query" name:"PeriodType"` + BillOwnerId requests.Integer `position:"Query" name:"BillOwnerId"` + ResourceType string `position:"Query" name:"ResourceType"` + StartPeriod string `position:"Query" name:"StartPeriod"` + EndPeriod string `position:"Query" name:"EndPeriod"` + NextToken string `position:"Query" name:"NextToken"` + MaxResults requests.Integer `position:"Query" name:"MaxResults"` +} + +// DescribeResourceCoverageDetailResponse is the response struct for api DescribeResourceCoverageDetail +type DescribeResourceCoverageDetailResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data Data `json:"Data" xml:"Data"` +} + +// CreateDescribeResourceCoverageDetailRequest creates a request to invoke DescribeResourceCoverageDetail API +func CreateDescribeResourceCoverageDetailRequest() (request *DescribeResourceCoverageDetailRequest) { + request = &DescribeResourceCoverageDetailRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("BssOpenApi", "2017-12-14", "DescribeResourceCoverageDetail", "", "") + request.Method = requests.POST + return +} + +// CreateDescribeResourceCoverageDetailResponse creates a response to parse from DescribeResourceCoverageDetail response +func CreateDescribeResourceCoverageDetailResponse() (response *DescribeResourceCoverageDetailResponse) { + response = &DescribeResourceCoverageDetailResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_resource_coverage_total.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_resource_coverage_total.go new file mode 100644 index 00000000000..df27a05852f --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_resource_coverage_total.go @@ -0,0 +1,107 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeResourceCoverageTotal invokes the bssopenapi.DescribeResourceCoverageTotal API synchronously +func (client *Client) DescribeResourceCoverageTotal(request *DescribeResourceCoverageTotalRequest) (response *DescribeResourceCoverageTotalResponse, err error) { + response = CreateDescribeResourceCoverageTotalResponse() + err = client.DoAction(request, response) + return +} + +// DescribeResourceCoverageTotalWithChan invokes the bssopenapi.DescribeResourceCoverageTotal API asynchronously +func (client *Client) DescribeResourceCoverageTotalWithChan(request *DescribeResourceCoverageTotalRequest) (<-chan *DescribeResourceCoverageTotalResponse, <-chan error) { + responseChan := make(chan *DescribeResourceCoverageTotalResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeResourceCoverageTotal(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeResourceCoverageTotalWithCallback invokes the bssopenapi.DescribeResourceCoverageTotal API asynchronously +func (client *Client) DescribeResourceCoverageTotalWithCallback(request *DescribeResourceCoverageTotalRequest, callback func(response *DescribeResourceCoverageTotalResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeResourceCoverageTotalResponse + var err error + defer close(result) + response, err = client.DescribeResourceCoverageTotal(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeResourceCoverageTotalRequest is the request struct for api DescribeResourceCoverageTotal +type DescribeResourceCoverageTotalRequest struct { + *requests.RpcRequest + PeriodType string `position:"Query" name:"PeriodType"` + BillOwnerId requests.Integer `position:"Query" name:"BillOwnerId"` + ResourceType string `position:"Query" name:"ResourceType"` + StartPeriod string `position:"Query" name:"StartPeriod"` + EndPeriod string `position:"Query" name:"EndPeriod"` +} + +// DescribeResourceCoverageTotalResponse is the response struct for api DescribeResourceCoverageTotal +type DescribeResourceCoverageTotalResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data Data `json:"Data" xml:"Data"` +} + +// CreateDescribeResourceCoverageTotalRequest creates a request to invoke DescribeResourceCoverageTotal API +func CreateDescribeResourceCoverageTotalRequest() (request *DescribeResourceCoverageTotalRequest) { + request = &DescribeResourceCoverageTotalRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("BssOpenApi", "2017-12-14", "DescribeResourceCoverageTotal", "", "") + request.Method = requests.POST + return +} + +// CreateDescribeResourceCoverageTotalResponse creates a response to parse from DescribeResourceCoverageTotal response +func CreateDescribeResourceCoverageTotalResponse() (response *DescribeResourceCoverageTotalResponse) { + response = &DescribeResourceCoverageTotalResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_resource_package_product.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_resource_package_product.go index 4428f129a1a..729c4b06014 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_resource_package_product.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_resource_package_product.go @@ -77,12 +77,12 @@ type DescribeResourcePackageProductRequest struct { // DescribeResourcePackageProductResponse is the response struct for api DescribeResourcePackageProduct type DescribeResourcePackageProductResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - OrderId int64 `json:"OrderId" xml:"OrderId"` - Success bool `json:"Success" xml:"Success"` - Code string `json:"Code" xml:"Code"` - Message string `json:"Message" xml:"Message"` - Data Data `json:"Data" xml:"Data"` + RequestId string `json:"RequestId" xml:"RequestId"` + OrderId int64 `json:"OrderId" xml:"OrderId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data DataInDescribeResourcePackageProduct `json:"Data" xml:"Data"` } // CreateDescribeResourcePackageProductRequest creates a request to invoke DescribeResourcePackageProduct API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_resource_usage_detail.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_resource_usage_detail.go new file mode 100644 index 00000000000..a5afdb28e84 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_resource_usage_detail.go @@ -0,0 +1,109 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeResourceUsageDetail invokes the bssopenapi.DescribeResourceUsageDetail API synchronously +func (client *Client) DescribeResourceUsageDetail(request *DescribeResourceUsageDetailRequest) (response *DescribeResourceUsageDetailResponse, err error) { + response = CreateDescribeResourceUsageDetailResponse() + err = client.DoAction(request, response) + return +} + +// DescribeResourceUsageDetailWithChan invokes the bssopenapi.DescribeResourceUsageDetail API asynchronously +func (client *Client) DescribeResourceUsageDetailWithChan(request *DescribeResourceUsageDetailRequest) (<-chan *DescribeResourceUsageDetailResponse, <-chan error) { + responseChan := make(chan *DescribeResourceUsageDetailResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeResourceUsageDetail(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeResourceUsageDetailWithCallback invokes the bssopenapi.DescribeResourceUsageDetail API asynchronously +func (client *Client) DescribeResourceUsageDetailWithCallback(request *DescribeResourceUsageDetailRequest, callback func(response *DescribeResourceUsageDetailResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeResourceUsageDetailResponse + var err error + defer close(result) + response, err = client.DescribeResourceUsageDetail(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeResourceUsageDetailRequest is the request struct for api DescribeResourceUsageDetail +type DescribeResourceUsageDetailRequest struct { + *requests.RpcRequest + PeriodType string `position:"Query" name:"PeriodType"` + BillOwnerId requests.Integer `position:"Query" name:"BillOwnerId"` + ResourceType string `position:"Query" name:"ResourceType"` + StartPeriod string `position:"Query" name:"StartPeriod"` + EndPeriod string `position:"Query" name:"EndPeriod"` + NextToken string `position:"Query" name:"NextToken"` + MaxResults requests.Integer `position:"Query" name:"MaxResults"` +} + +// DescribeResourceUsageDetailResponse is the response struct for api DescribeResourceUsageDetail +type DescribeResourceUsageDetailResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data Data `json:"Data" xml:"Data"` +} + +// CreateDescribeResourceUsageDetailRequest creates a request to invoke DescribeResourceUsageDetail API +func CreateDescribeResourceUsageDetailRequest() (request *DescribeResourceUsageDetailRequest) { + request = &DescribeResourceUsageDetailRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("BssOpenApi", "2017-12-14", "DescribeResourceUsageDetail", "", "") + request.Method = requests.POST + return +} + +// CreateDescribeResourceUsageDetailResponse creates a response to parse from DescribeResourceUsageDetail response +func CreateDescribeResourceUsageDetailResponse() (response *DescribeResourceUsageDetailResponse) { + response = &DescribeResourceUsageDetailResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_resource_usage_total.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_resource_usage_total.go new file mode 100644 index 00000000000..3ff273ad748 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_resource_usage_total.go @@ -0,0 +1,107 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeResourceUsageTotal invokes the bssopenapi.DescribeResourceUsageTotal API synchronously +func (client *Client) DescribeResourceUsageTotal(request *DescribeResourceUsageTotalRequest) (response *DescribeResourceUsageTotalResponse, err error) { + response = CreateDescribeResourceUsageTotalResponse() + err = client.DoAction(request, response) + return +} + +// DescribeResourceUsageTotalWithChan invokes the bssopenapi.DescribeResourceUsageTotal API asynchronously +func (client *Client) DescribeResourceUsageTotalWithChan(request *DescribeResourceUsageTotalRequest) (<-chan *DescribeResourceUsageTotalResponse, <-chan error) { + responseChan := make(chan *DescribeResourceUsageTotalResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeResourceUsageTotal(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeResourceUsageTotalWithCallback invokes the bssopenapi.DescribeResourceUsageTotal API asynchronously +func (client *Client) DescribeResourceUsageTotalWithCallback(request *DescribeResourceUsageTotalRequest, callback func(response *DescribeResourceUsageTotalResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeResourceUsageTotalResponse + var err error + defer close(result) + response, err = client.DescribeResourceUsageTotal(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeResourceUsageTotalRequest is the request struct for api DescribeResourceUsageTotal +type DescribeResourceUsageTotalRequest struct { + *requests.RpcRequest + PeriodType string `position:"Query" name:"PeriodType"` + BillOwnerId requests.Integer `position:"Query" name:"BillOwnerId"` + ResourceType string `position:"Query" name:"ResourceType"` + StartPeriod string `position:"Query" name:"StartPeriod"` + EndPeriod string `position:"Query" name:"EndPeriod"` +} + +// DescribeResourceUsageTotalResponse is the response struct for api DescribeResourceUsageTotal +type DescribeResourceUsageTotalResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data Data `json:"Data" xml:"Data"` +} + +// CreateDescribeResourceUsageTotalRequest creates a request to invoke DescribeResourceUsageTotal API +func CreateDescribeResourceUsageTotalRequest() (request *DescribeResourceUsageTotalRequest) { + request = &DescribeResourceUsageTotalRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("BssOpenApi", "2017-12-14", "DescribeResourceUsageTotal", "", "") + request.Method = requests.POST + return +} + +// CreateDescribeResourceUsageTotalResponse creates a response to parse from DescribeResourceUsageTotal response +func CreateDescribeResourceUsageTotalResponse() (response *DescribeResourceUsageTotalResponse) { + response = &DescribeResourceUsageTotalResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_savings_plans_coverage_detail.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_savings_plans_coverage_detail.go new file mode 100644 index 00000000000..996cb7d6573 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_savings_plans_coverage_detail.go @@ -0,0 +1,108 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeSavingsPlansCoverageDetail invokes the bssopenapi.DescribeSavingsPlansCoverageDetail API synchronously +func (client *Client) DescribeSavingsPlansCoverageDetail(request *DescribeSavingsPlansCoverageDetailRequest) (response *DescribeSavingsPlansCoverageDetailResponse, err error) { + response = CreateDescribeSavingsPlansCoverageDetailResponse() + err = client.DoAction(request, response) + return +} + +// DescribeSavingsPlansCoverageDetailWithChan invokes the bssopenapi.DescribeSavingsPlansCoverageDetail API asynchronously +func (client *Client) DescribeSavingsPlansCoverageDetailWithChan(request *DescribeSavingsPlansCoverageDetailRequest) (<-chan *DescribeSavingsPlansCoverageDetailResponse, <-chan error) { + responseChan := make(chan *DescribeSavingsPlansCoverageDetailResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeSavingsPlansCoverageDetail(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeSavingsPlansCoverageDetailWithCallback invokes the bssopenapi.DescribeSavingsPlansCoverageDetail API asynchronously +func (client *Client) DescribeSavingsPlansCoverageDetailWithCallback(request *DescribeSavingsPlansCoverageDetailRequest, callback func(response *DescribeSavingsPlansCoverageDetailResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeSavingsPlansCoverageDetailResponse + var err error + defer close(result) + response, err = client.DescribeSavingsPlansCoverageDetail(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeSavingsPlansCoverageDetailRequest is the request struct for api DescribeSavingsPlansCoverageDetail +type DescribeSavingsPlansCoverageDetailRequest struct { + *requests.RpcRequest + PeriodType string `position:"Query" name:"PeriodType"` + BillOwnerId requests.Integer `position:"Query" name:"BillOwnerId"` + StartPeriod string `position:"Query" name:"StartPeriod"` + EndPeriod string `position:"Query" name:"EndPeriod"` + Token string `position:"Query" name:"Token"` + MaxResults requests.Integer `position:"Query" name:"MaxResults"` +} + +// DescribeSavingsPlansCoverageDetailResponse is the response struct for api DescribeSavingsPlansCoverageDetail +type DescribeSavingsPlansCoverageDetailResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data Data `json:"Data" xml:"Data"` +} + +// CreateDescribeSavingsPlansCoverageDetailRequest creates a request to invoke DescribeSavingsPlansCoverageDetail API +func CreateDescribeSavingsPlansCoverageDetailRequest() (request *DescribeSavingsPlansCoverageDetailRequest) { + request = &DescribeSavingsPlansCoverageDetailRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("BssOpenApi", "2017-12-14", "DescribeSavingsPlansCoverageDetail", "", "") + request.Method = requests.POST + return +} + +// CreateDescribeSavingsPlansCoverageDetailResponse creates a response to parse from DescribeSavingsPlansCoverageDetail response +func CreateDescribeSavingsPlansCoverageDetailResponse() (response *DescribeSavingsPlansCoverageDetailResponse) { + response = &DescribeSavingsPlansCoverageDetailResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_savings_plans_coverage_total.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_savings_plans_coverage_total.go new file mode 100644 index 00000000000..0ad46796f99 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_savings_plans_coverage_total.go @@ -0,0 +1,106 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeSavingsPlansCoverageTotal invokes the bssopenapi.DescribeSavingsPlansCoverageTotal API synchronously +func (client *Client) DescribeSavingsPlansCoverageTotal(request *DescribeSavingsPlansCoverageTotalRequest) (response *DescribeSavingsPlansCoverageTotalResponse, err error) { + response = CreateDescribeSavingsPlansCoverageTotalResponse() + err = client.DoAction(request, response) + return +} + +// DescribeSavingsPlansCoverageTotalWithChan invokes the bssopenapi.DescribeSavingsPlansCoverageTotal API asynchronously +func (client *Client) DescribeSavingsPlansCoverageTotalWithChan(request *DescribeSavingsPlansCoverageTotalRequest) (<-chan *DescribeSavingsPlansCoverageTotalResponse, <-chan error) { + responseChan := make(chan *DescribeSavingsPlansCoverageTotalResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeSavingsPlansCoverageTotal(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeSavingsPlansCoverageTotalWithCallback invokes the bssopenapi.DescribeSavingsPlansCoverageTotal API asynchronously +func (client *Client) DescribeSavingsPlansCoverageTotalWithCallback(request *DescribeSavingsPlansCoverageTotalRequest, callback func(response *DescribeSavingsPlansCoverageTotalResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeSavingsPlansCoverageTotalResponse + var err error + defer close(result) + response, err = client.DescribeSavingsPlansCoverageTotal(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeSavingsPlansCoverageTotalRequest is the request struct for api DescribeSavingsPlansCoverageTotal +type DescribeSavingsPlansCoverageTotalRequest struct { + *requests.RpcRequest + PeriodType string `position:"Query" name:"PeriodType"` + BillOwnerId requests.Integer `position:"Query" name:"BillOwnerId"` + StartPeriod string `position:"Query" name:"StartPeriod"` + EndPeriod string `position:"Query" name:"EndPeriod"` +} + +// DescribeSavingsPlansCoverageTotalResponse is the response struct for api DescribeSavingsPlansCoverageTotal +type DescribeSavingsPlansCoverageTotalResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data Data `json:"Data" xml:"Data"` +} + +// CreateDescribeSavingsPlansCoverageTotalRequest creates a request to invoke DescribeSavingsPlansCoverageTotal API +func CreateDescribeSavingsPlansCoverageTotalRequest() (request *DescribeSavingsPlansCoverageTotalRequest) { + request = &DescribeSavingsPlansCoverageTotalRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("BssOpenApi", "2017-12-14", "DescribeSavingsPlansCoverageTotal", "", "") + request.Method = requests.POST + return +} + +// CreateDescribeSavingsPlansCoverageTotalResponse creates a response to parse from DescribeSavingsPlansCoverageTotal response +func CreateDescribeSavingsPlansCoverageTotalResponse() (response *DescribeSavingsPlansCoverageTotalResponse) { + response = &DescribeSavingsPlansCoverageTotalResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_savings_plans_usage_detail.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_savings_plans_usage_detail.go new file mode 100644 index 00000000000..7e98dfec23a --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_savings_plans_usage_detail.go @@ -0,0 +1,108 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeSavingsPlansUsageDetail invokes the bssopenapi.DescribeSavingsPlansUsageDetail API synchronously +func (client *Client) DescribeSavingsPlansUsageDetail(request *DescribeSavingsPlansUsageDetailRequest) (response *DescribeSavingsPlansUsageDetailResponse, err error) { + response = CreateDescribeSavingsPlansUsageDetailResponse() + err = client.DoAction(request, response) + return +} + +// DescribeSavingsPlansUsageDetailWithChan invokes the bssopenapi.DescribeSavingsPlansUsageDetail API asynchronously +func (client *Client) DescribeSavingsPlansUsageDetailWithChan(request *DescribeSavingsPlansUsageDetailRequest) (<-chan *DescribeSavingsPlansUsageDetailResponse, <-chan error) { + responseChan := make(chan *DescribeSavingsPlansUsageDetailResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeSavingsPlansUsageDetail(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeSavingsPlansUsageDetailWithCallback invokes the bssopenapi.DescribeSavingsPlansUsageDetail API asynchronously +func (client *Client) DescribeSavingsPlansUsageDetailWithCallback(request *DescribeSavingsPlansUsageDetailRequest, callback func(response *DescribeSavingsPlansUsageDetailResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeSavingsPlansUsageDetailResponse + var err error + defer close(result) + response, err = client.DescribeSavingsPlansUsageDetail(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeSavingsPlansUsageDetailRequest is the request struct for api DescribeSavingsPlansUsageDetail +type DescribeSavingsPlansUsageDetailRequest struct { + *requests.RpcRequest + PeriodType string `position:"Query" name:"PeriodType"` + BillOwnerId requests.Integer `position:"Query" name:"BillOwnerId"` + StartPeriod string `position:"Query" name:"StartPeriod"` + EndPeriod string `position:"Query" name:"EndPeriod"` + Token string `position:"Query" name:"Token"` + MaxResults requests.Integer `position:"Query" name:"MaxResults"` +} + +// DescribeSavingsPlansUsageDetailResponse is the response struct for api DescribeSavingsPlansUsageDetail +type DescribeSavingsPlansUsageDetailResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data Data `json:"Data" xml:"Data"` +} + +// CreateDescribeSavingsPlansUsageDetailRequest creates a request to invoke DescribeSavingsPlansUsageDetail API +func CreateDescribeSavingsPlansUsageDetailRequest() (request *DescribeSavingsPlansUsageDetailRequest) { + request = &DescribeSavingsPlansUsageDetailRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("BssOpenApi", "2017-12-14", "DescribeSavingsPlansUsageDetail", "", "") + request.Method = requests.POST + return +} + +// CreateDescribeSavingsPlansUsageDetailResponse creates a response to parse from DescribeSavingsPlansUsageDetail response +func CreateDescribeSavingsPlansUsageDetailResponse() (response *DescribeSavingsPlansUsageDetailResponse) { + response = &DescribeSavingsPlansUsageDetailResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_savings_plans_usage_total.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_savings_plans_usage_total.go new file mode 100644 index 00000000000..086b603500e --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_savings_plans_usage_total.go @@ -0,0 +1,106 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeSavingsPlansUsageTotal invokes the bssopenapi.DescribeSavingsPlansUsageTotal API synchronously +func (client *Client) DescribeSavingsPlansUsageTotal(request *DescribeSavingsPlansUsageTotalRequest) (response *DescribeSavingsPlansUsageTotalResponse, err error) { + response = CreateDescribeSavingsPlansUsageTotalResponse() + err = client.DoAction(request, response) + return +} + +// DescribeSavingsPlansUsageTotalWithChan invokes the bssopenapi.DescribeSavingsPlansUsageTotal API asynchronously +func (client *Client) DescribeSavingsPlansUsageTotalWithChan(request *DescribeSavingsPlansUsageTotalRequest) (<-chan *DescribeSavingsPlansUsageTotalResponse, <-chan error) { + responseChan := make(chan *DescribeSavingsPlansUsageTotalResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeSavingsPlansUsageTotal(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeSavingsPlansUsageTotalWithCallback invokes the bssopenapi.DescribeSavingsPlansUsageTotal API asynchronously +func (client *Client) DescribeSavingsPlansUsageTotalWithCallback(request *DescribeSavingsPlansUsageTotalRequest, callback func(response *DescribeSavingsPlansUsageTotalResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeSavingsPlansUsageTotalResponse + var err error + defer close(result) + response, err = client.DescribeSavingsPlansUsageTotal(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeSavingsPlansUsageTotalRequest is the request struct for api DescribeSavingsPlansUsageTotal +type DescribeSavingsPlansUsageTotalRequest struct { + *requests.RpcRequest + PeriodType string `position:"Query" name:"PeriodType"` + BillOwnerId requests.Integer `position:"Query" name:"BillOwnerId"` + StartPeriod string `position:"Query" name:"StartPeriod"` + EndPeriod string `position:"Query" name:"EndPeriod"` +} + +// DescribeSavingsPlansUsageTotalResponse is the response struct for api DescribeSavingsPlansUsageTotal +type DescribeSavingsPlansUsageTotalResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data Data `json:"Data" xml:"Data"` +} + +// CreateDescribeSavingsPlansUsageTotalRequest creates a request to invoke DescribeSavingsPlansUsageTotal API +func CreateDescribeSavingsPlansUsageTotalRequest() (request *DescribeSavingsPlansUsageTotalRequest) { + request = &DescribeSavingsPlansUsageTotalRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("BssOpenApi", "2017-12-14", "DescribeSavingsPlansUsageTotal", "", "") + request.Method = requests.POST + return +} + +// CreateDescribeSavingsPlansUsageTotalResponse creates a response to parse from DescribeSavingsPlansUsageTotal response +func CreateDescribeSavingsPlansUsageTotalResponse() (response *DescribeSavingsPlansUsageTotalResponse) { + response = &DescribeSavingsPlansUsageTotalResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_split_item_bill.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_split_item_bill.go index d6d48f04f7d..7db485d0c3b 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_split_item_bill.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/describe_split_item_bill.go @@ -71,16 +71,18 @@ func (client *Client) DescribeSplitItemBillWithCallback(request *DescribeSplitIt // DescribeSplitItemBillRequest is the request struct for api DescribeSplitItemBill type DescribeSplitItemBillRequest struct { *requests.RpcRequest - SplitItemID string `position:"Query" name:"SplitItemID"` ProductCode string `position:"Query" name:"ProductCode"` SubscriptionType string `position:"Query" name:"SubscriptionType"` + BillOwnerId requests.Integer `position:"Query" name:"BillOwnerId"` + ProductType string `position:"Query" name:"ProductType"` + NextToken string `position:"Query" name:"NextToken"` + SplitItemID string `position:"Query" name:"SplitItemID"` BillingCycle string `position:"Query" name:"BillingCycle"` OwnerId requests.Integer `position:"Query" name:"OwnerId"` - BillOwnerId requests.Integer `position:"Query" name:"BillOwnerId"` TagFilter *[]DescribeSplitItemBillTagFilter `position:"Query" name:"TagFilter" type:"Repeated"` - ProductType string `position:"Query" name:"ProductType"` + BillingDate string `position:"Query" name:"BillingDate"` InstanceID string `position:"Query" name:"InstanceID"` - NextToken string `position:"Query" name:"NextToken"` + Granularity string `position:"Query" name:"Granularity"` MaxResults requests.Integer `position:"Query" name:"MaxResults"` } @@ -93,11 +95,11 @@ type DescribeSplitItemBillTagFilter struct { // DescribeSplitItemBillResponse is the response struct for api DescribeSplitItemBill type DescribeSplitItemBillResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Success bool `json:"Success" xml:"Success"` - Code string `json:"Code" xml:"Code"` - Message string `json:"Message" xml:"Message"` - Data DataInDescribeSplitItemBill `json:"Data" xml:"Data"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data Data `json:"Data" xml:"Data"` } // CreateDescribeSplitItemBillRequest creates a request to invoke DescribeSplitItemBill API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/get_customer_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/get_customer_list.go index a1713f404bc..d2172cefd0b 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/get_customer_list.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/get_customer_list.go @@ -76,11 +76,11 @@ type GetCustomerListRequest struct { // GetCustomerListResponse is the response struct for api GetCustomerList type GetCustomerListResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Success bool `json:"Success" xml:"Success"` - Code string `json:"Code" xml:"Code"` - Message string `json:"Message" xml:"Message"` - Data DataInGetCustomerList `json:"Data" xml:"Data"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data Data `json:"Data" xml:"Data"` } // CreateGetCustomerListRequest creates a request to invoke GetCustomerList API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/get_order_detail.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/get_order_detail.go index 346aa4c2849..b793b88303d 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/get_order_detail.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/get_order_detail.go @@ -78,11 +78,11 @@ type GetOrderDetailRequest struct { // GetOrderDetailResponse is the response struct for api GetOrderDetail type GetOrderDetailResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Message string `json:"Message" xml:"Message"` - Code string `json:"Code" xml:"Code"` - Success bool `json:"Success" xml:"Success"` - Data Data `json:"Data" xml:"Data"` + RequestId string `json:"RequestId" xml:"RequestId"` + Message string `json:"Message" xml:"Message"` + Code string `json:"Code" xml:"Code"` + Success bool `json:"Success" xml:"Success"` + Data DataInGetOrderDetail `json:"Data" xml:"Data"` } // CreateGetOrderDetailRequest creates a request to invoke GetOrderDetail API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/get_pay_as_you_go_price.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/get_pay_as_you_go_price.go index 25889d00784..471532bee95 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/get_pay_as_you_go_price.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/get_pay_as_you_go_price.go @@ -89,11 +89,11 @@ type GetPayAsYouGoPriceModuleList struct { // GetPayAsYouGoPriceResponse is the response struct for api GetPayAsYouGoPrice type GetPayAsYouGoPriceResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Success bool `json:"Success" xml:"Success"` - Code string `json:"Code" xml:"Code"` - Message string `json:"Message" xml:"Message"` - Data Data `json:"Data" xml:"Data"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data DataInGetPayAsYouGoPrice `json:"Data" xml:"Data"` } // CreateGetPayAsYouGoPriceRequest creates a request to invoke GetPayAsYouGoPrice API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/get_resource_package_price.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/get_resource_package_price.go index 2e0f56c6e0a..41aa26b9110 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/get_resource_package_price.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/get_resource_package_price.go @@ -85,11 +85,11 @@ type GetResourcePackagePriceRequest struct { // GetResourcePackagePriceResponse is the response struct for api GetResourcePackagePrice type GetResourcePackagePriceResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Success bool `json:"Success" xml:"Success"` - Code string `json:"Code" xml:"Code"` - Message string `json:"Message" xml:"Message"` - Data Data `json:"Data" xml:"Data"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data DataInGetResourcePackagePrice `json:"Data" xml:"Data"` } // CreateGetResourcePackagePriceRequest creates a request to invoke GetResourcePackagePrice API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/get_subscription_price.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/get_subscription_price.go index d0d7b038db1..1ce8c3160a8 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/get_subscription_price.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/get_subscription_price.go @@ -95,11 +95,11 @@ type GetSubscriptionPriceModuleList struct { // GetSubscriptionPriceResponse is the response struct for api GetSubscriptionPrice type GetSubscriptionPriceResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Success bool `json:"Success" xml:"Success"` - Code string `json:"Code" xml:"Code"` - Message string `json:"Message" xml:"Message"` - Data Data `json:"Data" xml:"Data"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data DataInGetSubscriptionPrice `json:"Data" xml:"Data"` } // CreateGetSubscriptionPriceRequest creates a request to invoke GetSubscriptionPrice API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/modify_account_relation.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/modify_account_relation.go new file mode 100644 index 00000000000..b7a27911224 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/modify_account_relation.go @@ -0,0 +1,110 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ModifyAccountRelation invokes the bssopenapi.ModifyAccountRelation API synchronously +func (client *Client) ModifyAccountRelation(request *ModifyAccountRelationRequest) (response *ModifyAccountRelationResponse, err error) { + response = CreateModifyAccountRelationResponse() + err = client.DoAction(request, response) + return +} + +// ModifyAccountRelationWithChan invokes the bssopenapi.ModifyAccountRelation API asynchronously +func (client *Client) ModifyAccountRelationWithChan(request *ModifyAccountRelationRequest) (<-chan *ModifyAccountRelationResponse, <-chan error) { + responseChan := make(chan *ModifyAccountRelationResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ModifyAccountRelation(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ModifyAccountRelationWithCallback invokes the bssopenapi.ModifyAccountRelation API asynchronously +func (client *Client) ModifyAccountRelationWithCallback(request *ModifyAccountRelationRequest, callback func(response *ModifyAccountRelationResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ModifyAccountRelationResponse + var err error + defer close(result) + response, err = client.ModifyAccountRelation(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ModifyAccountRelationRequest is the request struct for api ModifyAccountRelation +type ModifyAccountRelationRequest struct { + *requests.RpcRequest + ChildNick string `position:"Query" name:"ChildNick"` + RelationOperation string `position:"Query" name:"RelationOperation"` + RelationType string `position:"Query" name:"RelationType"` + ParentUserId requests.Integer `position:"Query" name:"ParentUserId"` + ChildUserId requests.Integer `position:"Query" name:"ChildUserId"` + RequestId string `position:"Query" name:"RequestId"` + PermissionCodes *[]string `position:"Query" name:"PermissionCodes" type:"Repeated"` + RoleCodes *[]string `position:"Query" name:"RoleCodes" type:"Repeated"` +} + +// ModifyAccountRelationResponse is the response struct for api ModifyAccountRelation +type ModifyAccountRelationResponse struct { + *responses.BaseResponse + Code string `json:"Code" xml:"Code"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Message string `json:"Message" xml:"Message"` + Data Data `json:"Data" xml:"Data"` +} + +// CreateModifyAccountRelationRequest creates a request to invoke ModifyAccountRelation API +func CreateModifyAccountRelationRequest() (request *ModifyAccountRelationRequest) { + request = &ModifyAccountRelationRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("BssOpenApi", "2017-12-14", "ModifyAccountRelation", "", "") + request.Method = requests.POST + return +} + +// CreateModifyAccountRelationResponse creates a response to parse from ModifyAccountRelation response +func CreateModifyAccountRelationResponse() (response *ModifyAccountRelationResponse) { + response = &ModifyAccountRelationResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_account_bill.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_account_bill.go index b5ea4aa07dc..a7f432438ea 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_account_bill.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_account_bill.go @@ -85,11 +85,11 @@ type QueryAccountBillRequest struct { // QueryAccountBillResponse is the response struct for api QueryAccountBill type QueryAccountBillResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Success bool `json:"Success" xml:"Success"` - Code string `json:"Code" xml:"Code"` - Message string `json:"Message" xml:"Message"` - Data Data `json:"Data" xml:"Data"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data DataInQueryAccountBill `json:"Data" xml:"Data"` } // CreateQueryAccountBillRequest creates a request to invoke QueryAccountBill API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_account_transaction_details.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_account_transaction_details.go index e7d9ad2e4ab..a18b6353e0f 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_account_transaction_details.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_account_transaction_details.go @@ -85,11 +85,11 @@ type QueryAccountTransactionDetailsRequest struct { // QueryAccountTransactionDetailsResponse is the response struct for api QueryAccountTransactionDetails type QueryAccountTransactionDetailsResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Success bool `json:"Success" xml:"Success"` - Code string `json:"Code" xml:"Code"` - Message string `json:"Message" xml:"Message"` - Data Data `json:"Data" xml:"Data"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data DataInQueryAccountTransactionDetails `json:"Data" xml:"Data"` } // CreateQueryAccountTransactionDetailsRequest creates a request to invoke QueryAccountTransactionDetails API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_account_transactions.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_account_transactions.go index 03960230e16..3922e6f0fce 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_account_transactions.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_account_transactions.go @@ -83,11 +83,11 @@ type QueryAccountTransactionsRequest struct { // QueryAccountTransactionsResponse is the response struct for api QueryAccountTransactions type QueryAccountTransactionsResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Success bool `json:"Success" xml:"Success"` - Code string `json:"Code" xml:"Code"` - Message string `json:"Message" xml:"Message"` - Data Data `json:"Data" xml:"Data"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data DataInQueryAccountTransactions `json:"Data" xml:"Data"` } // CreateQueryAccountTransactionsRequest creates a request to invoke QueryAccountTransactions API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_available_instances.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_available_instances.go index 29e10a6ec36..6535d2573b7 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_available_instances.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_available_instances.go @@ -89,11 +89,11 @@ type QueryAvailableInstancesRequest struct { // QueryAvailableInstancesResponse is the response struct for api QueryAvailableInstances type QueryAvailableInstancesResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Success bool `json:"Success" xml:"Success"` - Code string `json:"Code" xml:"Code"` - Message string `json:"Message" xml:"Message"` - Data DataInQueryAvailableInstances `json:"Data" xml:"Data"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data Data `json:"Data" xml:"Data"` } // CreateQueryAvailableInstancesRequest creates a request to invoke QueryAvailableInstances API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_bill.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_bill.go index c8347f4bfd2..9184ca7e888 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_bill.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_bill.go @@ -87,11 +87,11 @@ type QueryBillRequest struct { // QueryBillResponse is the response struct for api QueryBill type QueryBillResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Success bool `json:"Success" xml:"Success"` - Code string `json:"Code" xml:"Code"` - Message string `json:"Message" xml:"Message"` - Data Data `json:"Data" xml:"Data"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data DataInQueryBill `json:"Data" xml:"Data"` } // CreateQueryBillRequest creates a request to invoke QueryBill API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_bill_overview.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_bill_overview.go index 1a76011600c..f4ef788fcd9 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_bill_overview.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_bill_overview.go @@ -81,11 +81,11 @@ type QueryBillOverviewRequest struct { // QueryBillOverviewResponse is the response struct for api QueryBillOverview type QueryBillOverviewResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Success bool `json:"Success" xml:"Success"` - Code string `json:"Code" xml:"Code"` - Message string `json:"Message" xml:"Message"` - Data Data `json:"Data" xml:"Data"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data DataInQueryBillOverview `json:"Data" xml:"Data"` } // CreateQueryBillOverviewRequest creates a request to invoke QueryBillOverview API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_bill_to_oss_subscription.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_bill_to_oss_subscription.go index edc6114581f..c37055df329 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_bill_to_oss_subscription.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_bill_to_oss_subscription.go @@ -76,11 +76,11 @@ type QueryBillToOSSSubscriptionRequest struct { // QueryBillToOSSSubscriptionResponse is the response struct for api QueryBillToOSSSubscription type QueryBillToOSSSubscriptionResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Success bool `json:"Success" xml:"Success"` - Code string `json:"Code" xml:"Code"` - Message string `json:"Message" xml:"Message"` - Data Data `json:"Data" xml:"Data"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data DataInQueryBillToOSSSubscription `json:"Data" xml:"Data"` } // CreateQueryBillToOSSSubscriptionRequest creates a request to invoke QueryBillToOSSSubscription API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_cost_unit.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_cost_unit.go index da53851795a..57b59dca6da 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_cost_unit.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_cost_unit.go @@ -80,11 +80,11 @@ type QueryCostUnitRequest struct { // QueryCostUnitResponse is the response struct for api QueryCostUnit type QueryCostUnitResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Message string `json:"Message" xml:"Message"` - Code string `json:"Code" xml:"Code"` - Success bool `json:"Success" xml:"Success"` - Data DataInQueryCostUnit `json:"Data" xml:"Data"` + RequestId string `json:"RequestId" xml:"RequestId"` + Message string `json:"Message" xml:"Message"` + Code string `json:"Code" xml:"Code"` + Success bool `json:"Success" xml:"Success"` + Data Data `json:"Data" xml:"Data"` } // CreateQueryCostUnitRequest creates a request to invoke QueryCostUnit API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_cost_unit_resource.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_cost_unit_resource.go index 9ad40fc51e6..3e642ad870a 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_cost_unit_resource.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_cost_unit_resource.go @@ -80,11 +80,11 @@ type QueryCostUnitResourceRequest struct { // QueryCostUnitResourceResponse is the response struct for api QueryCostUnitResource type QueryCostUnitResourceResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Message string `json:"Message" xml:"Message"` - Code string `json:"Code" xml:"Code"` - Success bool `json:"Success" xml:"Success"` - Data DataInQueryCostUnitResource `json:"Data" xml:"Data"` + RequestId string `json:"RequestId" xml:"RequestId"` + Message string `json:"Message" xml:"Message"` + Code string `json:"Code" xml:"Code"` + Success bool `json:"Success" xml:"Success"` + Data Data `json:"Data" xml:"Data"` } // CreateQueryCostUnitResourceRequest creates a request to invoke QueryCostUnitResource API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_customer_address_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_customer_address_list.go index 4efae6167de..ce56b2db239 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_customer_address_list.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_customer_address_list.go @@ -77,11 +77,11 @@ type QueryCustomerAddressListRequest struct { // QueryCustomerAddressListResponse is the response struct for api QueryCustomerAddressList type QueryCustomerAddressListResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Success bool `json:"Success" xml:"Success"` - Code string `json:"Code" xml:"Code"` - Message string `json:"Message" xml:"Message"` - Data Data `json:"Data" xml:"Data"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data DataInQueryCustomerAddressList `json:"Data" xml:"Data"` } // CreateQueryCustomerAddressListRequest creates a request to invoke QueryCustomerAddressList API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_dp_utilization_detail.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_dp_utilization_detail.go new file mode 100644 index 00000000000..c6247822bfa --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_dp_utilization_detail.go @@ -0,0 +1,112 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// QueryDPUtilizationDetail invokes the bssopenapi.QueryDPUtilizationDetail API synchronously +func (client *Client) QueryDPUtilizationDetail(request *QueryDPUtilizationDetailRequest) (response *QueryDPUtilizationDetailResponse, err error) { + response = CreateQueryDPUtilizationDetailResponse() + err = client.DoAction(request, response) + return +} + +// QueryDPUtilizationDetailWithChan invokes the bssopenapi.QueryDPUtilizationDetail API asynchronously +func (client *Client) QueryDPUtilizationDetailWithChan(request *QueryDPUtilizationDetailRequest) (<-chan *QueryDPUtilizationDetailResponse, <-chan error) { + responseChan := make(chan *QueryDPUtilizationDetailResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.QueryDPUtilizationDetail(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// QueryDPUtilizationDetailWithCallback invokes the bssopenapi.QueryDPUtilizationDetail API asynchronously +func (client *Client) QueryDPUtilizationDetailWithCallback(request *QueryDPUtilizationDetailRequest, callback func(response *QueryDPUtilizationDetailResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *QueryDPUtilizationDetailResponse + var err error + defer close(result) + response, err = client.QueryDPUtilizationDetail(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// QueryDPUtilizationDetailRequest is the request struct for api QueryDPUtilizationDetail +type QueryDPUtilizationDetailRequest struct { + *requests.RpcRequest + DeductedInstanceId string `position:"Query" name:"DeductedInstanceId"` + LastToken string `position:"Query" name:"LastToken"` + InstanceSpec string `position:"Query" name:"InstanceSpec"` + ProdCode string `position:"Query" name:"ProdCode"` + EndTime string `position:"Query" name:"EndTime"` + IncludeShare requests.Boolean `position:"Query" name:"IncludeShare"` + CommodityCode string `position:"Query" name:"CommodityCode"` + StartTime string `position:"Query" name:"StartTime"` + InstanceId string `position:"Query" name:"InstanceId"` + Limit requests.Integer `position:"Query" name:"Limit"` +} + +// QueryDPUtilizationDetailResponse is the response struct for api QueryDPUtilizationDetail +type QueryDPUtilizationDetailResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data DataInQueryDPUtilizationDetail `json:"Data" xml:"Data"` +} + +// CreateQueryDPUtilizationDetailRequest creates a request to invoke QueryDPUtilizationDetail API +func CreateQueryDPUtilizationDetailRequest() (request *QueryDPUtilizationDetailRequest) { + request = &QueryDPUtilizationDetailRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("BssOpenApi", "2017-12-14", "QueryDPUtilizationDetail", "", "") + request.Method = requests.POST + return +} + +// CreateQueryDPUtilizationDetailResponse creates a response to parse from QueryDPUtilizationDetail response +func CreateQueryDPUtilizationDetailResponse() (response *QueryDPUtilizationDetailResponse) { + response = &QueryDPUtilizationDetailResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_evaluate_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_evaluate_list.go index 301ca629e96..c1d96171fc1 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_evaluate_list.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_evaluate_list.go @@ -90,11 +90,11 @@ type QueryEvaluateListRequest struct { // QueryEvaluateListResponse is the response struct for api QueryEvaluateList type QueryEvaluateListResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Success bool `json:"Success" xml:"Success"` - Code string `json:"Code" xml:"Code"` - Message string `json:"Message" xml:"Message"` - Data Data `json:"Data" xml:"Data"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data DataInQueryEvaluateList `json:"Data" xml:"Data"` } // CreateQueryEvaluateListRequest creates a request to invoke QueryEvaluateList API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_instance_bill.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_instance_bill.go index 72b9d46a4ae..a8fcdbaa477 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_instance_bill.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_instance_bill.go @@ -88,11 +88,11 @@ type QueryInstanceBillRequest struct { // QueryInstanceBillResponse is the response struct for api QueryInstanceBill type QueryInstanceBillResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Success bool `json:"Success" xml:"Success"` - Code string `json:"Code" xml:"Code"` - Message string `json:"Message" xml:"Message"` - Data Data `json:"Data" xml:"Data"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data DataInQueryInstanceBill `json:"Data" xml:"Data"` } // CreateQueryInstanceBillRequest creates a request to invoke QueryInstanceBill API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_instance_gaap_cost.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_instance_gaap_cost.go index bdcc0875ad8..2b15e997f3c 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_instance_gaap_cost.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_instance_gaap_cost.go @@ -82,11 +82,11 @@ type QueryInstanceGaapCostRequest struct { // QueryInstanceGaapCostResponse is the response struct for api QueryInstanceGaapCost type QueryInstanceGaapCostResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Success bool `json:"Success" xml:"Success"` - Code string `json:"Code" xml:"Code"` - Message string `json:"Message" xml:"Message"` - Data Data `json:"Data" xml:"Data"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data DataInQueryInstanceGaapCost `json:"Data" xml:"Data"` } // CreateQueryInstanceGaapCostRequest creates a request to invoke QueryInstanceGaapCost API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_invoicing_customer_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_invoicing_customer_list.go index 08620677015..37ba7a37eec 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_invoicing_customer_list.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_invoicing_customer_list.go @@ -77,11 +77,11 @@ type QueryInvoicingCustomerListRequest struct { // QueryInvoicingCustomerListResponse is the response struct for api QueryInvoicingCustomerList type QueryInvoicingCustomerListResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Success bool `json:"Success" xml:"Success"` - Code string `json:"Code" xml:"Code"` - Message string `json:"Message" xml:"Message"` - Data Data `json:"Data" xml:"Data"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data DataInQueryInvoicingCustomerList `json:"Data" xml:"Data"` } // CreateQueryInvoicingCustomerListRequest creates a request to invoke QueryInvoicingCustomerList API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_monthly_bill.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_monthly_bill.go index ee9b3f99485..3be14bbe724 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_monthly_bill.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_monthly_bill.go @@ -77,11 +77,11 @@ type QueryMonthlyBillRequest struct { // QueryMonthlyBillResponse is the response struct for api QueryMonthlyBill type QueryMonthlyBillResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Success bool `json:"Success" xml:"Success"` - Code string `json:"Code" xml:"Code"` - Message string `json:"Message" xml:"Message"` - Data Data `json:"Data" xml:"Data"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data DataInQueryMonthlyBill `json:"Data" xml:"Data"` } // CreateQueryMonthlyBillRequest creates a request to invoke QueryMonthlyBill API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_monthly_instance_consumption.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_monthly_instance_consumption.go index 3f2f198a824..be600096b70 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_monthly_instance_consumption.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_monthly_instance_consumption.go @@ -83,11 +83,11 @@ type QueryMonthlyInstanceConsumptionRequest struct { // QueryMonthlyInstanceConsumptionResponse is the response struct for api QueryMonthlyInstanceConsumption type QueryMonthlyInstanceConsumptionResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Success bool `json:"Success" xml:"Success"` - Code string `json:"Code" xml:"Code"` - Message string `json:"Message" xml:"Message"` - Data Data `json:"Data" xml:"Data"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data DataInQueryMonthlyInstanceConsumption `json:"Data" xml:"Data"` } // CreateQueryMonthlyInstanceConsumptionRequest creates a request to invoke QueryMonthlyInstanceConsumption API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_orders.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_orders.go index 2f7e1d9c5c8..1acd67315f0 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_orders.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_orders.go @@ -86,11 +86,11 @@ type QueryOrdersRequest struct { // QueryOrdersResponse is the response struct for api QueryOrders type QueryOrdersResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Success bool `json:"Success" xml:"Success"` - Code string `json:"Code" xml:"Code"` - Message string `json:"Message" xml:"Message"` - Data Data `json:"Data" xml:"Data"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data DataInQueryOrders `json:"Data" xml:"Data"` } // CreateQueryOrdersRequest creates a request to invoke QueryOrders API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_permission_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_permission_list.go index 3516f7811ac..58fd481b1be 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_permission_list.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_permission_list.go @@ -77,11 +77,11 @@ type QueryPermissionListRequest struct { // QueryPermissionListResponse is the response struct for api QueryPermissionList type QueryPermissionListResponse struct { *responses.BaseResponse - Code string `json:"Code" xml:"Code"` - RequestId string `json:"RequestId" xml:"RequestId"` - Success bool `json:"Success" xml:"Success"` - Message string `json:"Message" xml:"Message"` - Data DataInQueryPermissionList `json:"Data" xml:"Data"` + Code string `json:"Code" xml:"Code"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Message string `json:"Message" xml:"Message"` + Data Data `json:"Data" xml:"Data"` } // CreateQueryPermissionListRequest creates a request to invoke QueryPermissionList API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_product_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_product_list.go index aed331521e1..ddb2ec0c677 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_product_list.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_product_list.go @@ -79,11 +79,11 @@ type QueryProductListRequest struct { // QueryProductListResponse is the response struct for api QueryProductList type QueryProductListResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Success bool `json:"Success" xml:"Success"` - Code string `json:"Code" xml:"Code"` - Message string `json:"Message" xml:"Message"` - Data Data `json:"Data" xml:"Data"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data DataInQueryProductList `json:"Data" xml:"Data"` } // CreateQueryProductListRequest creates a request to invoke QueryProductList API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_relation_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_relation_list.go index 7f31816a2b0..9fe56c52841 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_relation_list.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_relation_list.go @@ -80,11 +80,11 @@ type QueryRelationListRequest struct { // QueryRelationListResponse is the response struct for api QueryRelationList type QueryRelationListResponse struct { *responses.BaseResponse - Code string `json:"Code" xml:"Code"` - RequestId string `json:"RequestId" xml:"RequestId"` - Success bool `json:"Success" xml:"Success"` - Message string `json:"Message" xml:"Message"` - Data DataInQueryRelationList `json:"Data" xml:"Data"` + Code string `json:"Code" xml:"Code"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Message string `json:"Message" xml:"Message"` + Data Data `json:"Data" xml:"Data"` } // CreateQueryRelationListRequest creates a request to invoke QueryRelationList API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_savings_plans_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_savings_plans_instance.go index 904b6e2d065..e259cf1bfcd 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_savings_plans_instance.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_savings_plans_instance.go @@ -71,12 +71,19 @@ func (client *Client) QuerySavingsPlansInstanceWithCallback(request *QuerySaving // QuerySavingsPlansInstanceRequest is the request struct for api QuerySavingsPlansInstance type QuerySavingsPlansInstanceRequest struct { *requests.RpcRequest - EndTime string `position:"Query" name:"EndTime"` - StartTime string `position:"Query" name:"StartTime"` - Locale string `position:"Query" name:"Locale"` - PageNum requests.Integer `position:"Query" name:"PageNum"` - InstanceId string `position:"Query" name:"InstanceId"` - PageSize requests.Integer `position:"Query" name:"PageSize"` + EndTime string `position:"Query" name:"EndTime"` + StartTime string `position:"Query" name:"StartTime"` + Locale string `position:"Query" name:"Locale"` + PageNum requests.Integer `position:"Query" name:"PageNum"` + InstanceId string `position:"Query" name:"InstanceId"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + Tag *[]QuerySavingsPlansInstanceTag `position:"Query" name:"Tag" type:"Repeated"` +} + +// QuerySavingsPlansInstanceTag is a repeated param struct in QuerySavingsPlansInstanceRequest +type QuerySavingsPlansInstanceTag struct { + Value string `name:"Value"` + Key string `name:"Key"` } // QuerySavingsPlansInstanceResponse is the response struct for api QuerySavingsPlansInstance diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_settle_bill.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_settle_bill.go index a10dc1a3b8e..1657cf1a0c8 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_settle_bill.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_settle_bill.go @@ -88,11 +88,11 @@ type QuerySettleBillRequest struct { // QuerySettleBillResponse is the response struct for api QuerySettleBill type QuerySettleBillResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Success bool `json:"Success" xml:"Success"` - Code string `json:"Code" xml:"Code"` - Message string `json:"Message" xml:"Message"` - Data Data `json:"Data" xml:"Data"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data DataInQuerySettleBill `json:"Data" xml:"Data"` } // CreateQuerySettleBillRequest creates a request to invoke QuerySettleBill API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_settlement_bill.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_settlement_bill.go index 8b425c4d200..d6934267fab 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_settlement_bill.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_settlement_bill.go @@ -87,11 +87,11 @@ type QuerySettlementBillRequest struct { // QuerySettlementBillResponse is the response struct for api QuerySettlementBill type QuerySettlementBillResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Success bool `json:"Success" xml:"Success"` - Code string `json:"Code" xml:"Code"` - Message string `json:"Message" xml:"Message"` - Data Data `json:"Data" xml:"Data"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data DataInQuerySettlementBill `json:"Data" xml:"Data"` } // CreateQuerySettlementBillRequest creates a request to invoke QuerySettlementBill API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_split_item_bill.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_split_item_bill.go index 7c601112eea..3e6cdfd87af 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_split_item_bill.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_split_item_bill.go @@ -84,11 +84,11 @@ type QuerySplitItemBillRequest struct { // QuerySplitItemBillResponse is the response struct for api QuerySplitItemBill type QuerySplitItemBillResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Success bool `json:"Success" xml:"Success"` - Code string `json:"Code" xml:"Code"` - Message string `json:"Message" xml:"Message"` - Data Data `json:"Data" xml:"Data"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data DataInQuerySplitItemBill `json:"Data" xml:"Data"` } // CreateQuerySplitItemBillRequest creates a request to invoke QuerySplitItemBill API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_user_oms_data.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_user_oms_data.go index cdd9c5e3f94..0ca6ba2e871 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_user_oms_data.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/query_user_oms_data.go @@ -83,11 +83,11 @@ type QueryUserOmsDataRequest struct { // QueryUserOmsDataResponse is the response struct for api QueryUserOmsData type QueryUserOmsDataResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Success bool `json:"Success" xml:"Success"` - Code string `json:"Code" xml:"Code"` - Message string `json:"Message" xml:"Message"` - Data DataInQueryUserOmsData `json:"Data" xml:"Data"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data Data `json:"Data" xml:"Data"` } // CreateQueryUserOmsDataRequest creates a request to invoke QueryUserOmsData API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/relieve_account_relation.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/relieve_account_relation.go new file mode 100644 index 00000000000..2a71d5fedec --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/relieve_account_relation.go @@ -0,0 +1,106 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// RelieveAccountRelation invokes the bssopenapi.RelieveAccountRelation API synchronously +func (client *Client) RelieveAccountRelation(request *RelieveAccountRelationRequest) (response *RelieveAccountRelationResponse, err error) { + response = CreateRelieveAccountRelationResponse() + err = client.DoAction(request, response) + return +} + +// RelieveAccountRelationWithChan invokes the bssopenapi.RelieveAccountRelation API asynchronously +func (client *Client) RelieveAccountRelationWithChan(request *RelieveAccountRelationRequest) (<-chan *RelieveAccountRelationResponse, <-chan error) { + responseChan := make(chan *RelieveAccountRelationResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.RelieveAccountRelation(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// RelieveAccountRelationWithCallback invokes the bssopenapi.RelieveAccountRelation API asynchronously +func (client *Client) RelieveAccountRelationWithCallback(request *RelieveAccountRelationRequest, callback func(response *RelieveAccountRelationResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *RelieveAccountRelationResponse + var err error + defer close(result) + response, err = client.RelieveAccountRelation(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// RelieveAccountRelationRequest is the request struct for api RelieveAccountRelation +type RelieveAccountRelationRequest struct { + *requests.RpcRequest + RelationType string `position:"Query" name:"RelationType"` + ParentUserId requests.Integer `position:"Query" name:"ParentUserId"` + ChildUserId requests.Integer `position:"Query" name:"ChildUserId"` + RequestId string `position:"Query" name:"RequestId"` +} + +// RelieveAccountRelationResponse is the response struct for api RelieveAccountRelation +type RelieveAccountRelationResponse struct { + *responses.BaseResponse + Code string `json:"Code" xml:"Code"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Message string `json:"Message" xml:"Message"` + Data Data `json:"Data" xml:"Data"` +} + +// CreateRelieveAccountRelationRequest creates a request to invoke RelieveAccountRelation API +func CreateRelieveAccountRelationRequest() (request *RelieveAccountRelationRequest) { + request = &RelieveAccountRelationRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("BssOpenApi", "2017-12-14", "RelieveAccountRelation", "", "") + request.Method = requests.POST + return +} + +// CreateRelieveAccountRelationResponse creates a response to parse from RelieveAccountRelation response +func CreateRelieveAccountRelationResponse() (response *RelieveAccountRelationResponse) { + response = &RelieveAccountRelationResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/set_all_expiration_day.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/set_all_expiration_day.go new file mode 100644 index 00000000000..1695f35da87 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/set_all_expiration_day.go @@ -0,0 +1,103 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// SetAllExpirationDay invokes the bssopenapi.SetAllExpirationDay API synchronously +func (client *Client) SetAllExpirationDay(request *SetAllExpirationDayRequest) (response *SetAllExpirationDayResponse, err error) { + response = CreateSetAllExpirationDayResponse() + err = client.DoAction(request, response) + return +} + +// SetAllExpirationDayWithChan invokes the bssopenapi.SetAllExpirationDay API asynchronously +func (client *Client) SetAllExpirationDayWithChan(request *SetAllExpirationDayRequest) (<-chan *SetAllExpirationDayResponse, <-chan error) { + responseChan := make(chan *SetAllExpirationDayResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.SetAllExpirationDay(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// SetAllExpirationDayWithCallback invokes the bssopenapi.SetAllExpirationDay API asynchronously +func (client *Client) SetAllExpirationDayWithCallback(request *SetAllExpirationDayRequest, callback func(response *SetAllExpirationDayResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *SetAllExpirationDayResponse + var err error + defer close(result) + response, err = client.SetAllExpirationDay(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// SetAllExpirationDayRequest is the request struct for api SetAllExpirationDay +type SetAllExpirationDayRequest struct { + *requests.RpcRequest + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + UnifyExpireDay string `position:"Query" name:"UnifyExpireDay"` +} + +// SetAllExpirationDayResponse is the response struct for api SetAllExpirationDay +type SetAllExpirationDayResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` +} + +// CreateSetAllExpirationDayRequest creates a request to invoke SetAllExpirationDay API +func CreateSetAllExpirationDayRequest() (request *SetAllExpirationDayRequest) { + request = &SetAllExpirationDayRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("BssOpenApi", "2017-12-14", "SetAllExpirationDay", "", "") + request.Method = requests.POST + return +} + +// CreateSetAllExpirationDayResponse creates a response to parse from SetAllExpirationDay response +func CreateSetAllExpirationDayResponse() (response *SetAllExpirationDayResponse) { + response = &SetAllExpirationDayResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data.go index f1580affcbe..c662ffb393c 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data.go @@ -17,24 +17,11 @@ package bssopenapi // Data is a nested struct in bssopenapi response type Data struct { - ToUnitUserId int64 `json:"ToUnitUserId" xml:"ToUnitUserId"` - MasterId int64 `json:"MasterId" xml:"MasterId"` - TradePrice float64 `json:"TradePrice" xml:"TradePrice"` - HostId string `json:"HostId" xml:"HostId"` - TotalUnAppliedInvoiceAmount int64 `json:"TotalUnAppliedInvoiceAmount" xml:"TotalUnAppliedInvoiceAmount"` - OriginalPrice float64 `json:"OriginalPrice" xml:"OriginalPrice"` RelationType string `json:"RelationType" xml:"RelationType"` - ToUnitId int64 `json:"ToUnitId" xml:"ToUnitId"` - OrderId string `json:"OrderId" xml:"OrderId"` - HostingStatus string `json:"HostingStatus" xml:"HostingStatus"` - TotalCount int `json:"TotalCount" xml:"TotalCount"` MaxResults int `json:"MaxResults" xml:"MaxResults"` CreditLimitStatus string `json:"CreditLimitStatus" xml:"CreditLimitStatus"` MemberId int64 `json:"MemberId" xml:"MemberId"` - BillingCycle string `json:"BillingCycle" xml:"BillingCycle"` - OutstandingAmount float64 `json:"OutstandingAmount" xml:"OutstandingAmount"` Quantity int `json:"Quantity" xml:"Quantity"` - AvailableCashAmount string `json:"AvailableCashAmount" xml:"AvailableCashAmount"` MemberNickName string `json:"MemberNickName" xml:"MemberNickName"` StartTime string `json:"StartTime" xml:"StartTime"` EndTime string `json:"EndTime" xml:"EndTime"` @@ -42,54 +29,71 @@ type Data struct { TotalOutstandingAmount float64 `json:"TotalOutstandingAmount" xml:"TotalOutstandingAmount"` NewInvoiceAmount float64 `json:"NewInvoiceAmount" xml:"NewInvoiceAmount"` Marker string `json:"Marker" xml:"Marker"` - AccountType string `json:"AccountType" xml:"AccountType"` - AvailableAmount string `json:"AvailableAmount" xml:"AvailableAmount"` PageSize int `json:"PageSize" xml:"PageSize"` MybankCreditAmount string `json:"MybankCreditAmount" xml:"MybankCreditAmount"` - UnitId int64 `json:"UnitId" xml:"UnitId"` - CreditAmount string `json:"CreditAmount" xml:"CreditAmount"` - AccountID string `json:"AccountID" xml:"AccountID"` InstanceId string `json:"InstanceId" xml:"InstanceId"` - IsFinancialAccount bool `json:"IsFinancialAccount" xml:"IsFinancialAccount"` OwnerUid int64 `json:"OwnerUid" xml:"OwnerUid"` InvoiceApplyId int64 `json:"InvoiceApplyId" xml:"InvoiceApplyId"` - Boolean bool `json:"Boolean" xml:"Boolean"` - IsCertified bool `json:"IsCertified" xml:"IsCertified"` TotalInvoiceAmount int64 `json:"TotalInvoiceAmount" xml:"TotalInvoiceAmount"` SetupTime string `json:"SetupTime" xml:"SetupTime"` PageNum int `json:"PageNum" xml:"PageNum"` - IsSuccess bool `json:"IsSuccess" xml:"IsSuccess"` - Currency string `json:"Currency" xml:"Currency"` - MemberGroupId int64 `json:"MemberGroupId" xml:"MemberGroupId"` LoginEmail string `json:"LoginEmail" xml:"LoginEmail"` DiscountPrice float64 `json:"DiscountPrice" xml:"DiscountPrice"` State string `json:"State" xml:"State"` AccountName string `json:"AccountName" xml:"AccountName"` NextToken string `json:"NextToken" xml:"NextToken"` + MemberGroupName string `json:"MemberGroupName" xml:"MemberGroupName"` + ToUnitUserId int64 `json:"ToUnitUserId" xml:"ToUnitUserId"` + MasterId int64 `json:"MasterId" xml:"MasterId"` + TradePrice float64 `json:"TradePrice" xml:"TradePrice"` + HostId string `json:"HostId" xml:"HostId"` + TotalUnAppliedInvoiceAmount int64 `json:"TotalUnAppliedInvoiceAmount" xml:"TotalUnAppliedInvoiceAmount"` + OriginalPrice float64 `json:"OriginalPrice" xml:"OriginalPrice"` + ToUnitId int64 `json:"ToUnitId" xml:"ToUnitId"` + OrderId string `json:"OrderId" xml:"OrderId"` + HostingStatus string `json:"HostingStatus" xml:"HostingStatus"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + BillingCycle string `json:"BillingCycle" xml:"BillingCycle"` + OutstandingAmount float64 `json:"OutstandingAmount" xml:"OutstandingAmount"` + AvailableCashAmount string `json:"AvailableCashAmount" xml:"AvailableCashAmount"` + AccountType string `json:"AccountType" xml:"AccountType"` + AvailableAmount string `json:"AvailableAmount" xml:"AvailableAmount"` + UnitId int64 `json:"UnitId" xml:"UnitId"` + CreditAmount string `json:"CreditAmount" xml:"CreditAmount"` + AccountID string `json:"AccountID" xml:"AccountID"` + IsFinancialAccount bool `json:"IsFinancialAccount" xml:"IsFinancialAccount"` + Boolean bool `json:"Boolean" xml:"Boolean"` + IsCertified bool `json:"IsCertified" xml:"IsCertified"` + IsSuccess bool `json:"IsSuccess" xml:"IsSuccess"` + Currency string `json:"Currency" xml:"Currency"` + MemberGroupId int64 `json:"MemberGroupId" xml:"MemberGroupId"` UserName string `json:"UserName" xml:"UserName"` Mpk int64 `json:"Mpk" xml:"Mpk"` - MemberGroupName string `json:"MemberGroupName" xml:"MemberGroupName"` - UidList UidList `json:"UidList" xml:"UidList"` - OmsData OmsData `json:"OmsData" xml:"OmsData"` + OmsData []map[string]interface{} `json:"OmsData" xml:"OmsData"` + UidList []string `json:"UidList" xml:"UidList"` CostUnit CostUnit `json:"CostUnit" xml:"CostUnit"` CostUnitStatisInfo CostUnitStatisInfo `json:"CostUnitStatisInfo" xml:"CostUnitStatisInfo"` - OrderList OrderListInGetOrderDetail `json:"OrderList" xml:"OrderList"` + TotalCoverage TotalCoverage `json:"TotalCoverage" xml:"TotalCoverage"` + TotalUsage TotalUsage `json:"TotalUsage" xml:"TotalUsage"` CostUnitDtoList []CostUnitDtoListItem `json:"CostUnitDtoList" xml:"CostUnitDtoList"` ModuleList ModuleList `json:"ModuleList" xml:"ModuleList"` - InstanceList []Instance `json:"InstanceList" xml:"InstanceList"` + PeriodCoverage []Item `json:"PeriodCoverage" xml:"PeriodCoverage"` Modules Modules `json:"Modules" xml:"Modules"` - Items ItemsInQueryAccountBill `json:"Items" xml:"Items"` ResourcePackages ResourcePackages `json:"ResourcePackages" xml:"ResourcePackages"` ProductList ProductList `json:"ProductList" xml:"ProductList"` + Items []Item `json:"Items" xml:"Items"` + PermissionList []PermissionListItem `json:"PermissionList" xml:"PermissionList"` + ResourceInstanceDtoList []ResourceInstanceList `json:"ResourceInstanceDtoList" xml:"ResourceInstanceDtoList"` + CustomerInvoiceList CustomerInvoiceList `json:"CustomerInvoiceList" xml:"CustomerInvoiceList"` + AttributeList AttributeList `json:"AttributeList" xml:"AttributeList"` + OrderList OrderListInGetOrderDetail `json:"OrderList" xml:"OrderList"` + InstanceList []Instance `json:"InstanceList" xml:"InstanceList"` ModuleDetails ModuleDetailsInGetPayAsYouGoPrice `json:"ModuleDetails" xml:"ModuleDetails"` PromotionDetails PromotionDetailsInGetPayAsYouGoPrice `json:"PromotionDetails" xml:"PromotionDetails"` - PermissionList []PermissionListItem `json:"PermissionList" xml:"PermissionList"` AccountTransactionsList AccountTransactionsListInQueryAccountTransactionDetails `json:"AccountTransactionsList" xml:"AccountTransactionsList"` EvaluateList EvaluateList `json:"EvaluateList" xml:"EvaluateList"` Promotions Promotions `json:"Promotions" xml:"Promotions"` - ResourceInstanceDtoList []ResourceInstanceList `json:"ResourceInstanceDtoList" xml:"ResourceInstanceDtoList"` + DetailList DetailListInQueryDPUtilizationDetail `json:"DetailList" xml:"DetailList"` CustomerInvoiceAddressList CustomerInvoiceAddressList `json:"CustomerInvoiceAddressList" xml:"CustomerInvoiceAddressList"` - CustomerInvoiceList CustomerInvoiceList `json:"CustomerInvoiceList" xml:"CustomerInvoiceList"` FinancialRelationInfoList []FinancialRelationInfoListItem `json:"FinancialRelationInfoList" xml:"FinancialRelationInfoList"` - AttributeList AttributeList `json:"AttributeList" xml:"AttributeList"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_create_cost_unit.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_create_cost_unit.go deleted file mode 100644 index 47e7be2b888..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_create_cost_unit.go +++ /dev/null @@ -1,21 +0,0 @@ -package bssopenapi - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DataInCreateCostUnit is a nested struct in bssopenapi response -type DataInCreateCostUnit struct { - CostUnitDtoList []CostUnitDtoListItem `json:"CostUnitDtoList" xml:"CostUnitDtoList"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_describe_instance_bill.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_describe_instance_bill.go deleted file mode 100644 index b1b0ef2d61c..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_describe_instance_bill.go +++ /dev/null @@ -1,27 +0,0 @@ -package bssopenapi - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DataInDescribeInstanceBill is a nested struct in bssopenapi response -type DataInDescribeInstanceBill struct { - BillingCycle string `json:"BillingCycle" xml:"BillingCycle"` - AccountID string `json:"AccountID" xml:"AccountID"` - AccountName string `json:"AccountName" xml:"AccountName"` - TotalCount int `json:"TotalCount" xml:"TotalCount"` - NextToken string `json:"NextToken" xml:"NextToken"` - MaxResults int `json:"MaxResults" xml:"MaxResults"` - Items []Item `json:"Items" xml:"Items"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_describe_pricing_module.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_describe_pricing_module.go new file mode 100644 index 00000000000..da4534f19be --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_describe_pricing_module.go @@ -0,0 +1,22 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DataInDescribePricingModule is a nested struct in bssopenapi response +type DataInDescribePricingModule struct { + ModuleList ModuleList `json:"ModuleList" xml:"ModuleList"` + AttributeList AttributeList `json:"AttributeList" xml:"AttributeList"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_describe_resource_package_product.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_describe_resource_package_product.go new file mode 100644 index 00000000000..25efdb54ed4 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_describe_resource_package_product.go @@ -0,0 +1,21 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DataInDescribeResourcePackageProduct is a nested struct in bssopenapi response +type DataInDescribeResourcePackageProduct struct { + ResourcePackages ResourcePackages `json:"ResourcePackages" xml:"ResourcePackages"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_describe_split_item_bill.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_describe_split_item_bill.go deleted file mode 100644 index 1cc915936c2..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_describe_split_item_bill.go +++ /dev/null @@ -1,27 +0,0 @@ -package bssopenapi - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DataInDescribeSplitItemBill is a nested struct in bssopenapi response -type DataInDescribeSplitItemBill struct { - BillingCycle string `json:"BillingCycle" xml:"BillingCycle"` - AccountID string `json:"AccountID" xml:"AccountID"` - AccountName string `json:"AccountName" xml:"AccountName"` - TotalCount int `json:"TotalCount" xml:"TotalCount"` - NextToken string `json:"NextToken" xml:"NextToken"` - MaxResults int `json:"MaxResults" xml:"MaxResults"` - Items []Item `json:"Items" xml:"Items"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_get_customer_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_get_customer_list.go deleted file mode 100644 index 29c5f0be71d..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_get_customer_list.go +++ /dev/null @@ -1,21 +0,0 @@ -package bssopenapi - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DataInGetCustomerList is a nested struct in bssopenapi response -type DataInGetCustomerList struct { - UidList []string `json:"UidList" xml:"UidList"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_get_order_detail.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_get_order_detail.go new file mode 100644 index 00000000000..c55244b1b2c --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_get_order_detail.go @@ -0,0 +1,25 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DataInGetOrderDetail is a nested struct in bssopenapi response +type DataInGetOrderDetail struct { + TotalCount int `json:"TotalCount" xml:"TotalCount"` + PageSize int `json:"PageSize" xml:"PageSize"` + PageNum int `json:"PageNum" xml:"PageNum"` + HostName string `json:"HostName" xml:"HostName"` + OrderList OrderListInGetOrderDetail `json:"OrderList" xml:"OrderList"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_get_pay_as_you_go_price.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_get_pay_as_you_go_price.go new file mode 100644 index 00000000000..368b79024e0 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_get_pay_as_you_go_price.go @@ -0,0 +1,23 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DataInGetPayAsYouGoPrice is a nested struct in bssopenapi response +type DataInGetPayAsYouGoPrice struct { + Currency string `json:"Currency" xml:"Currency"` + ModuleDetails ModuleDetailsInGetPayAsYouGoPrice `json:"ModuleDetails" xml:"ModuleDetails"` + PromotionDetails PromotionDetailsInGetPayAsYouGoPrice `json:"PromotionDetails" xml:"PromotionDetails"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_get_resource_package_price.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_get_resource_package_price.go new file mode 100644 index 00000000000..d0c4d8ce1b7 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_get_resource_package_price.go @@ -0,0 +1,25 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DataInGetResourcePackagePrice is a nested struct in bssopenapi response +type DataInGetResourcePackagePrice struct { + Currency string `json:"Currency" xml:"Currency"` + OriginalPrice float64 `json:"OriginalPrice" xml:"OriginalPrice"` + TradePrice float64 `json:"TradePrice" xml:"TradePrice"` + DiscountPrice float64 `json:"DiscountPrice" xml:"DiscountPrice"` + Promotions Promotions `json:"Promotions" xml:"Promotions"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_get_subscription_price.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_get_subscription_price.go new file mode 100644 index 00000000000..7222f35ab37 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_get_subscription_price.go @@ -0,0 +1,27 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DataInGetSubscriptionPrice is a nested struct in bssopenapi response +type DataInGetSubscriptionPrice struct { + OriginalPrice float64 `json:"OriginalPrice" xml:"OriginalPrice"` + DiscountPrice float64 `json:"DiscountPrice" xml:"DiscountPrice"` + TradePrice float64 `json:"TradePrice" xml:"TradePrice"` + Currency string `json:"Currency" xml:"Currency"` + Quantity int `json:"Quantity" xml:"Quantity"` + ModuleDetails ModuleDetailsInGetSubscriptionPrice `json:"ModuleDetails" xml:"ModuleDetails"` + PromotionDetails PromotionDetailsInGetSubscriptionPrice `json:"PromotionDetails" xml:"PromotionDetails"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_account_bill.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_account_bill.go new file mode 100644 index 00000000000..3d17f8ced30 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_account_bill.go @@ -0,0 +1,27 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DataInQueryAccountBill is a nested struct in bssopenapi response +type DataInQueryAccountBill struct { + BillingCycle string `json:"BillingCycle" xml:"BillingCycle"` + AccountID string `json:"AccountID" xml:"AccountID"` + AccountName string `json:"AccountName" xml:"AccountName"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + PageNum int `json:"PageNum" xml:"PageNum"` + PageSize int `json:"PageSize" xml:"PageSize"` + Items ItemsInQueryAccountBill `json:"Items" xml:"Items"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_account_transaction_details.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_account_transaction_details.go new file mode 100644 index 00000000000..32aa1caf199 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_account_transaction_details.go @@ -0,0 +1,25 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DataInQueryAccountTransactionDetails is a nested struct in bssopenapi response +type DataInQueryAccountTransactionDetails struct { + AccountName string `json:"AccountName" xml:"AccountName"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + NextToken string `json:"NextToken" xml:"NextToken"` + MaxResults int `json:"MaxResults" xml:"MaxResults"` + AccountTransactionsList AccountTransactionsListInQueryAccountTransactionDetails `json:"AccountTransactionsList" xml:"AccountTransactionsList"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_account_transactions.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_account_transactions.go new file mode 100644 index 00000000000..94c4dc9f308 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_account_transactions.go @@ -0,0 +1,25 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DataInQueryAccountTransactions is a nested struct in bssopenapi response +type DataInQueryAccountTransactions struct { + AccountName string `json:"AccountName" xml:"AccountName"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + PageNum int `json:"PageNum" xml:"PageNum"` + PageSize int `json:"PageSize" xml:"PageSize"` + AccountTransactionsList AccountTransactionsListInQueryAccountTransactions `json:"AccountTransactionsList" xml:"AccountTransactionsList"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_available_instances.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_available_instances.go deleted file mode 100644 index 962655a6c9e..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_available_instances.go +++ /dev/null @@ -1,24 +0,0 @@ -package bssopenapi - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DataInQueryAvailableInstances is a nested struct in bssopenapi response -type DataInQueryAvailableInstances struct { - PageNum int `json:"PageNum" xml:"PageNum"` - PageSize int `json:"PageSize" xml:"PageSize"` - TotalCount int `json:"TotalCount" xml:"TotalCount"` - InstanceList []Instance `json:"InstanceList" xml:"InstanceList"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_bill.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_bill.go new file mode 100644 index 00000000000..8763a0081c8 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_bill.go @@ -0,0 +1,27 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DataInQueryBill is a nested struct in bssopenapi response +type DataInQueryBill struct { + BillingCycle string `json:"BillingCycle" xml:"BillingCycle"` + AccountID string `json:"AccountID" xml:"AccountID"` + AccountName string `json:"AccountName" xml:"AccountName"` + PageNum int `json:"PageNum" xml:"PageNum"` + PageSize int `json:"PageSize" xml:"PageSize"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + Items ItemsInQueryBill `json:"Items" xml:"Items"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_bill_overview.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_bill_overview.go new file mode 100644 index 00000000000..e6d3537488c --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_bill_overview.go @@ -0,0 +1,24 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DataInQueryBillOverview is a nested struct in bssopenapi response +type DataInQueryBillOverview struct { + BillingCycle string `json:"BillingCycle" xml:"BillingCycle"` + AccountID string `json:"AccountID" xml:"AccountID"` + AccountName string `json:"AccountName" xml:"AccountName"` + Items ItemsInQueryBillOverview `json:"Items" xml:"Items"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_bill_to_oss_subscription.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_bill_to_oss_subscription.go new file mode 100644 index 00000000000..1f5e4ed475a --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_bill_to_oss_subscription.go @@ -0,0 +1,23 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DataInQueryBillToOSSSubscription is a nested struct in bssopenapi response +type DataInQueryBillToOSSSubscription struct { + AccountID string `json:"AccountID" xml:"AccountID"` + AccountName string `json:"AccountName" xml:"AccountName"` + Items ItemsInQueryBillToOSSSubscription `json:"Items" xml:"Items"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_cost_unit.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_cost_unit.go deleted file mode 100644 index c9db70ba104..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_cost_unit.go +++ /dev/null @@ -1,24 +0,0 @@ -package bssopenapi - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DataInQueryCostUnit is a nested struct in bssopenapi response -type DataInQueryCostUnit struct { - TotalCount int `json:"TotalCount" xml:"TotalCount"` - PageSize int `json:"PageSize" xml:"PageSize"` - PageNum int `json:"PageNum" xml:"PageNum"` - CostUnitDtoList []CostUnitDtoListItem `json:"CostUnitDtoList" xml:"CostUnitDtoList"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_cost_unit_resource.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_cost_unit_resource.go deleted file mode 100644 index 4a6e2f54d02..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_cost_unit_resource.go +++ /dev/null @@ -1,26 +0,0 @@ -package bssopenapi - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DataInQueryCostUnitResource is a nested struct in bssopenapi response -type DataInQueryCostUnitResource struct { - TotalCount int `json:"TotalCount" xml:"TotalCount"` - PageSize int `json:"PageSize" xml:"PageSize"` - PageNum int `json:"PageNum" xml:"PageNum"` - CostUnit CostUnit `json:"CostUnit" xml:"CostUnit"` - CostUnitStatisInfo CostUnitStatisInfo `json:"CostUnitStatisInfo" xml:"CostUnitStatisInfo"` - ResourceInstanceDtoList []ResourceInstanceList `json:"ResourceInstanceDtoList" xml:"ResourceInstanceDtoList"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_customer_address_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_customer_address_list.go new file mode 100644 index 00000000000..eb8775f8fc2 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_customer_address_list.go @@ -0,0 +1,21 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DataInQueryCustomerAddressList is a nested struct in bssopenapi response +type DataInQueryCustomerAddressList struct { + CustomerInvoiceAddressList CustomerInvoiceAddressList `json:"CustomerInvoiceAddressList" xml:"CustomerInvoiceAddressList"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_dp_utilization_detail.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_dp_utilization_detail.go new file mode 100644 index 00000000000..66297b9fbe9 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_dp_utilization_detail.go @@ -0,0 +1,22 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DataInQueryDPUtilizationDetail is a nested struct in bssopenapi response +type DataInQueryDPUtilizationDetail struct { + NextToken string `json:"NextToken" xml:"NextToken"` + DetailList DetailListInQueryDPUtilizationDetail `json:"DetailList" xml:"DetailList"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_evaluate_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_evaluate_list.go new file mode 100644 index 00000000000..114ae38925f --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_evaluate_list.go @@ -0,0 +1,27 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DataInQueryEvaluateList is a nested struct in bssopenapi response +type DataInQueryEvaluateList struct { + HostId string `json:"HostId" xml:"HostId"` + PageNum int `json:"PageNum" xml:"PageNum"` + PageSize int `json:"PageSize" xml:"PageSize"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + TotalInvoiceAmount int64 `json:"TotalInvoiceAmount" xml:"TotalInvoiceAmount"` + TotalUnAppliedInvoiceAmount int64 `json:"TotalUnAppliedInvoiceAmount" xml:"TotalUnAppliedInvoiceAmount"` + EvaluateList EvaluateList `json:"EvaluateList" xml:"EvaluateList"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_instance_bill.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_instance_bill.go new file mode 100644 index 00000000000..476d30d93a6 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_instance_bill.go @@ -0,0 +1,27 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DataInQueryInstanceBill is a nested struct in bssopenapi response +type DataInQueryInstanceBill struct { + BillingCycle string `json:"BillingCycle" xml:"BillingCycle"` + AccountID string `json:"AccountID" xml:"AccountID"` + AccountName string `json:"AccountName" xml:"AccountName"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + PageNum int `json:"PageNum" xml:"PageNum"` + PageSize int `json:"PageSize" xml:"PageSize"` + Items ItemsInQueryInstanceBill `json:"Items" xml:"Items"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_instance_gaap_cost.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_instance_gaap_cost.go new file mode 100644 index 00000000000..fc3fe130d75 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_instance_gaap_cost.go @@ -0,0 +1,25 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DataInQueryInstanceGaapCost is a nested struct in bssopenapi response +type DataInQueryInstanceGaapCost struct { + HostId string `json:"HostId" xml:"HostId"` + PageNum int `json:"PageNum" xml:"PageNum"` + PageSize int `json:"PageSize" xml:"PageSize"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + Modules Modules `json:"Modules" xml:"Modules"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_invoicing_customer_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_invoicing_customer_list.go new file mode 100644 index 00000000000..51b999bd366 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_invoicing_customer_list.go @@ -0,0 +1,21 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DataInQueryInvoicingCustomerList is a nested struct in bssopenapi response +type DataInQueryInvoicingCustomerList struct { + CustomerInvoiceList CustomerInvoiceList `json:"CustomerInvoiceList" xml:"CustomerInvoiceList"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_monthly_bill.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_monthly_bill.go new file mode 100644 index 00000000000..ee763d965c3 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_monthly_bill.go @@ -0,0 +1,25 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DataInQueryMonthlyBill is a nested struct in bssopenapi response +type DataInQueryMonthlyBill struct { + OutstandingAmount float64 `json:"OutstandingAmount" xml:"OutstandingAmount"` + TotalOutstandingAmount float64 `json:"TotalOutstandingAmount" xml:"TotalOutstandingAmount"` + NewInvoiceAmount float64 `json:"NewInvoiceAmount" xml:"NewInvoiceAmount"` + BillingCycle string `json:"BillingCycle" xml:"BillingCycle"` + Items ItemsInQueryMonthlyBill `json:"Items" xml:"Items"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_monthly_instance_consumption.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_monthly_instance_consumption.go new file mode 100644 index 00000000000..09d3b3e90ab --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_monthly_instance_consumption.go @@ -0,0 +1,25 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DataInQueryMonthlyInstanceConsumption is a nested struct in bssopenapi response +type DataInQueryMonthlyInstanceConsumption struct { + PageNum int `json:"PageNum" xml:"PageNum"` + PageSize int `json:"PageSize" xml:"PageSize"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + BillingCycle string `json:"BillingCycle" xml:"BillingCycle"` + Items ItemsInQueryMonthlyInstanceConsumption `json:"Items" xml:"Items"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_orders.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_orders.go new file mode 100644 index 00000000000..2964998a62d --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_orders.go @@ -0,0 +1,25 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DataInQueryOrders is a nested struct in bssopenapi response +type DataInQueryOrders struct { + HostName string `json:"HostName" xml:"HostName"` + PageNum int `json:"PageNum" xml:"PageNum"` + PageSize int `json:"PageSize" xml:"PageSize"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + OrderList OrderListInQueryOrders `json:"OrderList" xml:"OrderList"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_permission_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_permission_list.go deleted file mode 100644 index a2b0723c41e..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_permission_list.go +++ /dev/null @@ -1,28 +0,0 @@ -package bssopenapi - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DataInQueryPermissionList is a nested struct in bssopenapi response -type DataInQueryPermissionList struct { - MasterId int64 `json:"MasterId" xml:"MasterId"` - MemberId int64 `json:"MemberId" xml:"MemberId"` - RelationType string `json:"RelationType" xml:"RelationType"` - State string `json:"State" xml:"State"` - SetupTime string `json:"SetupTime" xml:"SetupTime"` - StartTime string `json:"StartTime" xml:"StartTime"` - EndTime string `json:"EndTime" xml:"EndTime"` - PermissionList []PermissionListItem `json:"PermissionList" xml:"PermissionList"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_product_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_product_list.go new file mode 100644 index 00000000000..8148a64938c --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_product_list.go @@ -0,0 +1,24 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DataInQueryProductList is a nested struct in bssopenapi response +type DataInQueryProductList struct { + TotalCount int `json:"TotalCount" xml:"TotalCount"` + PageNum int `json:"PageNum" xml:"PageNum"` + PageSize int `json:"PageSize" xml:"PageSize"` + ProductList ProductList `json:"ProductList" xml:"ProductList"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_relation_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_relation_list.go deleted file mode 100644 index 2d1f76e40c5..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_relation_list.go +++ /dev/null @@ -1,24 +0,0 @@ -package bssopenapi - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DataInQueryRelationList is a nested struct in bssopenapi response -type DataInQueryRelationList struct { - PageNum int `json:"PageNum" xml:"PageNum"` - PageSize int `json:"PageSize" xml:"PageSize"` - TotalCount int `json:"TotalCount" xml:"TotalCount"` - FinancialRelationInfoList []FinancialRelationInfoListItem `json:"FinancialRelationInfoList" xml:"FinancialRelationInfoList"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_ri_utilization_detail.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_ri_utilization_detail.go index 80bd86cc470..405fb95165b 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_ri_utilization_detail.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_ri_utilization_detail.go @@ -17,8 +17,8 @@ package bssopenapi // DataInQueryRIUtilizationDetail is a nested struct in bssopenapi response type DataInQueryRIUtilizationDetail struct { - PageNum int64 `json:"PageNum" xml:"PageNum"` - PageSize int64 `json:"PageSize" xml:"PageSize"` - TotalCount int64 `json:"TotalCount" xml:"TotalCount"` - DetailList DetailList `json:"DetailList" xml:"DetailList"` + PageNum int64 `json:"PageNum" xml:"PageNum"` + PageSize int64 `json:"PageSize" xml:"PageSize"` + TotalCount int64 `json:"TotalCount" xml:"TotalCount"` + DetailList DetailListInQueryRIUtilizationDetail `json:"DetailList" xml:"DetailList"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_settle_bill.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_settle_bill.go new file mode 100644 index 00000000000..144624ff33d --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_settle_bill.go @@ -0,0 +1,27 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DataInQuerySettleBill is a nested struct in bssopenapi response +type DataInQuerySettleBill struct { + BillingCycle string `json:"BillingCycle" xml:"BillingCycle"` + AccountID string `json:"AccountID" xml:"AccountID"` + AccountName string `json:"AccountName" xml:"AccountName"` + NextToken string `json:"NextToken" xml:"NextToken"` + MaxResults int `json:"MaxResults" xml:"MaxResults"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + Items ItemsInQuerySettleBill `json:"Items" xml:"Items"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_settlement_bill.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_settlement_bill.go new file mode 100644 index 00000000000..6dfb5fde75c --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_settlement_bill.go @@ -0,0 +1,25 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DataInQuerySettlementBill is a nested struct in bssopenapi response +type DataInQuerySettlementBill struct { + PageNum int `json:"PageNum" xml:"PageNum"` + PageSize int `json:"PageSize" xml:"PageSize"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + BillingCycle string `json:"BillingCycle" xml:"BillingCycle"` + Items ItemsInQuerySettlementBill `json:"Items" xml:"Items"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_split_item_bill.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_split_item_bill.go new file mode 100644 index 00000000000..947bd5f9404 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_split_item_bill.go @@ -0,0 +1,27 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DataInQuerySplitItemBill is a nested struct in bssopenapi response +type DataInQuerySplitItemBill struct { + BillingCycle string `json:"BillingCycle" xml:"BillingCycle"` + AccountID string `json:"AccountID" xml:"AccountID"` + AccountName string `json:"AccountName" xml:"AccountName"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + PageNum int `json:"PageNum" xml:"PageNum"` + PageSize int `json:"PageSize" xml:"PageSize"` + Items ItemsInQuerySplitItemBill `json:"Items" xml:"Items"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_user_oms_data.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_user_oms_data.go deleted file mode 100644 index 5e01a56c612..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_data_in_query_user_oms_data.go +++ /dev/null @@ -1,23 +0,0 @@ -package bssopenapi - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DataInQueryUserOmsData is a nested struct in bssopenapi response -type DataInQueryUserOmsData struct { - Marker string `json:"Marker" xml:"Marker"` - HostId string `json:"HostId" xml:"HostId"` - OmsData []map[string]interface{} `json:"OmsData" xml:"OmsData"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_detail_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_detail_list.go deleted file mode 100644 index 5c197c887ab..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_detail_list.go +++ /dev/null @@ -1,21 +0,0 @@ -package bssopenapi - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DetailList is a nested struct in bssopenapi response -type DetailList struct { - DetailListItem []DetailListItem `json:"DetailList" xml:"DetailList"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_detail_list_in_query_dp_utilization_detail.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_detail_list_in_query_dp_utilization_detail.go new file mode 100644 index 00000000000..b2c7e60d3aa --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_detail_list_in_query_dp_utilization_detail.go @@ -0,0 +1,21 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DetailListInQueryDPUtilizationDetail is a nested struct in bssopenapi response +type DetailListInQueryDPUtilizationDetail struct { + DetailListItem []DetailListItem `json:"DetailList" xml:"DetailList"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_detail_list_in_query_ri_utilization_detail.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_detail_list_in_query_ri_utilization_detail.go new file mode 100644 index 00000000000..2be7b9f833b --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_detail_list_in_query_ri_utilization_detail.go @@ -0,0 +1,21 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DetailListInQueryRIUtilizationDetail is a nested struct in bssopenapi response +type DetailListInQueryRIUtilizationDetail struct { + DetailListItem []DetailListItemInQueryRIUtilizationDetail `json:"DetailList" xml:"DetailList"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_detail_list_item.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_detail_list_item.go index 1fe2e700341..f0c91e21f61 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_detail_list_item.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_detail_list_item.go @@ -17,13 +17,18 @@ package bssopenapi // DetailListItem is a nested struct in bssopenapi response type DetailListItem struct { - RIInstanceId string `json:"RIInstanceId" xml:"RIInstanceId"` + DeductQuantity float64 `json:"DeductQuantity" xml:"DeductQuantity"` + Region string `json:"Region" xml:"Region"` + Uid int64 `json:"Uid" xml:"Uid"` + DeductMeasure float64 `json:"DeductMeasure" xml:"DeductMeasure"` + ShareUid int64 `json:"ShareUid" xml:"ShareUid"` + DeductedProductDetail string `json:"DeductedProductDetail" xml:"DeductedProductDetail"` InstanceSpec string `json:"InstanceSpec" xml:"InstanceSpec"` - DeductedInstanceId string `json:"DeductedInstanceId" xml:"DeductedInstanceId"` + DeductFactorTotal float64 `json:"DeductFactorTotal" xml:"DeductFactorTotal"` + InstanceId string `json:"InstanceId" xml:"InstanceId"` + ResCode string `json:"ResCode" xml:"ResCode"` DeductedCommodityCode string `json:"DeductedCommodityCode" xml:"DeductedCommodityCode"` DeductDate string `json:"DeductDate" xml:"DeductDate"` - DeductHours string `json:"DeductHours" xml:"DeductHours"` - DeductedProductDetail string `json:"DeductedProductDetail" xml:"DeductedProductDetail"` - DeductQuantity float64 `json:"DeductQuantity" xml:"DeductQuantity"` - DeductFactorTotal float64 `json:"DeductFactorTotal" xml:"DeductFactorTotal"` + DeductHours float64 `json:"DeductHours" xml:"DeductHours"` + DeductedInstanceId string `json:"DeductedInstanceId" xml:"DeductedInstanceId"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_detail_list_item_in_query_ri_utilization_detail.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_detail_list_item_in_query_ri_utilization_detail.go new file mode 100644 index 00000000000..c0486dda4a6 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_detail_list_item_in_query_ri_utilization_detail.go @@ -0,0 +1,29 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DetailListItemInQueryRIUtilizationDetail is a nested struct in bssopenapi response +type DetailListItemInQueryRIUtilizationDetail struct { + RIInstanceId string `json:"RIInstanceId" xml:"RIInstanceId"` + InstanceSpec string `json:"InstanceSpec" xml:"InstanceSpec"` + DeductedInstanceId string `json:"DeductedInstanceId" xml:"DeductedInstanceId"` + DeductedCommodityCode string `json:"DeductedCommodityCode" xml:"DeductedCommodityCode"` + DeductDate string `json:"DeductDate" xml:"DeductDate"` + DeductHours string `json:"DeductHours" xml:"DeductHours"` + DeductedProductDetail string `json:"DeductedProductDetail" xml:"DeductedProductDetail"` + DeductQuantity float64 `json:"DeductQuantity" xml:"DeductQuantity"` + DeductFactorTotal float64 `json:"DeductFactorTotal" xml:"DeductFactorTotal"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_item.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_item.go index 133cebd5e1d..775d41e4203 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_item.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_item.go @@ -17,91 +17,100 @@ package bssopenapi // Item is a nested struct in bssopenapi response type Item struct { - Tax float64 `json:"Tax" xml:"Tax"` - PreviousBillingCycleBalance float64 `json:"PreviousBillingCycleBalance" xml:"PreviousBillingCycleBalance"` - PayerAccount string `json:"PayerAccount" xml:"PayerAccount"` - CommodityCode string `json:"CommodityCode" xml:"CommodityCode"` - UsageStartTime string `json:"UsageStartTime" xml:"UsageStartTime"` - SuborderID string `json:"SuborderID" xml:"SuborderID"` - SolutionCode string `json:"SolutionCode" xml:"SolutionCode"` - ProductDetail string `json:"ProductDetail" xml:"ProductDetail"` - Promotion string `json:"Promotion" xml:"Promotion"` - Usage string `json:"Usage" xml:"Usage"` - Seller string `json:"Seller" xml:"Seller"` - ServicePeriodUnit string `json:"ServicePeriodUnit" xml:"ServicePeriodUnit"` - PretaxAmountLocal float64 `json:"PretaxAmountLocal" xml:"PretaxAmountLocal"` - OwnerName string `json:"OwnerName" xml:"OwnerName"` - OutstandingAmount float64 `json:"OutstandingAmount" xml:"OutstandingAmount"` - DeductedByResourcePackage string `json:"DeductedByResourcePackage" xml:"DeductedByResourcePackage"` - PipCode string `json:"PipCode" xml:"PipCode"` - SplitProductDetail string `json:"SplitProductDetail" xml:"SplitProductDetail"` - SplitAccountID string `json:"SplitAccountID" xml:"SplitAccountID"` - ProductCode string `json:"ProductCode" xml:"ProductCode"` - ListPrice string `json:"ListPrice" xml:"ListPrice"` - Quantity string `json:"Quantity" xml:"Quantity"` - InvoiceDiscount float64 `json:"InvoiceDiscount" xml:"InvoiceDiscount"` - BucketOwnerId int64 `json:"BucketOwnerId" xml:"BucketOwnerId"` - MybankPaymentAmount float64 `json:"MybankPaymentAmount" xml:"MybankPaymentAmount"` - InstanceID string `json:"InstanceID" xml:"InstanceID"` - PretaxGrossAmount float64 `json:"PretaxGrossAmount" xml:"PretaxGrossAmount"` - SplitItemName string `json:"SplitItemName" xml:"SplitItemName"` - SubscribeBucket string `json:"SubscribeBucket" xml:"SubscribeBucket"` - RecordID string `json:"RecordID" xml:"RecordID"` - Config string `json:"Config" xml:"Config"` - Status string `json:"Status" xml:"Status"` - Item string `json:"Item" xml:"Item"` - ProductName string `json:"ProductName" xml:"ProductName"` - Region string `json:"Region" xml:"Region"` - PaymentAmount float64 `json:"PaymentAmount" xml:"PaymentAmount"` - UsageEndTime string `json:"UsageEndTime" xml:"UsageEndTime"` - RoundDownDiscount string `json:"RoundDownDiscount" xml:"RoundDownDiscount"` - SolutionID string `json:"SolutionID" xml:"SolutionID"` - ClearedTime string `json:"ClearedTime" xml:"ClearedTime"` - InternetIP string `json:"InternetIP" xml:"InternetIP"` - PaymentTime string `json:"PaymentTime" xml:"PaymentTime"` - CreateTime string `json:"CreateTime" xml:"CreateTime"` - LinkedCustomerOrderID string `json:"LinkedCustomerOrderID" xml:"LinkedCustomerOrderID"` - CostUnit string `json:"CostUnit" xml:"CostUnit"` - SplitBillingCycle string `json:"SplitBillingCycle" xml:"SplitBillingCycle"` - AfterTaxAmount float64 `json:"AfterTaxAmount" xml:"AfterTaxAmount"` - ResourceGroup string `json:"ResourceGroup" xml:"ResourceGroup"` - SplitAccountName string `json:"SplitAccountName" xml:"SplitAccountName"` - SubOrderId string `json:"SubOrderId" xml:"SubOrderId"` - BillingType string `json:"BillingType" xml:"BillingType"` - InstanceSpec string `json:"InstanceSpec" xml:"InstanceSpec"` - SubscribeTime string `json:"SubscribeTime" xml:"SubscribeTime"` - Tag string `json:"Tag" xml:"Tag"` - OwnerID string `json:"OwnerID" xml:"OwnerID"` - SolutionName string `json:"SolutionName" xml:"SolutionName"` - NickName string `json:"NickName" xml:"NickName"` - SubscriptionType string `json:"SubscriptionType" xml:"SubscriptionType"` - InstanceConfig string `json:"InstanceConfig" xml:"InstanceConfig"` - DeductedByCashCoupons float64 `json:"DeductedByCashCoupons" xml:"DeductedByCashCoupons"` - ServicePeriod string `json:"ServicePeriod" xml:"ServicePeriod"` - InvoiceNo string `json:"InvoiceNo" xml:"InvoiceNo"` - MultAccountRelSubscribe string `json:"MultAccountRelSubscribe" xml:"MultAccountRelSubscribe"` - DiscountAmount float64 `json:"DiscountAmount" xml:"DiscountAmount"` - BillID string `json:"BillID" xml:"BillID"` - ListPriceUnit string `json:"ListPriceUnit" xml:"ListPriceUnit"` - SplitCommodityCode string `json:"SplitCommodityCode" xml:"SplitCommodityCode"` - UsageUnit string `json:"UsageUnit" xml:"UsageUnit"` - SplitItemID string `json:"SplitItemID" xml:"SplitItemID"` - PaymentCurrency string `json:"PaymentCurrency" xml:"PaymentCurrency"` - SubscribeType string `json:"SubscribeType" xml:"SubscribeType"` - SubscribeLanguage string `json:"SubscribeLanguage" xml:"SubscribeLanguage"` - ProductType string `json:"ProductType" xml:"ProductType"` - AccountDiscount float64 `json:"AccountDiscount" xml:"AccountDiscount"` - Currency string `json:"Currency" xml:"Currency"` - DeductedByPrepaidCard float64 `json:"DeductedByPrepaidCard" xml:"DeductedByPrepaidCard"` - OriginalOrderID string `json:"OriginalOrderID" xml:"OriginalOrderID"` - PaymentTransactionID string `json:"PaymentTransactionID" xml:"PaymentTransactionID"` - OrderID string `json:"OrderID" xml:"OrderID"` - OrderType string `json:"OrderType" xml:"OrderType"` - BillingDate string `json:"BillingDate" xml:"BillingDate"` - BillingItem string `json:"BillingItem" xml:"BillingItem"` - DeductedByCoupons float64 `json:"DeductedByCoupons" xml:"DeductedByCoupons"` - Zone string `json:"Zone" xml:"Zone"` - ChargeDiscount float64 `json:"ChargeDiscount" xml:"ChargeDiscount"` - PretaxAmount float64 `json:"PretaxAmount" xml:"PretaxAmount"` - IntranetIP string `json:"IntranetIP" xml:"IntranetIP"` + DeductQuantity float64 `json:"DeductQuantity" xml:"DeductQuantity"` + Tax float64 `json:"Tax" xml:"Tax"` + PayerAccount string `json:"PayerAccount" xml:"PayerAccount"` + CoveragePercentage float64 `json:"CoveragePercentage" xml:"CoveragePercentage"` + TotalQuantity float64 `json:"TotalQuantity" xml:"TotalQuantity"` + BizType string `json:"BizType" xml:"BizType"` + ResourceInstanceId string `json:"ResourceInstanceId" xml:"ResourceInstanceId"` + CommodityCode string `json:"CommodityCode" xml:"CommodityCode"` + UsageStartTime string `json:"UsageStartTime" xml:"UsageStartTime"` + SolutionCode string `json:"SolutionCode" xml:"SolutionCode"` + ProductDetail string `json:"ProductDetail" xml:"ProductDetail"` + Usage string `json:"Usage" xml:"Usage"` + ServicePeriodUnit string `json:"ServicePeriodUnit" xml:"ServicePeriodUnit"` + PretaxAmountLocal float64 `json:"PretaxAmountLocal" xml:"PretaxAmountLocal"` + OwnerName string `json:"OwnerName" xml:"OwnerName"` + OutstandingAmount float64 `json:"OutstandingAmount" xml:"OutstandingAmount"` + DeductedByResourcePackage string `json:"DeductedByResourcePackage" xml:"DeductedByResourcePackage"` + PipCode string `json:"PipCode" xml:"PipCode"` + SplitProductDetail string `json:"SplitProductDetail" xml:"SplitProductDetail"` + SplitAccountID string `json:"SplitAccountID" xml:"SplitAccountID"` + ProductCode string `json:"ProductCode" xml:"ProductCode"` + ListPrice string `json:"ListPrice" xml:"ListPrice"` + BillAccountID string `json:"BillAccountID" xml:"BillAccountID"` + Period string `json:"Period" xml:"Period"` + InvoiceDiscount float64 `json:"InvoiceDiscount" xml:"InvoiceDiscount"` + StartTime string `json:"StartTime" xml:"StartTime"` + EndTime string `json:"EndTime" xml:"EndTime"` + BucketOwnerId int64 `json:"BucketOwnerId" xml:"BucketOwnerId"` + InstanceID string `json:"InstanceID" xml:"InstanceID"` + PretaxGrossAmount float64 `json:"PretaxGrossAmount" xml:"PretaxGrossAmount"` + SplitItemName string `json:"SplitItemName" xml:"SplitItemName"` + ImageType string `json:"ImageType" xml:"ImageType"` + SubscribeBucket string `json:"SubscribeBucket" xml:"SubscribeBucket"` + RecordID string `json:"RecordID" xml:"RecordID"` + Status string `json:"Status" xml:"Status"` + Item string `json:"Item" xml:"Item"` + ProductName string `json:"ProductName" xml:"ProductName"` + Region string `json:"Region" xml:"Region"` + PaymentAmount float64 `json:"PaymentAmount" xml:"PaymentAmount"` + PostpaidCost string `json:"PostpaidCost" xml:"PostpaidCost"` + ReservationCost string `json:"ReservationCost" xml:"ReservationCost"` + UsageEndTime string `json:"UsageEndTime" xml:"UsageEndTime"` + RoundDownDiscount string `json:"RoundDownDiscount" xml:"RoundDownDiscount"` + InternetIP string `json:"InternetIP" xml:"InternetIP"` + CommodityName string `json:"CommodityName" xml:"CommodityName"` + PaymentTime string `json:"PaymentTime" xml:"PaymentTime"` + CostUnit string `json:"CostUnit" xml:"CostUnit"` + SplitBillingCycle string `json:"SplitBillingCycle" xml:"SplitBillingCycle"` + AfterTaxAmount float64 `json:"AfterTaxAmount" xml:"AfterTaxAmount"` + ResourceGroup string `json:"ResourceGroup" xml:"ResourceGroup"` + SplitAccountName string `json:"SplitAccountName" xml:"SplitAccountName"` + SubOrderId string `json:"SubOrderId" xml:"SubOrderId"` + CapacityUnit string `json:"CapacityUnit" xml:"CapacityUnit"` + UsagePercentage float64 `json:"UsagePercentage" xml:"UsagePercentage"` + BillingType string `json:"BillingType" xml:"BillingType"` + InstanceSpec string `json:"InstanceSpec" xml:"InstanceSpec"` + SubscribeTime string `json:"SubscribeTime" xml:"SubscribeTime"` + Tag string `json:"Tag" xml:"Tag"` + RegionNo string `json:"RegionNo" xml:"RegionNo"` + OwnerID string `json:"OwnerID" xml:"OwnerID"` + UserId string `json:"UserId" xml:"UserId"` + InstanceId string `json:"InstanceId" xml:"InstanceId"` + SolutionName string `json:"SolutionName" xml:"SolutionName"` + NickName string `json:"NickName" xml:"NickName"` + SubscriptionType string `json:"SubscriptionType" xml:"SubscriptionType"` + InstanceConfig string `json:"InstanceConfig" xml:"InstanceConfig"` + ZoneName string `json:"ZoneName" xml:"ZoneName"` + PotentialSavedCost string `json:"PotentialSavedCost" xml:"PotentialSavedCost"` + DeductedByCashCoupons float64 `json:"DeductedByCashCoupons" xml:"DeductedByCashCoupons"` + ServicePeriod string `json:"ServicePeriod" xml:"ServicePeriod"` + MultAccountRelSubscribe string `json:"MultAccountRelSubscribe" xml:"MultAccountRelSubscribe"` + DiscountAmount float64 `json:"DiscountAmount" xml:"DiscountAmount"` + Percentage float64 `json:"Percentage" xml:"Percentage"` + ListPriceUnit string `json:"ListPriceUnit" xml:"ListPriceUnit"` + SplitCommodityCode string `json:"SplitCommodityCode" xml:"SplitCommodityCode"` + UsageUnit string `json:"UsageUnit" xml:"UsageUnit"` + SplitItemID string `json:"SplitItemID" xml:"SplitItemID"` + PaymentCurrency string `json:"PaymentCurrency" xml:"PaymentCurrency"` + SubscribeType string `json:"SubscribeType" xml:"SubscribeType"` + SubscribeLanguage string `json:"SubscribeLanguage" xml:"SubscribeLanguage"` + ProductType string `json:"ProductType" xml:"ProductType"` + SplitBillingDate string `json:"SplitBillingDate" xml:"SplitBillingDate"` + Currency string `json:"Currency" xml:"Currency"` + DeductedByPrepaidCard float64 `json:"DeductedByPrepaidCard" xml:"DeductedByPrepaidCard"` + BillAccountName string `json:"BillAccountName" xml:"BillAccountName"` + PaymentTransactionID string `json:"PaymentTransactionID" xml:"PaymentTransactionID"` + BillingDate string `json:"BillingDate" xml:"BillingDate"` + StatusName string `json:"StatusName" xml:"StatusName"` + BillingItem string `json:"BillingItem" xml:"BillingItem"` + DeductedByCoupons float64 `json:"DeductedByCoupons" xml:"DeductedByCoupons"` + Zone string `json:"Zone" xml:"Zone"` + Quantity int64 `json:"Quantity" xml:"Quantity"` + SavedCost string `json:"SavedCost" xml:"SavedCost"` + UserName string `json:"UserName" xml:"UserName"` + PretaxAmount float64 `json:"PretaxAmount" xml:"PretaxAmount"` + IntranetIP string `json:"IntranetIP" xml:"IntranetIP"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_item_in_describe_savings_plans_coverage_detail.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_item_in_describe_savings_plans_coverage_detail.go new file mode 100644 index 00000000000..6693a7855cf --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_item_in_describe_savings_plans_coverage_detail.go @@ -0,0 +1,32 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ItemInDescribeSavingsPlansCoverageDetail is a nested struct in bssopenapi response +type ItemInDescribeSavingsPlansCoverageDetail struct { + UserId int64 `json:"UserId" xml:"UserId"` + UserName string `json:"UserName" xml:"UserName"` + InstanceId string `json:"InstanceId" xml:"InstanceId"` + Region string `json:"Region" xml:"Region"` + InstanceSpec string `json:"InstanceSpec" xml:"InstanceSpec"` + Currency string `json:"Currency" xml:"Currency"` + CoveragePercentage float64 `json:"CoveragePercentage" xml:"CoveragePercentage"` + DeductAmount float64 `json:"DeductAmount" xml:"DeductAmount"` + TotalAmount float64 `json:"TotalAmount" xml:"TotalAmount"` + PostpaidCost float64 `json:"PostpaidCost" xml:"PostpaidCost"` + StartPeriod string `json:"StartPeriod" xml:"StartPeriod"` + EndPeriod string `json:"EndPeriod" xml:"EndPeriod"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_item_in_describe_savings_plans_usage_detail.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_item_in_describe_savings_plans_usage_detail.go new file mode 100644 index 00000000000..60c70b3591f --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_item_in_describe_savings_plans_usage_detail.go @@ -0,0 +1,33 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ItemInDescribeSavingsPlansUsageDetail is a nested struct in bssopenapi response +type ItemInDescribeSavingsPlansUsageDetail struct { + UserId int64 `json:"UserId" xml:"UserId"` + UserName string `json:"UserName" xml:"UserName"` + InstanceId string `json:"InstanceId" xml:"InstanceId"` + StartPeriod string `json:"StartPeriod" xml:"StartPeriod"` + EndPeriod string `json:"EndPeriod" xml:"EndPeriod"` + Status string `json:"Status" xml:"Status"` + Type string `json:"Type" xml:"Type"` + UsagePercentage float64 `json:"UsagePercentage" xml:"UsagePercentage"` + PoolValue float64 `json:"PoolValue" xml:"PoolValue"` + DeductValue float64 `json:"DeductValue" xml:"DeductValue"` + PostpaidCost float64 `json:"PostpaidCost" xml:"PostpaidCost"` + SavedCost float64 `json:"SavedCost" xml:"SavedCost"` + Currency string `json:"Currency" xml:"Currency"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_item_in_query_settlement_bill.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_item_in_query_settlement_bill.go new file mode 100644 index 00000000000..fce7fdcb730 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_item_in_query_settlement_bill.go @@ -0,0 +1,63 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ItemInQuerySettlementBill is a nested struct in bssopenapi response +type ItemInQuerySettlementBill struct { + RecordID string `json:"RecordID" xml:"RecordID"` + Item string `json:"Item" xml:"Item"` + PayerAccount string `json:"PayerAccount" xml:"PayerAccount"` + OwnerID string `json:"OwnerID" xml:"OwnerID"` + CreateTime string `json:"CreateTime" xml:"CreateTime"` + UsageStartTime string `json:"UsageStartTime" xml:"UsageStartTime"` + UsageEndTime string `json:"UsageEndTime" xml:"UsageEndTime"` + SuborderID string `json:"SuborderID" xml:"SuborderID"` + OrderID string `json:"OrderID" xml:"OrderID"` + OrderType string `json:"OrderType" xml:"OrderType"` + LinkedCustomerOrderID string `json:"LinkedCustomerOrderID" xml:"LinkedCustomerOrderID"` + OriginalOrderID string `json:"OriginalOrderID" xml:"OriginalOrderID"` + PaymentTime string `json:"PaymentTime" xml:"PaymentTime"` + SolutionID string `json:"SolutionID" xml:"SolutionID"` + SolutionName string `json:"SolutionName" xml:"SolutionName"` + BillID string `json:"BillID" xml:"BillID"` + ProductCode string `json:"ProductCode" xml:"ProductCode"` + ProductType string `json:"ProductType" xml:"ProductType"` + SubscriptionType string `json:"SubscriptionType" xml:"SubscriptionType"` + Region string `json:"Region" xml:"Region"` + Config string `json:"Config" xml:"Config"` + Quantity string `json:"Quantity" xml:"Quantity"` + PretaxGrossAmount float64 `json:"PretaxGrossAmount" xml:"PretaxGrossAmount"` + ChargeDiscount float64 `json:"ChargeDiscount" xml:"ChargeDiscount"` + DeductedByCoupons float64 `json:"DeductedByCoupons" xml:"DeductedByCoupons"` + AccountDiscount float64 `json:"AccountDiscount" xml:"AccountDiscount"` + Promotion string `json:"Promotion" xml:"Promotion"` + PretaxAmount float64 `json:"PretaxAmount" xml:"PretaxAmount"` + Currency string `json:"Currency" xml:"Currency"` + PretaxAmountLocal float64 `json:"PretaxAmountLocal" xml:"PretaxAmountLocal"` + PreviousBillingCycleBalance float64 `json:"PreviousBillingCycleBalance" xml:"PreviousBillingCycleBalance"` + Tax float64 `json:"Tax" xml:"Tax"` + AfterTaxAmount float64 `json:"AfterTaxAmount" xml:"AfterTaxAmount"` + Status string `json:"Status" xml:"Status"` + ClearedTime string `json:"ClearedTime" xml:"ClearedTime"` + OutstandingAmount float64 `json:"OutstandingAmount" xml:"OutstandingAmount"` + DeductedByCashCoupons float64 `json:"DeductedByCashCoupons" xml:"DeductedByCashCoupons"` + DeductedByPrepaidCard float64 `json:"DeductedByPrepaidCard" xml:"DeductedByPrepaidCard"` + MybankPaymentAmount float64 `json:"MybankPaymentAmount" xml:"MybankPaymentAmount"` + PaymentAmount float64 `json:"PaymentAmount" xml:"PaymentAmount"` + PaymentCurrency string `json:"PaymentCurrency" xml:"PaymentCurrency"` + Seller string `json:"Seller" xml:"Seller"` + InvoiceNo string `json:"InvoiceNo" xml:"InvoiceNo"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_items_in_describe_resource_coverage_detail.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_items_in_describe_resource_coverage_detail.go new file mode 100644 index 00000000000..241c54bfe64 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_items_in_describe_resource_coverage_detail.go @@ -0,0 +1,21 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ItemsInDescribeResourceCoverageDetail is a nested struct in bssopenapi response +type ItemsInDescribeResourceCoverageDetail struct { + Item []Item `json:"Item" xml:"Item"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_items_in_describe_resource_usage_detail.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_items_in_describe_resource_usage_detail.go new file mode 100644 index 00000000000..11ce7219cfb --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_items_in_describe_resource_usage_detail.go @@ -0,0 +1,21 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ItemsInDescribeResourceUsageDetail is a nested struct in bssopenapi response +type ItemsInDescribeResourceUsageDetail struct { + Item []Item `json:"Item" xml:"Item"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_items_in_describe_savings_plans_coverage_detail.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_items_in_describe_savings_plans_coverage_detail.go new file mode 100644 index 00000000000..ec8f99adaca --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_items_in_describe_savings_plans_coverage_detail.go @@ -0,0 +1,21 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ItemsInDescribeSavingsPlansCoverageDetail is a nested struct in bssopenapi response +type ItemsInDescribeSavingsPlansCoverageDetail struct { + Item []ItemInDescribeSavingsPlansCoverageDetail `json:"Item" xml:"Item"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_items_in_describe_savings_plans_usage_detail.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_items_in_describe_savings_plans_usage_detail.go new file mode 100644 index 00000000000..a1f80944567 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_items_in_describe_savings_plans_usage_detail.go @@ -0,0 +1,21 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ItemsInDescribeSavingsPlansUsageDetail is a nested struct in bssopenapi response +type ItemsInDescribeSavingsPlansUsageDetail struct { + Item []ItemInDescribeSavingsPlansUsageDetail `json:"Item" xml:"Item"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_items_in_query_settlement_bill.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_items_in_query_settlement_bill.go index da09b7cce45..b5846b94eab 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_items_in_query_settlement_bill.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_items_in_query_settlement_bill.go @@ -17,5 +17,5 @@ package bssopenapi // ItemsInQuerySettlementBill is a nested struct in bssopenapi response type ItemsInQuerySettlementBill struct { - Item []Item `json:"Item" xml:"Item"` + Item []ItemInQuerySettlementBill `json:"Item" xml:"Item"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_period_coverage_in_describe_resource_coverage_total.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_period_coverage_in_describe_resource_coverage_total.go new file mode 100644 index 00000000000..871b4194ce7 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_period_coverage_in_describe_resource_coverage_total.go @@ -0,0 +1,21 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// PeriodCoverageInDescribeResourceCoverageTotal is a nested struct in bssopenapi response +type PeriodCoverageInDescribeResourceCoverageTotal struct { + Item []Item `json:"Item" xml:"Item"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_period_coverage_in_describe_resource_usage_total.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_period_coverage_in_describe_resource_usage_total.go new file mode 100644 index 00000000000..69fdcd158df --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_period_coverage_in_describe_resource_usage_total.go @@ -0,0 +1,21 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// PeriodCoverageInDescribeResourceUsageTotal is a nested struct in bssopenapi response +type PeriodCoverageInDescribeResourceUsageTotal struct { + Item []Item `json:"Item" xml:"Item"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_period_coverage_in_describe_savings_plans_coverage_total.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_period_coverage_in_describe_savings_plans_coverage_total.go new file mode 100644 index 00000000000..7be0a4b96b0 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_period_coverage_in_describe_savings_plans_coverage_total.go @@ -0,0 +1,21 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// PeriodCoverageInDescribeSavingsPlansCoverageTotal is a nested struct in bssopenapi response +type PeriodCoverageInDescribeSavingsPlansCoverageTotal struct { + Item []Item `json:"Item" xml:"Item"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_period_coverage_in_describe_savings_plans_usage_total.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_period_coverage_in_describe_savings_plans_usage_total.go new file mode 100644 index 00000000000..b170228c683 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_period_coverage_in_describe_savings_plans_usage_total.go @@ -0,0 +1,21 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// PeriodCoverageInDescribeSavingsPlansUsageTotal is a nested struct in bssopenapi response +type PeriodCoverageInDescribeSavingsPlansUsageTotal struct { + Item []Item `json:"Item" xml:"Item"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_savings_plans_detail_response.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_savings_plans_detail_response.go index e7c2b215294..792c2935156 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_savings_plans_detail_response.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_savings_plans_detail_response.go @@ -17,18 +17,19 @@ package bssopenapi // SavingsPlansDetailResponse is a nested struct in bssopenapi response type SavingsPlansDetailResponse struct { - InstanceId string `json:"InstanceId" xml:"InstanceId"` - SavingsType string `json:"SavingsType" xml:"SavingsType"` - InstanceFamily string `json:"InstanceFamily" xml:"InstanceFamily"` - Region string `json:"Region" xml:"Region"` - PoolValue string `json:"PoolValue" xml:"PoolValue"` - Currency string `json:"Currency" xml:"Currency"` - Status string `json:"Status" xml:"Status"` - StartTime string `json:"StartTime" xml:"StartTime"` - EndTime string `json:"EndTime" xml:"EndTime"` - PayMode string `json:"PayMode" xml:"PayMode"` - PrepayFee string `json:"PrepayFee" xml:"PrepayFee"` - TotalSave string `json:"TotalSave" xml:"TotalSave"` - Utilization string `json:"Utilization" xml:"Utilization"` - Share bool `json:"Share" xml:"Share"` + InstanceId string `json:"InstanceId" xml:"InstanceId"` + SavingsType string `json:"SavingsType" xml:"SavingsType"` + InstanceFamily string `json:"InstanceFamily" xml:"InstanceFamily"` + Region string `json:"Region" xml:"Region"` + PoolValue string `json:"PoolValue" xml:"PoolValue"` + Currency string `json:"Currency" xml:"Currency"` + Status string `json:"Status" xml:"Status"` + StartTime string `json:"StartTime" xml:"StartTime"` + EndTime string `json:"EndTime" xml:"EndTime"` + PayMode string `json:"PayMode" xml:"PayMode"` + PrepayFee string `json:"PrepayFee" xml:"PrepayFee"` + TotalSave string `json:"TotalSave" xml:"TotalSave"` + Utilization string `json:"Utilization" xml:"Utilization"` + AllocationStatus string `json:"AllocationStatus" xml:"AllocationStatus"` + Tags []Tag `json:"Tags" xml:"Tags"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_tag.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_tag.go index e7be11bf146..222b985a146 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_tag.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_tag.go @@ -17,5 +17,6 @@ package bssopenapi // Tag is a nested struct in bssopenapi response type Tag struct { - TagKeyValue []TagKeyValue `json:"TagKeyValue" xml:"TagKeyValue"` + Key string `json:"Key" xml:"Key"` + Value string `json:"Value" xml:"Value"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_tag_in_query_instance_by_tag.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_tag_in_query_instance_by_tag.go new file mode 100644 index 00000000000..fdc710a49e3 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_tag_in_query_instance_by_tag.go @@ -0,0 +1,21 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// TagInQueryInstanceByTag is a nested struct in bssopenapi response +type TagInQueryInstanceByTag struct { + TagKeyValue []TagKeyValue `json:"TagKeyValue" xml:"TagKeyValue"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_tags.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_tags.go new file mode 100644 index 00000000000..d0b932023ac --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_tags.go @@ -0,0 +1,21 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Tags is a nested struct in bssopenapi response +type Tags struct { + Tag []Tag `json:"Tag" xml:"Tag"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_total_coverage.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_total_coverage.go new file mode 100644 index 00000000000..95ac5a43bd9 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_total_coverage.go @@ -0,0 +1,25 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// TotalCoverage is a nested struct in bssopenapi response +type TotalCoverage struct { + DeductQuantity float64 `json:"DeductQuantity" xml:"DeductQuantity"` + TotalQuantity float64 `json:"TotalQuantity" xml:"TotalQuantity"` + DeductAmount float64 `json:"DeductAmount" xml:"DeductAmount"` + CoveragePercentage float64 `json:"CoveragePercentage" xml:"CoveragePercentage"` + CapacityUnit string `json:"CapacityUnit" xml:"CapacityUnit"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_total_usage.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_total_usage.go new file mode 100644 index 00000000000..295e07ac72e --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/struct_total_usage.go @@ -0,0 +1,26 @@ +package bssopenapi + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// TotalUsage is a nested struct in bssopenapi response +type TotalUsage struct { + PoolValue float64 `json:"PoolValue" xml:"PoolValue"` + UsagePercentage float64 `json:"UsagePercentage" xml:"UsagePercentage"` + ReservationCost float64 `json:"ReservationCost" xml:"ReservationCost"` + SavedCost float64 `json:"SavedCost" xml:"SavedCost"` + PotentialSavedCost float64 `json:"PotentialSavedCost" xml:"PotentialSavedCost"` + PostpaidCost float64 `json:"PostpaidCost" xml:"PostpaidCost"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/subscribe_bill_to_oss.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/subscribe_bill_to_oss.go index 909b55b011f..013a3f6d6a3 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/subscribe_bill_to_oss.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi/subscribe_bill_to_oss.go @@ -74,6 +74,7 @@ type SubscribeBillToOSSRequest struct { BucketOwnerId requests.Integer `position:"Query" name:"BucketOwnerId"` SubscribeType string `position:"Query" name:"SubscribeType"` SubscribeBucket string `position:"Query" name:"SubscribeBucket"` + BeginBillingCycle string `position:"Query" name:"BeginBillingCycle"` MultAccountRelSubscribe string `position:"Query" name:"MultAccountRelSubscribe"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cassandra/allocate_public_contact_points.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cassandra/allocate_public_contact_points.go index 3bf4ab59589..029af5419d7 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cassandra/allocate_public_contact_points.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cassandra/allocate_public_contact_points.go @@ -71,6 +71,7 @@ func (client *Client) AllocatePublicContactPointsWithCallback(request *AllocateP // AllocatePublicContactPointsRequest is the request struct for api AllocatePublicContactPoints type AllocatePublicContactPointsRequest struct { *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` DataCenterId string `position:"Query" name:"DataCenterId"` ClusterId string `position:"Query" name:"ClusterId"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cassandra/create_backup_plan.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cassandra/create_backup_plan.go index 7cd0b097c20..f98546fed11 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cassandra/create_backup_plan.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cassandra/create_backup_plan.go @@ -71,6 +71,7 @@ func (client *Client) CreateBackupPlanWithCallback(request *CreateBackupPlanRequ // CreateBackupPlanRequest is the request struct for api CreateBackupPlan type CreateBackupPlanRequest struct { *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` RetentionPeriod requests.Integer `position:"Query" name:"RetentionPeriod"` DataCenterId string `position:"Query" name:"DataCenterId"` Active requests.Boolean `position:"Query" name:"Active"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cassandra/create_cluster.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cassandra/create_cluster.go index 1af4a3f8dbc..bc8919982e1 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cassandra/create_cluster.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cassandra/create_cluster.go @@ -73,6 +73,7 @@ type CreateClusterRequest struct { *requests.RpcRequest ClientToken string `position:"Query" name:"ClientToken"` ClusterName string `position:"Query" name:"ClusterName"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` Password string `position:"Query" name:"Password"` InstanceType string `position:"Query" name:"InstanceType"` AutoRenewPeriod requests.Integer `position:"Query" name:"AutoRenewPeriod"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cassandra/describe_clusters.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cassandra/describe_clusters.go index 0b77a0ecde8..2f16ce34cd0 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cassandra/describe_clusters.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cassandra/describe_clusters.go @@ -71,10 +71,11 @@ func (client *Client) DescribeClustersWithCallback(request *DescribeClustersRequ // DescribeClustersRequest is the request struct for api DescribeClusters type DescribeClustersRequest struct { *requests.RpcRequest - ClusterName string `position:"Query" name:"ClusterName"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - Tag *[]DescribeClustersTag `position:"Query" name:"Tag" type:"Repeated"` + ClusterName string `position:"Query" name:"ClusterName"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + Tag *[]DescribeClustersTag `position:"Query" name:"Tag" type:"Repeated"` } // DescribeClustersTag is a repeated param struct in DescribeClustersRequest diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cassandra/move_resource_group.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cassandra/move_resource_group.go new file mode 100644 index 00000000000..cff7d7bef7b --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cassandra/move_resource_group.go @@ -0,0 +1,100 @@ +package cassandra + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// MoveResourceGroup invokes the cassandra.MoveResourceGroup API synchronously +func (client *Client) MoveResourceGroup(request *MoveResourceGroupRequest) (response *MoveResourceGroupResponse, err error) { + response = CreateMoveResourceGroupResponse() + err = client.DoAction(request, response) + return +} + +// MoveResourceGroupWithChan invokes the cassandra.MoveResourceGroup API asynchronously +func (client *Client) MoveResourceGroupWithChan(request *MoveResourceGroupRequest) (<-chan *MoveResourceGroupResponse, <-chan error) { + responseChan := make(chan *MoveResourceGroupResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.MoveResourceGroup(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// MoveResourceGroupWithCallback invokes the cassandra.MoveResourceGroup API asynchronously +func (client *Client) MoveResourceGroupWithCallback(request *MoveResourceGroupRequest, callback func(response *MoveResourceGroupResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *MoveResourceGroupResponse + var err error + defer close(result) + response, err = client.MoveResourceGroup(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// MoveResourceGroupRequest is the request struct for api MoveResourceGroup +type MoveResourceGroupRequest struct { + *requests.RpcRequest + ClusterId string `position:"Query" name:"ClusterId"` + NewResourceGroupId string `position:"Query" name:"NewResourceGroupId"` +} + +// MoveResourceGroupResponse is the response struct for api MoveResourceGroup +type MoveResourceGroupResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateMoveResourceGroupRequest creates a request to invoke MoveResourceGroup API +func CreateMoveResourceGroupRequest() (request *MoveResourceGroupRequest) { + request = &MoveResourceGroupRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Cassandra", "2019-01-01", "MoveResourceGroup", "Cassandra", "openAPI") + request.Method = requests.POST + return +} + +// CreateMoveResourceGroupResponse creates a response to parse from MoveResourceGroup response +func CreateMoveResourceGroupResponse() (response *MoveResourceGroupResponse) { + response = &MoveResourceGroupResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cassandra/struct_cluster.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cassandra/struct_cluster.go index f72416691ca..05af29d48ee 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cassandra/struct_cluster.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cassandra/struct_cluster.go @@ -24,6 +24,7 @@ type Cluster struct { MajorVersion string `json:"MajorVersion" xml:"MajorVersion"` CreatedTime string `json:"CreatedTime" xml:"CreatedTime"` IsLatestVersion bool `json:"IsLatestVersion" xml:"IsLatestVersion"` + ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` AutoRenewal bool `json:"AutoRenewal" xml:"AutoRenewal"` MinorVersion string `json:"MinorVersion" xml:"MinorVersion"` MaintainEndTime string `json:"MaintainEndTime" xml:"MaintainEndTime"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/associate_transit_router_attachment_with_route_table.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/associate_transit_router_attachment_with_route_table.go new file mode 100644 index 00000000000..91bb489de50 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/associate_transit_router_attachment_with_route_table.go @@ -0,0 +1,106 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// AssociateTransitRouterAttachmentWithRouteTable invokes the cbn.AssociateTransitRouterAttachmentWithRouteTable API synchronously +func (client *Client) AssociateTransitRouterAttachmentWithRouteTable(request *AssociateTransitRouterAttachmentWithRouteTableRequest) (response *AssociateTransitRouterAttachmentWithRouteTableResponse, err error) { + response = CreateAssociateTransitRouterAttachmentWithRouteTableResponse() + err = client.DoAction(request, response) + return +} + +// AssociateTransitRouterAttachmentWithRouteTableWithChan invokes the cbn.AssociateTransitRouterAttachmentWithRouteTable API asynchronously +func (client *Client) AssociateTransitRouterAttachmentWithRouteTableWithChan(request *AssociateTransitRouterAttachmentWithRouteTableRequest) (<-chan *AssociateTransitRouterAttachmentWithRouteTableResponse, <-chan error) { + responseChan := make(chan *AssociateTransitRouterAttachmentWithRouteTableResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.AssociateTransitRouterAttachmentWithRouteTable(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// AssociateTransitRouterAttachmentWithRouteTableWithCallback invokes the cbn.AssociateTransitRouterAttachmentWithRouteTable API asynchronously +func (client *Client) AssociateTransitRouterAttachmentWithRouteTableWithCallback(request *AssociateTransitRouterAttachmentWithRouteTableRequest, callback func(response *AssociateTransitRouterAttachmentWithRouteTableResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *AssociateTransitRouterAttachmentWithRouteTableResponse + var err error + defer close(result) + response, err = client.AssociateTransitRouterAttachmentWithRouteTable(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// AssociateTransitRouterAttachmentWithRouteTableRequest is the request struct for api AssociateTransitRouterAttachmentWithRouteTable +type AssociateTransitRouterAttachmentWithRouteTableRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ClientToken string `position:"Query" name:"ClientToken"` + TransitRouterRouteTableId string `position:"Query" name:"TransitRouterRouteTableId"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + TransitRouterAttachmentId string `position:"Query" name:"TransitRouterAttachmentId"` +} + +// AssociateTransitRouterAttachmentWithRouteTableResponse is the response struct for api AssociateTransitRouterAttachmentWithRouteTable +type AssociateTransitRouterAttachmentWithRouteTableResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateAssociateTransitRouterAttachmentWithRouteTableRequest creates a request to invoke AssociateTransitRouterAttachmentWithRouteTable API +func CreateAssociateTransitRouterAttachmentWithRouteTableRequest() (request *AssociateTransitRouterAttachmentWithRouteTableRequest) { + request = &AssociateTransitRouterAttachmentWithRouteTableRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Cbn", "2017-09-12", "AssociateTransitRouterAttachmentWithRouteTable", "cbn", "openAPI") + request.Method = requests.POST + return +} + +// CreateAssociateTransitRouterAttachmentWithRouteTableResponse creates a response to parse from AssociateTransitRouterAttachmentWithRouteTable response +func CreateAssociateTransitRouterAttachmentWithRouteTableResponse() (response *AssociateTransitRouterAttachmentWithRouteTableResponse) { + response = &AssociateTransitRouterAttachmentWithRouteTableResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/create_cen.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/create_cen.go index 456e20964d8..e610eada719 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/create_cen.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/create_cen.go @@ -75,6 +75,7 @@ type CreateCenRequest struct { ClientToken string `position:"Query" name:"ClientToken"` Ipv6Level string `position:"Query" name:"Ipv6Level"` Description string `position:"Query" name:"Description"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` OwnerAccount string `position:"Query" name:"OwnerAccount"` OwnerId requests.Integer `position:"Query" name:"OwnerId"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/create_cen_bandwidth_package.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/create_cen_bandwidth_package.go index 7ca6e1599b3..2452fff7899 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/create_cen_bandwidth_package.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/create_cen_bandwidth_package.go @@ -76,6 +76,7 @@ type CreateCenBandwidthPackageRequest struct { Description string `position:"Query" name:"Description"` AutoRenewDuration requests.Integer `position:"Query" name:"AutoRenewDuration"` BandwidthPackageChargeType string `position:"Query" name:"BandwidthPackageChargeType"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` GeographicRegionBId string `position:"Query" name:"GeographicRegionBId"` Period requests.Integer `position:"Query" name:"Period"` GeographicRegionAId string `position:"Query" name:"GeographicRegionAId"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/create_cen_route_map.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/create_cen_route_map.go index 820dcc77a84..5f21bde5800 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/create_cen_route_map.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/create_cen_route_map.go @@ -79,6 +79,7 @@ type CreateCenRouteMapRequest struct { DestinationCidrBlocks *[]string `position:"Query" name:"DestinationCidrBlocks" type:"Repeated"` SystemPolicy requests.Boolean `position:"Query" name:"SystemPolicy"` OriginalRouteTableIds *[]string `position:"Query" name:"OriginalRouteTableIds" type:"Repeated"` + TransitRouterRouteTableId string `position:"Query" name:"TransitRouterRouteTableId"` SourceInstanceIds *[]string `position:"Query" name:"SourceInstanceIds" type:"Repeated"` SourceRegionIds *[]string `position:"Query" name:"SourceRegionIds" type:"Repeated"` GatewayZoneId string `position:"Query" name:"GatewayZoneId"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/create_transit_router.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/create_transit_router.go new file mode 100644 index 00000000000..2eeeb66372c --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/create_transit_router.go @@ -0,0 +1,109 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// CreateTransitRouter invokes the cbn.CreateTransitRouter API synchronously +func (client *Client) CreateTransitRouter(request *CreateTransitRouterRequest) (response *CreateTransitRouterResponse, err error) { + response = CreateCreateTransitRouterResponse() + err = client.DoAction(request, response) + return +} + +// CreateTransitRouterWithChan invokes the cbn.CreateTransitRouter API asynchronously +func (client *Client) CreateTransitRouterWithChan(request *CreateTransitRouterRequest) (<-chan *CreateTransitRouterResponse, <-chan error) { + responseChan := make(chan *CreateTransitRouterResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.CreateTransitRouter(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// CreateTransitRouterWithCallback invokes the cbn.CreateTransitRouter API asynchronously +func (client *Client) CreateTransitRouterWithCallback(request *CreateTransitRouterRequest, callback func(response *CreateTransitRouterResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *CreateTransitRouterResponse + var err error + defer close(result) + response, err = client.CreateTransitRouter(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// CreateTransitRouterRequest is the request struct for api CreateTransitRouter +type CreateTransitRouterRequest struct { + *requests.RpcRequest + TransitRouterName string `position:"Query" name:"TransitRouterName"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ClientToken string `position:"Query" name:"ClientToken"` + CenId string `position:"Query" name:"CenId"` + Type string `position:"Query" name:"Type"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + TransitRouterDescription string `position:"Query" name:"TransitRouterDescription"` +} + +// CreateTransitRouterResponse is the response struct for api CreateTransitRouter +type CreateTransitRouterResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + TransitRouterId string `json:"TransitRouterId" xml:"TransitRouterId"` +} + +// CreateCreateTransitRouterRequest creates a request to invoke CreateTransitRouter API +func CreateCreateTransitRouterRequest() (request *CreateTransitRouterRequest) { + request = &CreateTransitRouterRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Cbn", "2017-09-12", "CreateTransitRouter", "cbn", "openAPI") + request.Method = requests.POST + return +} + +// CreateCreateTransitRouterResponse creates a response to parse from CreateTransitRouter response +func CreateCreateTransitRouterResponse() (response *CreateTransitRouterResponse) { + response = &CreateTransitRouterResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/create_transit_router_peer_attachment.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/create_transit_router_peer_attachment.go new file mode 100644 index 00000000000..06de138a015 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/create_transit_router_peer_attachment.go @@ -0,0 +1,117 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// CreateTransitRouterPeerAttachment invokes the cbn.CreateTransitRouterPeerAttachment API synchronously +func (client *Client) CreateTransitRouterPeerAttachment(request *CreateTransitRouterPeerAttachmentRequest) (response *CreateTransitRouterPeerAttachmentResponse, err error) { + response = CreateCreateTransitRouterPeerAttachmentResponse() + err = client.DoAction(request, response) + return +} + +// CreateTransitRouterPeerAttachmentWithChan invokes the cbn.CreateTransitRouterPeerAttachment API asynchronously +func (client *Client) CreateTransitRouterPeerAttachmentWithChan(request *CreateTransitRouterPeerAttachmentRequest) (<-chan *CreateTransitRouterPeerAttachmentResponse, <-chan error) { + responseChan := make(chan *CreateTransitRouterPeerAttachmentResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.CreateTransitRouterPeerAttachment(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// CreateTransitRouterPeerAttachmentWithCallback invokes the cbn.CreateTransitRouterPeerAttachment API asynchronously +func (client *Client) CreateTransitRouterPeerAttachmentWithCallback(request *CreateTransitRouterPeerAttachmentRequest, callback func(response *CreateTransitRouterPeerAttachmentResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *CreateTransitRouterPeerAttachmentResponse + var err error + defer close(result) + response, err = client.CreateTransitRouterPeerAttachment(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// CreateTransitRouterPeerAttachmentRequest is the request struct for api CreateTransitRouterPeerAttachment +type CreateTransitRouterPeerAttachmentRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ClientToken string `position:"Query" name:"ClientToken"` + CenId string `position:"Query" name:"CenId"` + RouteTableAssociationEnabled requests.Boolean `position:"Query" name:"RouteTableAssociationEnabled"` + TransitRouterAttachmentName string `position:"Query" name:"TransitRouterAttachmentName"` + AutoPublishRouteEnabled requests.Boolean `position:"Query" name:"AutoPublishRouteEnabled"` + RouteTablePropagationEnabled requests.Boolean `position:"Query" name:"RouteTablePropagationEnabled"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + Bandwidth requests.Integer `position:"Query" name:"Bandwidth"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + TransitRouterId string `position:"Query" name:"TransitRouterId"` + ResourceType string `position:"Query" name:"ResourceType"` + TransitRouterAttachmentDescription string `position:"Query" name:"TransitRouterAttachmentDescription"` + PeerTransitRouterRegionId string `position:"Query" name:"PeerTransitRouterRegionId"` + CenBandwidthPackageId string `position:"Query" name:"CenBandwidthPackageId"` + PeerTransitRouterId string `position:"Query" name:"PeerTransitRouterId"` +} + +// CreateTransitRouterPeerAttachmentResponse is the response struct for api CreateTransitRouterPeerAttachment +type CreateTransitRouterPeerAttachmentResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + TransitRouterAttachmentId string `json:"TransitRouterAttachmentId" xml:"TransitRouterAttachmentId"` +} + +// CreateCreateTransitRouterPeerAttachmentRequest creates a request to invoke CreateTransitRouterPeerAttachment API +func CreateCreateTransitRouterPeerAttachmentRequest() (request *CreateTransitRouterPeerAttachmentRequest) { + request = &CreateTransitRouterPeerAttachmentRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Cbn", "2017-09-12", "CreateTransitRouterPeerAttachment", "cbn", "openAPI") + request.Method = requests.POST + return +} + +// CreateCreateTransitRouterPeerAttachmentResponse creates a response to parse from CreateTransitRouterPeerAttachment response +func CreateCreateTransitRouterPeerAttachmentResponse() (response *CreateTransitRouterPeerAttachmentResponse) { + response = &CreateTransitRouterPeerAttachmentResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/create_transit_router_route_entry.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/create_transit_router_route_entry.go new file mode 100644 index 00000000000..3445db6bc6a --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/create_transit_router_route_entry.go @@ -0,0 +1,111 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// CreateTransitRouterRouteEntry invokes the cbn.CreateTransitRouterRouteEntry API synchronously +func (client *Client) CreateTransitRouterRouteEntry(request *CreateTransitRouterRouteEntryRequest) (response *CreateTransitRouterRouteEntryResponse, err error) { + response = CreateCreateTransitRouterRouteEntryResponse() + err = client.DoAction(request, response) + return +} + +// CreateTransitRouterRouteEntryWithChan invokes the cbn.CreateTransitRouterRouteEntry API asynchronously +func (client *Client) CreateTransitRouterRouteEntryWithChan(request *CreateTransitRouterRouteEntryRequest) (<-chan *CreateTransitRouterRouteEntryResponse, <-chan error) { + responseChan := make(chan *CreateTransitRouterRouteEntryResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.CreateTransitRouterRouteEntry(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// CreateTransitRouterRouteEntryWithCallback invokes the cbn.CreateTransitRouterRouteEntry API asynchronously +func (client *Client) CreateTransitRouterRouteEntryWithCallback(request *CreateTransitRouterRouteEntryRequest, callback func(response *CreateTransitRouterRouteEntryResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *CreateTransitRouterRouteEntryResponse + var err error + defer close(result) + response, err = client.CreateTransitRouterRouteEntry(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// CreateTransitRouterRouteEntryRequest is the request struct for api CreateTransitRouterRouteEntry +type CreateTransitRouterRouteEntryRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ClientToken string `position:"Query" name:"ClientToken"` + TransitRouterRouteEntryNextHopType string `position:"Query" name:"TransitRouterRouteEntryNextHopType"` + TransitRouterRouteEntryDestinationCidrBlock string `position:"Query" name:"TransitRouterRouteEntryDestinationCidrBlock"` + TransitRouterRouteTableId string `position:"Query" name:"TransitRouterRouteTableId"` + TransitRouterRouteEntryNextHopId string `position:"Query" name:"TransitRouterRouteEntryNextHopId"` + TransitRouterRouteEntryDescription string `position:"Query" name:"TransitRouterRouteEntryDescription"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + TransitRouterRouteEntryName string `position:"Query" name:"TransitRouterRouteEntryName"` +} + +// CreateTransitRouterRouteEntryResponse is the response struct for api CreateTransitRouterRouteEntry +type CreateTransitRouterRouteEntryResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + TransitRouterRouteEntryId string `json:"TransitRouterRouteEntryId" xml:"TransitRouterRouteEntryId"` +} + +// CreateCreateTransitRouterRouteEntryRequest creates a request to invoke CreateTransitRouterRouteEntry API +func CreateCreateTransitRouterRouteEntryRequest() (request *CreateTransitRouterRouteEntryRequest) { + request = &CreateTransitRouterRouteEntryRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Cbn", "2017-09-12", "CreateTransitRouterRouteEntry", "cbn", "openAPI") + request.Method = requests.POST + return +} + +// CreateCreateTransitRouterRouteEntryResponse creates a response to parse from CreateTransitRouterRouteEntry response +func CreateCreateTransitRouterRouteEntryResponse() (response *CreateTransitRouterRouteEntryResponse) { + response = &CreateTransitRouterRouteEntryResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/create_transit_router_route_table.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/create_transit_router_route_table.go new file mode 100644 index 00000000000..389b4c229fc --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/create_transit_router_route_table.go @@ -0,0 +1,108 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// CreateTransitRouterRouteTable invokes the cbn.CreateTransitRouterRouteTable API synchronously +func (client *Client) CreateTransitRouterRouteTable(request *CreateTransitRouterRouteTableRequest) (response *CreateTransitRouterRouteTableResponse, err error) { + response = CreateCreateTransitRouterRouteTableResponse() + err = client.DoAction(request, response) + return +} + +// CreateTransitRouterRouteTableWithChan invokes the cbn.CreateTransitRouterRouteTable API asynchronously +func (client *Client) CreateTransitRouterRouteTableWithChan(request *CreateTransitRouterRouteTableRequest) (<-chan *CreateTransitRouterRouteTableResponse, <-chan error) { + responseChan := make(chan *CreateTransitRouterRouteTableResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.CreateTransitRouterRouteTable(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// CreateTransitRouterRouteTableWithCallback invokes the cbn.CreateTransitRouterRouteTable API asynchronously +func (client *Client) CreateTransitRouterRouteTableWithCallback(request *CreateTransitRouterRouteTableRequest, callback func(response *CreateTransitRouterRouteTableResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *CreateTransitRouterRouteTableResponse + var err error + defer close(result) + response, err = client.CreateTransitRouterRouteTable(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// CreateTransitRouterRouteTableRequest is the request struct for api CreateTransitRouterRouteTable +type CreateTransitRouterRouteTableRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ClientToken string `position:"Query" name:"ClientToken"` + TransitRouterRouteTableDescription string `position:"Query" name:"TransitRouterRouteTableDescription"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + TransitRouterRouteTableName string `position:"Query" name:"TransitRouterRouteTableName"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + TransitRouterId string `position:"Query" name:"TransitRouterId"` +} + +// CreateTransitRouterRouteTableResponse is the response struct for api CreateTransitRouterRouteTable +type CreateTransitRouterRouteTableResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + TransitRouterRouteTableId string `json:"TransitRouterRouteTableId" xml:"TransitRouterRouteTableId"` +} + +// CreateCreateTransitRouterRouteTableRequest creates a request to invoke CreateTransitRouterRouteTable API +func CreateCreateTransitRouterRouteTableRequest() (request *CreateTransitRouterRouteTableRequest) { + request = &CreateTransitRouterRouteTableRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Cbn", "2017-09-12", "CreateTransitRouterRouteTable", "cbn", "openAPI") + request.Method = requests.POST + return +} + +// CreateCreateTransitRouterRouteTableResponse creates a response to parse from CreateTransitRouterRouteTable response +func CreateCreateTransitRouterRouteTableResponse() (response *CreateTransitRouterRouteTableResponse) { + response = &CreateTransitRouterRouteTableResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/create_transit_router_vbr_attachment.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/create_transit_router_vbr_attachment.go new file mode 100644 index 00000000000..34aded7c92b --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/create_transit_router_vbr_attachment.go @@ -0,0 +1,115 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// CreateTransitRouterVbrAttachment invokes the cbn.CreateTransitRouterVbrAttachment API synchronously +func (client *Client) CreateTransitRouterVbrAttachment(request *CreateTransitRouterVbrAttachmentRequest) (response *CreateTransitRouterVbrAttachmentResponse, err error) { + response = CreateCreateTransitRouterVbrAttachmentResponse() + err = client.DoAction(request, response) + return +} + +// CreateTransitRouterVbrAttachmentWithChan invokes the cbn.CreateTransitRouterVbrAttachment API asynchronously +func (client *Client) CreateTransitRouterVbrAttachmentWithChan(request *CreateTransitRouterVbrAttachmentRequest) (<-chan *CreateTransitRouterVbrAttachmentResponse, <-chan error) { + responseChan := make(chan *CreateTransitRouterVbrAttachmentResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.CreateTransitRouterVbrAttachment(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// CreateTransitRouterVbrAttachmentWithCallback invokes the cbn.CreateTransitRouterVbrAttachment API asynchronously +func (client *Client) CreateTransitRouterVbrAttachmentWithCallback(request *CreateTransitRouterVbrAttachmentRequest, callback func(response *CreateTransitRouterVbrAttachmentResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *CreateTransitRouterVbrAttachmentResponse + var err error + defer close(result) + response, err = client.CreateTransitRouterVbrAttachment(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// CreateTransitRouterVbrAttachmentRequest is the request struct for api CreateTransitRouterVbrAttachment +type CreateTransitRouterVbrAttachmentRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ClientToken string `position:"Query" name:"ClientToken"` + CenId string `position:"Query" name:"CenId"` + RouteTableAssociationEnabled requests.Boolean `position:"Query" name:"RouteTableAssociationEnabled"` + VbrId string `position:"Query" name:"VbrId"` + TransitRouterAttachmentName string `position:"Query" name:"TransitRouterAttachmentName"` + AutoPublishRouteEnabled requests.Boolean `position:"Query" name:"AutoPublishRouteEnabled"` + RouteTablePropagationEnabled requests.Boolean `position:"Query" name:"RouteTablePropagationEnabled"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + TransitRouterId string `position:"Query" name:"TransitRouterId"` + ResourceType string `position:"Query" name:"ResourceType"` + TransitRouterAttachmentDescription string `position:"Query" name:"TransitRouterAttachmentDescription"` + VbrOwnerId requests.Integer `position:"Query" name:"VbrOwnerId"` +} + +// CreateTransitRouterVbrAttachmentResponse is the response struct for api CreateTransitRouterVbrAttachment +type CreateTransitRouterVbrAttachmentResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + TransitRouterAttachmentId string `json:"TransitRouterAttachmentId" xml:"TransitRouterAttachmentId"` +} + +// CreateCreateTransitRouterVbrAttachmentRequest creates a request to invoke CreateTransitRouterVbrAttachment API +func CreateCreateTransitRouterVbrAttachmentRequest() (request *CreateTransitRouterVbrAttachmentRequest) { + request = &CreateTransitRouterVbrAttachmentRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Cbn", "2017-09-12", "CreateTransitRouterVbrAttachment", "cbn", "openAPI") + request.Method = requests.POST + return +} + +// CreateCreateTransitRouterVbrAttachmentResponse creates a response to parse from CreateTransitRouterVbrAttachment response +func CreateCreateTransitRouterVbrAttachmentResponse() (response *CreateTransitRouterVbrAttachmentResponse) { + response = &CreateTransitRouterVbrAttachmentResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/create_transit_router_vpc_attachment.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/create_transit_router_vpc_attachment.go new file mode 100644 index 00000000000..d52056ea572 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/create_transit_router_vpc_attachment.go @@ -0,0 +1,123 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// CreateTransitRouterVpcAttachment invokes the cbn.CreateTransitRouterVpcAttachment API synchronously +func (client *Client) CreateTransitRouterVpcAttachment(request *CreateTransitRouterVpcAttachmentRequest) (response *CreateTransitRouterVpcAttachmentResponse, err error) { + response = CreateCreateTransitRouterVpcAttachmentResponse() + err = client.DoAction(request, response) + return +} + +// CreateTransitRouterVpcAttachmentWithChan invokes the cbn.CreateTransitRouterVpcAttachment API asynchronously +func (client *Client) CreateTransitRouterVpcAttachmentWithChan(request *CreateTransitRouterVpcAttachmentRequest) (<-chan *CreateTransitRouterVpcAttachmentResponse, <-chan error) { + responseChan := make(chan *CreateTransitRouterVpcAttachmentResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.CreateTransitRouterVpcAttachment(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// CreateTransitRouterVpcAttachmentWithCallback invokes the cbn.CreateTransitRouterVpcAttachment API asynchronously +func (client *Client) CreateTransitRouterVpcAttachmentWithCallback(request *CreateTransitRouterVpcAttachmentRequest, callback func(response *CreateTransitRouterVpcAttachmentResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *CreateTransitRouterVpcAttachmentResponse + var err error + defer close(result) + response, err = client.CreateTransitRouterVpcAttachment(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// CreateTransitRouterVpcAttachmentRequest is the request struct for api CreateTransitRouterVpcAttachment +type CreateTransitRouterVpcAttachmentRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + VpcOwnerId requests.Integer `position:"Query" name:"VpcOwnerId"` + ClientToken string `position:"Query" name:"ClientToken"` + CenId string `position:"Query" name:"CenId"` + RouteTableAssociationEnabled requests.Boolean `position:"Query" name:"RouteTableAssociationEnabled"` + TransitRouterAttachmentName string `position:"Query" name:"TransitRouterAttachmentName"` + AutoCreateVpcRoute requests.Boolean `position:"Query" name:"AutoCreateVpcRoute"` + RouteTablePropagationEnabled requests.Boolean `position:"Query" name:"RouteTablePropagationEnabled"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + ZoneMappings *[]CreateTransitRouterVpcAttachmentZoneMappings `position:"Query" name:"ZoneMappings" type:"Repeated"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + TransitRouterId string `position:"Query" name:"TransitRouterId"` + ResourceType string `position:"Query" name:"ResourceType"` + TransitRouterAttachmentDescription string `position:"Query" name:"TransitRouterAttachmentDescription"` + VpcId string `position:"Query" name:"VpcId"` + ChargeType string `position:"Query" name:"ChargeType"` +} + +// CreateTransitRouterVpcAttachmentZoneMappings is a repeated param struct in CreateTransitRouterVpcAttachmentRequest +type CreateTransitRouterVpcAttachmentZoneMappings struct { + VSwitchId string `name:"VSwitchId"` + ZoneId string `name:"ZoneId"` +} + +// CreateTransitRouterVpcAttachmentResponse is the response struct for api CreateTransitRouterVpcAttachment +type CreateTransitRouterVpcAttachmentResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + TransitRouterAttachmentId string `json:"TransitRouterAttachmentId" xml:"TransitRouterAttachmentId"` +} + +// CreateCreateTransitRouterVpcAttachmentRequest creates a request to invoke CreateTransitRouterVpcAttachment API +func CreateCreateTransitRouterVpcAttachmentRequest() (request *CreateTransitRouterVpcAttachmentRequest) { + request = &CreateTransitRouterVpcAttachmentRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Cbn", "2017-09-12", "CreateTransitRouterVpcAttachment", "cbn", "openAPI") + request.Method = requests.POST + return +} + +// CreateCreateTransitRouterVpcAttachmentResponse creates a response to parse from CreateTransitRouterVpcAttachment response +func CreateCreateTransitRouterVpcAttachmentResponse() (response *CreateTransitRouterVpcAttachmentResponse) { + response = &CreateTransitRouterVpcAttachmentResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/delete_transit_router_peer_attachment.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/delete_transit_router_peer_attachment.go new file mode 100644 index 00000000000..f11e46b99d6 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/delete_transit_router_peer_attachment.go @@ -0,0 +1,106 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DeleteTransitRouterPeerAttachment invokes the cbn.DeleteTransitRouterPeerAttachment API synchronously +func (client *Client) DeleteTransitRouterPeerAttachment(request *DeleteTransitRouterPeerAttachmentRequest) (response *DeleteTransitRouterPeerAttachmentResponse, err error) { + response = CreateDeleteTransitRouterPeerAttachmentResponse() + err = client.DoAction(request, response) + return +} + +// DeleteTransitRouterPeerAttachmentWithChan invokes the cbn.DeleteTransitRouterPeerAttachment API asynchronously +func (client *Client) DeleteTransitRouterPeerAttachmentWithChan(request *DeleteTransitRouterPeerAttachmentRequest) (<-chan *DeleteTransitRouterPeerAttachmentResponse, <-chan error) { + responseChan := make(chan *DeleteTransitRouterPeerAttachmentResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DeleteTransitRouterPeerAttachment(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DeleteTransitRouterPeerAttachmentWithCallback invokes the cbn.DeleteTransitRouterPeerAttachment API asynchronously +func (client *Client) DeleteTransitRouterPeerAttachmentWithCallback(request *DeleteTransitRouterPeerAttachmentRequest, callback func(response *DeleteTransitRouterPeerAttachmentResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DeleteTransitRouterPeerAttachmentResponse + var err error + defer close(result) + response, err = client.DeleteTransitRouterPeerAttachment(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DeleteTransitRouterPeerAttachmentRequest is the request struct for api DeleteTransitRouterPeerAttachment +type DeleteTransitRouterPeerAttachmentRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ClientToken string `position:"Query" name:"ClientToken"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + ResourceType string `position:"Query" name:"ResourceType"` + TransitRouterAttachmentId string `position:"Query" name:"TransitRouterAttachmentId"` +} + +// DeleteTransitRouterPeerAttachmentResponse is the response struct for api DeleteTransitRouterPeerAttachment +type DeleteTransitRouterPeerAttachmentResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateDeleteTransitRouterPeerAttachmentRequest creates a request to invoke DeleteTransitRouterPeerAttachment API +func CreateDeleteTransitRouterPeerAttachmentRequest() (request *DeleteTransitRouterPeerAttachmentRequest) { + request = &DeleteTransitRouterPeerAttachmentRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Cbn", "2017-09-12", "DeleteTransitRouterPeerAttachment", "cbn", "openAPI") + request.Method = requests.POST + return +} + +// CreateDeleteTransitRouterPeerAttachmentResponse creates a response to parse from DeleteTransitRouterPeerAttachment response +func CreateDeleteTransitRouterPeerAttachmentResponse() (response *DeleteTransitRouterPeerAttachmentResponse) { + response = &DeleteTransitRouterPeerAttachmentResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/delete_transit_router_route_entry.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/delete_transit_router_route_entry.go new file mode 100644 index 00000000000..f787761235e --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/delete_transit_router_route_entry.go @@ -0,0 +1,109 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DeleteTransitRouterRouteEntry invokes the cbn.DeleteTransitRouterRouteEntry API synchronously +func (client *Client) DeleteTransitRouterRouteEntry(request *DeleteTransitRouterRouteEntryRequest) (response *DeleteTransitRouterRouteEntryResponse, err error) { + response = CreateDeleteTransitRouterRouteEntryResponse() + err = client.DoAction(request, response) + return +} + +// DeleteTransitRouterRouteEntryWithChan invokes the cbn.DeleteTransitRouterRouteEntry API asynchronously +func (client *Client) DeleteTransitRouterRouteEntryWithChan(request *DeleteTransitRouterRouteEntryRequest) (<-chan *DeleteTransitRouterRouteEntryResponse, <-chan error) { + responseChan := make(chan *DeleteTransitRouterRouteEntryResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DeleteTransitRouterRouteEntry(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DeleteTransitRouterRouteEntryWithCallback invokes the cbn.DeleteTransitRouterRouteEntry API asynchronously +func (client *Client) DeleteTransitRouterRouteEntryWithCallback(request *DeleteTransitRouterRouteEntryRequest, callback func(response *DeleteTransitRouterRouteEntryResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DeleteTransitRouterRouteEntryResponse + var err error + defer close(result) + response, err = client.DeleteTransitRouterRouteEntry(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DeleteTransitRouterRouteEntryRequest is the request struct for api DeleteTransitRouterRouteEntry +type DeleteTransitRouterRouteEntryRequest struct { + *requests.RpcRequest + TransitRouterRouteEntryId string `position:"Query" name:"TransitRouterRouteEntryId"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ClientToken string `position:"Query" name:"ClientToken"` + TransitRouterRouteEntryNextHopType string `position:"Query" name:"TransitRouterRouteEntryNextHopType"` + TransitRouterRouteEntryDestinationCidrBlock string `position:"Query" name:"TransitRouterRouteEntryDestinationCidrBlock"` + TransitRouterRouteTableId string `position:"Query" name:"TransitRouterRouteTableId"` + TransitRouterRouteEntryNextHopId string `position:"Query" name:"TransitRouterRouteEntryNextHopId"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` +} + +// DeleteTransitRouterRouteEntryResponse is the response struct for api DeleteTransitRouterRouteEntry +type DeleteTransitRouterRouteEntryResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateDeleteTransitRouterRouteEntryRequest creates a request to invoke DeleteTransitRouterRouteEntry API +func CreateDeleteTransitRouterRouteEntryRequest() (request *DeleteTransitRouterRouteEntryRequest) { + request = &DeleteTransitRouterRouteEntryRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Cbn", "2017-09-12", "DeleteTransitRouterRouteEntry", "cbn", "openAPI") + request.Method = requests.POST + return +} + +// CreateDeleteTransitRouterRouteEntryResponse creates a response to parse from DeleteTransitRouterRouteEntry response +func CreateDeleteTransitRouterRouteEntryResponse() (response *DeleteTransitRouterRouteEntryResponse) { + response = &DeleteTransitRouterRouteEntryResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/delete_transit_router_route_table.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/delete_transit_router_route_table.go new file mode 100644 index 00000000000..d5fd2e1c2f7 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/delete_transit_router_route_table.go @@ -0,0 +1,105 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DeleteTransitRouterRouteTable invokes the cbn.DeleteTransitRouterRouteTable API synchronously +func (client *Client) DeleteTransitRouterRouteTable(request *DeleteTransitRouterRouteTableRequest) (response *DeleteTransitRouterRouteTableResponse, err error) { + response = CreateDeleteTransitRouterRouteTableResponse() + err = client.DoAction(request, response) + return +} + +// DeleteTransitRouterRouteTableWithChan invokes the cbn.DeleteTransitRouterRouteTable API asynchronously +func (client *Client) DeleteTransitRouterRouteTableWithChan(request *DeleteTransitRouterRouteTableRequest) (<-chan *DeleteTransitRouterRouteTableResponse, <-chan error) { + responseChan := make(chan *DeleteTransitRouterRouteTableResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DeleteTransitRouterRouteTable(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DeleteTransitRouterRouteTableWithCallback invokes the cbn.DeleteTransitRouterRouteTable API asynchronously +func (client *Client) DeleteTransitRouterRouteTableWithCallback(request *DeleteTransitRouterRouteTableRequest, callback func(response *DeleteTransitRouterRouteTableResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DeleteTransitRouterRouteTableResponse + var err error + defer close(result) + response, err = client.DeleteTransitRouterRouteTable(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DeleteTransitRouterRouteTableRequest is the request struct for api DeleteTransitRouterRouteTable +type DeleteTransitRouterRouteTableRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ClientToken string `position:"Query" name:"ClientToken"` + TransitRouterRouteTableId string `position:"Query" name:"TransitRouterRouteTableId"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` +} + +// DeleteTransitRouterRouteTableResponse is the response struct for api DeleteTransitRouterRouteTable +type DeleteTransitRouterRouteTableResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateDeleteTransitRouterRouteTableRequest creates a request to invoke DeleteTransitRouterRouteTable API +func CreateDeleteTransitRouterRouteTableRequest() (request *DeleteTransitRouterRouteTableRequest) { + request = &DeleteTransitRouterRouteTableRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Cbn", "2017-09-12", "DeleteTransitRouterRouteTable", "cbn", "openAPI") + request.Method = requests.POST + return +} + +// CreateDeleteTransitRouterRouteTableResponse creates a response to parse from DeleteTransitRouterRouteTable response +func CreateDeleteTransitRouterRouteTableResponse() (response *DeleteTransitRouterRouteTableResponse) { + response = &DeleteTransitRouterRouteTableResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/delete_transit_router_vbr_attachment.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/delete_transit_router_vbr_attachment.go new file mode 100644 index 00000000000..61700d9b532 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/delete_transit_router_vbr_attachment.go @@ -0,0 +1,106 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DeleteTransitRouterVbrAttachment invokes the cbn.DeleteTransitRouterVbrAttachment API synchronously +func (client *Client) DeleteTransitRouterVbrAttachment(request *DeleteTransitRouterVbrAttachmentRequest) (response *DeleteTransitRouterVbrAttachmentResponse, err error) { + response = CreateDeleteTransitRouterVbrAttachmentResponse() + err = client.DoAction(request, response) + return +} + +// DeleteTransitRouterVbrAttachmentWithChan invokes the cbn.DeleteTransitRouterVbrAttachment API asynchronously +func (client *Client) DeleteTransitRouterVbrAttachmentWithChan(request *DeleteTransitRouterVbrAttachmentRequest) (<-chan *DeleteTransitRouterVbrAttachmentResponse, <-chan error) { + responseChan := make(chan *DeleteTransitRouterVbrAttachmentResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DeleteTransitRouterVbrAttachment(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DeleteTransitRouterVbrAttachmentWithCallback invokes the cbn.DeleteTransitRouterVbrAttachment API asynchronously +func (client *Client) DeleteTransitRouterVbrAttachmentWithCallback(request *DeleteTransitRouterVbrAttachmentRequest, callback func(response *DeleteTransitRouterVbrAttachmentResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DeleteTransitRouterVbrAttachmentResponse + var err error + defer close(result) + response, err = client.DeleteTransitRouterVbrAttachment(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DeleteTransitRouterVbrAttachmentRequest is the request struct for api DeleteTransitRouterVbrAttachment +type DeleteTransitRouterVbrAttachmentRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ClientToken string `position:"Query" name:"ClientToken"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + ResourceType string `position:"Query" name:"ResourceType"` + TransitRouterAttachmentId string `position:"Query" name:"TransitRouterAttachmentId"` +} + +// DeleteTransitRouterVbrAttachmentResponse is the response struct for api DeleteTransitRouterVbrAttachment +type DeleteTransitRouterVbrAttachmentResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateDeleteTransitRouterVbrAttachmentRequest creates a request to invoke DeleteTransitRouterVbrAttachment API +func CreateDeleteTransitRouterVbrAttachmentRequest() (request *DeleteTransitRouterVbrAttachmentRequest) { + request = &DeleteTransitRouterVbrAttachmentRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Cbn", "2017-09-12", "DeleteTransitRouterVbrAttachment", "cbn", "openAPI") + request.Method = requests.POST + return +} + +// CreateDeleteTransitRouterVbrAttachmentResponse creates a response to parse from DeleteTransitRouterVbrAttachment response +func CreateDeleteTransitRouterVbrAttachmentResponse() (response *DeleteTransitRouterVbrAttachmentResponse) { + response = &DeleteTransitRouterVbrAttachmentResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/delete_transit_router_vpc_attachment.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/delete_transit_router_vpc_attachment.go new file mode 100644 index 00000000000..33e70cbce56 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/delete_transit_router_vpc_attachment.go @@ -0,0 +1,106 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DeleteTransitRouterVpcAttachment invokes the cbn.DeleteTransitRouterVpcAttachment API synchronously +func (client *Client) DeleteTransitRouterVpcAttachment(request *DeleteTransitRouterVpcAttachmentRequest) (response *DeleteTransitRouterVpcAttachmentResponse, err error) { + response = CreateDeleteTransitRouterVpcAttachmentResponse() + err = client.DoAction(request, response) + return +} + +// DeleteTransitRouterVpcAttachmentWithChan invokes the cbn.DeleteTransitRouterVpcAttachment API asynchronously +func (client *Client) DeleteTransitRouterVpcAttachmentWithChan(request *DeleteTransitRouterVpcAttachmentRequest) (<-chan *DeleteTransitRouterVpcAttachmentResponse, <-chan error) { + responseChan := make(chan *DeleteTransitRouterVpcAttachmentResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DeleteTransitRouterVpcAttachment(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DeleteTransitRouterVpcAttachmentWithCallback invokes the cbn.DeleteTransitRouterVpcAttachment API asynchronously +func (client *Client) DeleteTransitRouterVpcAttachmentWithCallback(request *DeleteTransitRouterVpcAttachmentRequest, callback func(response *DeleteTransitRouterVpcAttachmentResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DeleteTransitRouterVpcAttachmentResponse + var err error + defer close(result) + response, err = client.DeleteTransitRouterVpcAttachment(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DeleteTransitRouterVpcAttachmentRequest is the request struct for api DeleteTransitRouterVpcAttachment +type DeleteTransitRouterVpcAttachmentRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ClientToken string `position:"Query" name:"ClientToken"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + ResourceType string `position:"Query" name:"ResourceType"` + TransitRouterAttachmentId string `position:"Query" name:"TransitRouterAttachmentId"` +} + +// DeleteTransitRouterVpcAttachmentResponse is the response struct for api DeleteTransitRouterVpcAttachment +type DeleteTransitRouterVpcAttachmentResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateDeleteTransitRouterVpcAttachmentRequest creates a request to invoke DeleteTransitRouterVpcAttachment API +func CreateDeleteTransitRouterVpcAttachmentRequest() (request *DeleteTransitRouterVpcAttachmentRequest) { + request = &DeleteTransitRouterVpcAttachmentRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Cbn", "2017-09-12", "DeleteTransitRouterVpcAttachment", "cbn", "openAPI") + request.Method = requests.POST + return +} + +// CreateDeleteTransitRouterVpcAttachmentResponse creates a response to parse from DeleteTransitRouterVpcAttachment response +func CreateDeleteTransitRouterVpcAttachmentResponse() (response *DeleteTransitRouterVpcAttachmentResponse) { + response = &DeleteTransitRouterVpcAttachmentResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/describe_cen_bandwidth_packages.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/describe_cen_bandwidth_packages.go index a70f0502d7e..235fbb0d5a3 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/describe_cen_bandwidth_packages.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/describe_cen_bandwidth_packages.go @@ -75,6 +75,7 @@ type DescribeCenBandwidthPackagesRequest struct { IncludeReservationData requests.Boolean `position:"Query" name:"IncludeReservationData"` PageNumber requests.Integer `position:"Query" name:"PageNumber"` IsOrKey requests.Boolean `position:"Query" name:"IsOrKey"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` PageSize requests.Integer `position:"Query" name:"PageSize"` Tag *[]DescribeCenBandwidthPackagesTag `position:"Query" name:"Tag" type:"Repeated"` ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/describe_cen_route_maps.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/describe_cen_route_maps.go index 9e98ac7f748..e306b5f3a6c 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/describe_cen_route_maps.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/describe_cen_route_maps.go @@ -71,17 +71,18 @@ func (client *Client) DescribeCenRouteMapsWithCallback(request *DescribeCenRoute // DescribeCenRouteMapsRequest is the request struct for api DescribeCenRouteMaps type DescribeCenRouteMapsRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - CenId string `position:"Query" name:"CenId"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - TransmitDirection string `position:"Query" name:"TransmitDirection"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - RouteMapId string `position:"Query" name:"RouteMapId"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - Filter *[]DescribeCenRouteMapsFilter `position:"Query" name:"Filter" type:"Repeated"` - CenRegionId string `position:"Query" name:"CenRegionId"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + CenId string `position:"Query" name:"CenId"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` + TransitRouterRouteTableId string `position:"Query" name:"TransitRouterRouteTableId"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + TransmitDirection string `position:"Query" name:"TransmitDirection"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + RouteMapId string `position:"Query" name:"RouteMapId"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + Filter *[]DescribeCenRouteMapsFilter `position:"Query" name:"Filter" type:"Repeated"` + CenRegionId string `position:"Query" name:"CenRegionId"` } // DescribeCenRouteMapsFilter is a repeated param struct in DescribeCenRouteMapsRequest diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/describe_cens.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/describe_cens.go index 038f360c626..70fcd6323a3 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/describe_cens.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/describe_cens.go @@ -73,6 +73,7 @@ type DescribeCensRequest struct { *requests.RpcRequest ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` PageNumber requests.Integer `position:"Query" name:"PageNumber"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` PageSize requests.Integer `position:"Query" name:"PageSize"` Tag *[]DescribeCensTag `position:"Query" name:"Tag" type:"Repeated"` ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/disable_transit_router_route_table_propagation.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/disable_transit_router_route_table_propagation.go new file mode 100644 index 00000000000..966fa79f053 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/disable_transit_router_route_table_propagation.go @@ -0,0 +1,106 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DisableTransitRouterRouteTablePropagation invokes the cbn.DisableTransitRouterRouteTablePropagation API synchronously +func (client *Client) DisableTransitRouterRouteTablePropagation(request *DisableTransitRouterRouteTablePropagationRequest) (response *DisableTransitRouterRouteTablePropagationResponse, err error) { + response = CreateDisableTransitRouterRouteTablePropagationResponse() + err = client.DoAction(request, response) + return +} + +// DisableTransitRouterRouteTablePropagationWithChan invokes the cbn.DisableTransitRouterRouteTablePropagation API asynchronously +func (client *Client) DisableTransitRouterRouteTablePropagationWithChan(request *DisableTransitRouterRouteTablePropagationRequest) (<-chan *DisableTransitRouterRouteTablePropagationResponse, <-chan error) { + responseChan := make(chan *DisableTransitRouterRouteTablePropagationResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DisableTransitRouterRouteTablePropagation(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DisableTransitRouterRouteTablePropagationWithCallback invokes the cbn.DisableTransitRouterRouteTablePropagation API asynchronously +func (client *Client) DisableTransitRouterRouteTablePropagationWithCallback(request *DisableTransitRouterRouteTablePropagationRequest, callback func(response *DisableTransitRouterRouteTablePropagationResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DisableTransitRouterRouteTablePropagationResponse + var err error + defer close(result) + response, err = client.DisableTransitRouterRouteTablePropagation(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DisableTransitRouterRouteTablePropagationRequest is the request struct for api DisableTransitRouterRouteTablePropagation +type DisableTransitRouterRouteTablePropagationRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ClientToken string `position:"Query" name:"ClientToken"` + TransitRouterRouteTableId string `position:"Query" name:"TransitRouterRouteTableId"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + TransitRouterAttachmentId string `position:"Query" name:"TransitRouterAttachmentId"` +} + +// DisableTransitRouterRouteTablePropagationResponse is the response struct for api DisableTransitRouterRouteTablePropagation +type DisableTransitRouterRouteTablePropagationResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateDisableTransitRouterRouteTablePropagationRequest creates a request to invoke DisableTransitRouterRouteTablePropagation API +func CreateDisableTransitRouterRouteTablePropagationRequest() (request *DisableTransitRouterRouteTablePropagationRequest) { + request = &DisableTransitRouterRouteTablePropagationRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Cbn", "2017-09-12", "DisableTransitRouterRouteTablePropagation", "cbn", "openAPI") + request.Method = requests.POST + return +} + +// CreateDisableTransitRouterRouteTablePropagationResponse creates a response to parse from DisableTransitRouterRouteTablePropagation response +func CreateDisableTransitRouterRouteTablePropagationResponse() (response *DisableTransitRouterRouteTablePropagationResponse) { + response = &DisableTransitRouterRouteTablePropagationResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/dissociate_transit_router_attachment_from_route_table.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/dissociate_transit_router_attachment_from_route_table.go new file mode 100644 index 00000000000..5eaf2f18104 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/dissociate_transit_router_attachment_from_route_table.go @@ -0,0 +1,106 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DissociateTransitRouterAttachmentFromRouteTable invokes the cbn.DissociateTransitRouterAttachmentFromRouteTable API synchronously +func (client *Client) DissociateTransitRouterAttachmentFromRouteTable(request *DissociateTransitRouterAttachmentFromRouteTableRequest) (response *DissociateTransitRouterAttachmentFromRouteTableResponse, err error) { + response = CreateDissociateTransitRouterAttachmentFromRouteTableResponse() + err = client.DoAction(request, response) + return +} + +// DissociateTransitRouterAttachmentFromRouteTableWithChan invokes the cbn.DissociateTransitRouterAttachmentFromRouteTable API asynchronously +func (client *Client) DissociateTransitRouterAttachmentFromRouteTableWithChan(request *DissociateTransitRouterAttachmentFromRouteTableRequest) (<-chan *DissociateTransitRouterAttachmentFromRouteTableResponse, <-chan error) { + responseChan := make(chan *DissociateTransitRouterAttachmentFromRouteTableResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DissociateTransitRouterAttachmentFromRouteTable(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DissociateTransitRouterAttachmentFromRouteTableWithCallback invokes the cbn.DissociateTransitRouterAttachmentFromRouteTable API asynchronously +func (client *Client) DissociateTransitRouterAttachmentFromRouteTableWithCallback(request *DissociateTransitRouterAttachmentFromRouteTableRequest, callback func(response *DissociateTransitRouterAttachmentFromRouteTableResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DissociateTransitRouterAttachmentFromRouteTableResponse + var err error + defer close(result) + response, err = client.DissociateTransitRouterAttachmentFromRouteTable(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DissociateTransitRouterAttachmentFromRouteTableRequest is the request struct for api DissociateTransitRouterAttachmentFromRouteTable +type DissociateTransitRouterAttachmentFromRouteTableRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ClientToken string `position:"Query" name:"ClientToken"` + TransitRouterRouteTableId string `position:"Query" name:"TransitRouterRouteTableId"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + TransitRouterAttachmentId string `position:"Query" name:"TransitRouterAttachmentId"` +} + +// DissociateTransitRouterAttachmentFromRouteTableResponse is the response struct for api DissociateTransitRouterAttachmentFromRouteTable +type DissociateTransitRouterAttachmentFromRouteTableResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateDissociateTransitRouterAttachmentFromRouteTableRequest creates a request to invoke DissociateTransitRouterAttachmentFromRouteTable API +func CreateDissociateTransitRouterAttachmentFromRouteTableRequest() (request *DissociateTransitRouterAttachmentFromRouteTableRequest) { + request = &DissociateTransitRouterAttachmentFromRouteTableRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Cbn", "2017-09-12", "DissociateTransitRouterAttachmentFromRouteTable", "cbn", "openAPI") + request.Method = requests.POST + return +} + +// CreateDissociateTransitRouterAttachmentFromRouteTableResponse creates a response to parse from DissociateTransitRouterAttachmentFromRouteTable response +func CreateDissociateTransitRouterAttachmentFromRouteTableResponse() (response *DissociateTransitRouterAttachmentFromRouteTableResponse) { + response = &DissociateTransitRouterAttachmentFromRouteTableResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/enable_transit_router_route_table_propagation.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/enable_transit_router_route_table_propagation.go new file mode 100644 index 00000000000..85072013d0c --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/enable_transit_router_route_table_propagation.go @@ -0,0 +1,106 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// EnableTransitRouterRouteTablePropagation invokes the cbn.EnableTransitRouterRouteTablePropagation API synchronously +func (client *Client) EnableTransitRouterRouteTablePropagation(request *EnableTransitRouterRouteTablePropagationRequest) (response *EnableTransitRouterRouteTablePropagationResponse, err error) { + response = CreateEnableTransitRouterRouteTablePropagationResponse() + err = client.DoAction(request, response) + return +} + +// EnableTransitRouterRouteTablePropagationWithChan invokes the cbn.EnableTransitRouterRouteTablePropagation API asynchronously +func (client *Client) EnableTransitRouterRouteTablePropagationWithChan(request *EnableTransitRouterRouteTablePropagationRequest) (<-chan *EnableTransitRouterRouteTablePropagationResponse, <-chan error) { + responseChan := make(chan *EnableTransitRouterRouteTablePropagationResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.EnableTransitRouterRouteTablePropagation(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// EnableTransitRouterRouteTablePropagationWithCallback invokes the cbn.EnableTransitRouterRouteTablePropagation API asynchronously +func (client *Client) EnableTransitRouterRouteTablePropagationWithCallback(request *EnableTransitRouterRouteTablePropagationRequest, callback func(response *EnableTransitRouterRouteTablePropagationResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *EnableTransitRouterRouteTablePropagationResponse + var err error + defer close(result) + response, err = client.EnableTransitRouterRouteTablePropagation(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// EnableTransitRouterRouteTablePropagationRequest is the request struct for api EnableTransitRouterRouteTablePropagation +type EnableTransitRouterRouteTablePropagationRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ClientToken string `position:"Query" name:"ClientToken"` + TransitRouterRouteTableId string `position:"Query" name:"TransitRouterRouteTableId"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + TransitRouterAttachmentId string `position:"Query" name:"TransitRouterAttachmentId"` +} + +// EnableTransitRouterRouteTablePropagationResponse is the response struct for api EnableTransitRouterRouteTablePropagation +type EnableTransitRouterRouteTablePropagationResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateEnableTransitRouterRouteTablePropagationRequest creates a request to invoke EnableTransitRouterRouteTablePropagation API +func CreateEnableTransitRouterRouteTablePropagationRequest() (request *EnableTransitRouterRouteTablePropagationRequest) { + request = &EnableTransitRouterRouteTablePropagationRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Cbn", "2017-09-12", "EnableTransitRouterRouteTablePropagation", "cbn", "openAPI") + request.Method = requests.POST + return +} + +// CreateEnableTransitRouterRouteTablePropagationResponse creates a response to parse from EnableTransitRouterRouteTablePropagation response +func CreateEnableTransitRouterRouteTablePropagationResponse() (response *EnableTransitRouterRouteTablePropagationResponse) { + response = &EnableTransitRouterRouteTablePropagationResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/list_transit_router_available_resource.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/list_transit_router_available_resource.go new file mode 100644 index 00000000000..e48794026f9 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/list_transit_router_available_resource.go @@ -0,0 +1,106 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ListTransitRouterAvailableResource invokes the cbn.ListTransitRouterAvailableResource API synchronously +func (client *Client) ListTransitRouterAvailableResource(request *ListTransitRouterAvailableResourceRequest) (response *ListTransitRouterAvailableResourceResponse, err error) { + response = CreateListTransitRouterAvailableResourceResponse() + err = client.DoAction(request, response) + return +} + +// ListTransitRouterAvailableResourceWithChan invokes the cbn.ListTransitRouterAvailableResource API asynchronously +func (client *Client) ListTransitRouterAvailableResourceWithChan(request *ListTransitRouterAvailableResourceRequest) (<-chan *ListTransitRouterAvailableResourceResponse, <-chan error) { + responseChan := make(chan *ListTransitRouterAvailableResourceResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ListTransitRouterAvailableResource(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ListTransitRouterAvailableResourceWithCallback invokes the cbn.ListTransitRouterAvailableResource API asynchronously +func (client *Client) ListTransitRouterAvailableResourceWithCallback(request *ListTransitRouterAvailableResourceRequest, callback func(response *ListTransitRouterAvailableResourceResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ListTransitRouterAvailableResourceResponse + var err error + defer close(result) + response, err = client.ListTransitRouterAvailableResource(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ListTransitRouterAvailableResourceRequest is the request struct for api ListTransitRouterAvailableResource +type ListTransitRouterAvailableResourceRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` +} + +// ListTransitRouterAvailableResourceResponse is the response struct for api ListTransitRouterAvailableResource +type ListTransitRouterAvailableResourceResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + MasterZones []string `json:"MasterZones" xml:"MasterZones"` + SlaveZones []string `json:"SlaveZones" xml:"SlaveZones"` +} + +// CreateListTransitRouterAvailableResourceRequest creates a request to invoke ListTransitRouterAvailableResource API +func CreateListTransitRouterAvailableResourceRequest() (request *ListTransitRouterAvailableResourceRequest) { + request = &ListTransitRouterAvailableResourceRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Cbn", "2017-09-12", "ListTransitRouterAvailableResource", "cbn", "openAPI") + request.Method = requests.POST + return +} + +// CreateListTransitRouterAvailableResourceResponse creates a response to parse from ListTransitRouterAvailableResource response +func CreateListTransitRouterAvailableResourceResponse() (response *ListTransitRouterAvailableResourceResponse) { + response = &ListTransitRouterAvailableResourceResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/list_transit_router_peer_attachments.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/list_transit_router_peer_attachments.go new file mode 100644 index 00000000000..0f64eeaf401 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/list_transit_router_peer_attachments.go @@ -0,0 +1,112 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ListTransitRouterPeerAttachments invokes the cbn.ListTransitRouterPeerAttachments API synchronously +func (client *Client) ListTransitRouterPeerAttachments(request *ListTransitRouterPeerAttachmentsRequest) (response *ListTransitRouterPeerAttachmentsResponse, err error) { + response = CreateListTransitRouterPeerAttachmentsResponse() + err = client.DoAction(request, response) + return +} + +// ListTransitRouterPeerAttachmentsWithChan invokes the cbn.ListTransitRouterPeerAttachments API asynchronously +func (client *Client) ListTransitRouterPeerAttachmentsWithChan(request *ListTransitRouterPeerAttachmentsRequest) (<-chan *ListTransitRouterPeerAttachmentsResponse, <-chan error) { + responseChan := make(chan *ListTransitRouterPeerAttachmentsResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ListTransitRouterPeerAttachments(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ListTransitRouterPeerAttachmentsWithCallback invokes the cbn.ListTransitRouterPeerAttachments API asynchronously +func (client *Client) ListTransitRouterPeerAttachmentsWithCallback(request *ListTransitRouterPeerAttachmentsRequest, callback func(response *ListTransitRouterPeerAttachmentsResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ListTransitRouterPeerAttachmentsResponse + var err error + defer close(result) + response, err = client.ListTransitRouterPeerAttachments(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ListTransitRouterPeerAttachmentsRequest is the request struct for api ListTransitRouterPeerAttachments +type ListTransitRouterPeerAttachmentsRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + CenId string `position:"Query" name:"CenId"` + NextToken string `position:"Query" name:"NextToken"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + TransitRouterId string `position:"Query" name:"TransitRouterId"` + ResourceType string `position:"Query" name:"ResourceType"` + TransitRouterAttachmentId string `position:"Query" name:"TransitRouterAttachmentId"` + MaxResults requests.Integer `position:"Query" name:"MaxResults"` +} + +// ListTransitRouterPeerAttachmentsResponse is the response struct for api ListTransitRouterPeerAttachments +type ListTransitRouterPeerAttachmentsResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + MaxResults int `json:"MaxResults" xml:"MaxResults"` + NextToken string `json:"NextToken" xml:"NextToken"` + TransitRouterAttachments []TransitRouterAttachment `json:"TransitRouterAttachments" xml:"TransitRouterAttachments"` +} + +// CreateListTransitRouterPeerAttachmentsRequest creates a request to invoke ListTransitRouterPeerAttachments API +func CreateListTransitRouterPeerAttachmentsRequest() (request *ListTransitRouterPeerAttachmentsRequest) { + request = &ListTransitRouterPeerAttachmentsRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Cbn", "2017-09-12", "ListTransitRouterPeerAttachments", "cbn", "openAPI") + request.Method = requests.POST + return +} + +// CreateListTransitRouterPeerAttachmentsResponse creates a response to parse from ListTransitRouterPeerAttachments response +func CreateListTransitRouterPeerAttachmentsResponse() (response *ListTransitRouterPeerAttachmentsResponse) { + response = &ListTransitRouterPeerAttachmentsResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/list_transit_router_route_entries.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/list_transit_router_route_entries.go new file mode 100644 index 00000000000..fa06c47f7c6 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/list_transit_router_route_entries.go @@ -0,0 +1,113 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ListTransitRouterRouteEntries invokes the cbn.ListTransitRouterRouteEntries API synchronously +func (client *Client) ListTransitRouterRouteEntries(request *ListTransitRouterRouteEntriesRequest) (response *ListTransitRouterRouteEntriesResponse, err error) { + response = CreateListTransitRouterRouteEntriesResponse() + err = client.DoAction(request, response) + return +} + +// ListTransitRouterRouteEntriesWithChan invokes the cbn.ListTransitRouterRouteEntries API asynchronously +func (client *Client) ListTransitRouterRouteEntriesWithChan(request *ListTransitRouterRouteEntriesRequest) (<-chan *ListTransitRouterRouteEntriesResponse, <-chan error) { + responseChan := make(chan *ListTransitRouterRouteEntriesResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ListTransitRouterRouteEntries(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ListTransitRouterRouteEntriesWithCallback invokes the cbn.ListTransitRouterRouteEntries API asynchronously +func (client *Client) ListTransitRouterRouteEntriesWithCallback(request *ListTransitRouterRouteEntriesRequest, callback func(response *ListTransitRouterRouteEntriesResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ListTransitRouterRouteEntriesResponse + var err error + defer close(result) + response, err = client.ListTransitRouterRouteEntries(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ListTransitRouterRouteEntriesRequest is the request struct for api ListTransitRouterRouteEntries +type ListTransitRouterRouteEntriesRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + TransitRouterRouteEntryDestinationCidrBlock string `position:"Query" name:"TransitRouterRouteEntryDestinationCidrBlock"` + TransitRouterRouteTableId string `position:"Query" name:"TransitRouterRouteTableId"` + NextToken string `position:"Query" name:"NextToken"` + TransitRouterRouteEntryStatus string `position:"Query" name:"TransitRouterRouteEntryStatus"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + TransitRouterRouteEntryNames *[]string `position:"Query" name:"TransitRouterRouteEntryNames" type:"Repeated"` + TransitRouterRouteEntryIds *[]string `position:"Query" name:"TransitRouterRouteEntryIds" type:"Repeated"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + MaxResults requests.Integer `position:"Query" name:"MaxResults"` +} + +// ListTransitRouterRouteEntriesResponse is the response struct for api ListTransitRouterRouteEntries +type ListTransitRouterRouteEntriesResponse struct { + *responses.BaseResponse + MaxResults int `json:"MaxResults" xml:"MaxResults"` + NextToken string `json:"NextToken" xml:"NextToken"` + RequestId string `json:"RequestId" xml:"RequestId"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + TransitRouterRouteEntries []TransitRouterRouteEntry `json:"TransitRouterRouteEntries" xml:"TransitRouterRouteEntries"` +} + +// CreateListTransitRouterRouteEntriesRequest creates a request to invoke ListTransitRouterRouteEntries API +func CreateListTransitRouterRouteEntriesRequest() (request *ListTransitRouterRouteEntriesRequest) { + request = &ListTransitRouterRouteEntriesRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Cbn", "2017-09-12", "ListTransitRouterRouteEntries", "cbn", "openAPI") + request.Method = requests.POST + return +} + +// CreateListTransitRouterRouteEntriesResponse creates a response to parse from ListTransitRouterRouteEntries response +func CreateListTransitRouterRouteEntriesResponse() (response *ListTransitRouterRouteEntriesResponse) { + response = &ListTransitRouterRouteEntriesResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/list_transit_router_route_table_associations.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/list_transit_router_route_table_associations.go new file mode 100644 index 00000000000..3d8fe2eef94 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/list_transit_router_route_table_associations.go @@ -0,0 +1,111 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ListTransitRouterRouteTableAssociations invokes the cbn.ListTransitRouterRouteTableAssociations API synchronously +func (client *Client) ListTransitRouterRouteTableAssociations(request *ListTransitRouterRouteTableAssociationsRequest) (response *ListTransitRouterRouteTableAssociationsResponse, err error) { + response = CreateListTransitRouterRouteTableAssociationsResponse() + err = client.DoAction(request, response) + return +} + +// ListTransitRouterRouteTableAssociationsWithChan invokes the cbn.ListTransitRouterRouteTableAssociations API asynchronously +func (client *Client) ListTransitRouterRouteTableAssociationsWithChan(request *ListTransitRouterRouteTableAssociationsRequest) (<-chan *ListTransitRouterRouteTableAssociationsResponse, <-chan error) { + responseChan := make(chan *ListTransitRouterRouteTableAssociationsResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ListTransitRouterRouteTableAssociations(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ListTransitRouterRouteTableAssociationsWithCallback invokes the cbn.ListTransitRouterRouteTableAssociations API asynchronously +func (client *Client) ListTransitRouterRouteTableAssociationsWithCallback(request *ListTransitRouterRouteTableAssociationsRequest, callback func(response *ListTransitRouterRouteTableAssociationsResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ListTransitRouterRouteTableAssociationsResponse + var err error + defer close(result) + response, err = client.ListTransitRouterRouteTableAssociations(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ListTransitRouterRouteTableAssociationsRequest is the request struct for api ListTransitRouterRouteTableAssociations +type ListTransitRouterRouteTableAssociationsRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + TransitRouterRouteTableId string `position:"Query" name:"TransitRouterRouteTableId"` + NextToken string `position:"Query" name:"NextToken"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + TransitRouterAttachmentId string `position:"Query" name:"TransitRouterAttachmentId"` + MaxResults requests.Integer `position:"Query" name:"MaxResults"` + TransitRouterAttachmentIds *[]string `position:"Query" name:"TransitRouterAttachmentIds" type:"Repeated"` +} + +// ListTransitRouterRouteTableAssociationsResponse is the response struct for api ListTransitRouterRouteTableAssociations +type ListTransitRouterRouteTableAssociationsResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + MaxResults int `json:"MaxResults" xml:"MaxResults"` + NextToken string `json:"NextToken" xml:"NextToken"` + TransitRouterAssociations []TransitRouterAssociation `json:"TransitRouterAssociations" xml:"TransitRouterAssociations"` +} + +// CreateListTransitRouterRouteTableAssociationsRequest creates a request to invoke ListTransitRouterRouteTableAssociations API +func CreateListTransitRouterRouteTableAssociationsRequest() (request *ListTransitRouterRouteTableAssociationsRequest) { + request = &ListTransitRouterRouteTableAssociationsRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Cbn", "2017-09-12", "ListTransitRouterRouteTableAssociations", "cbn", "openAPI") + request.Method = requests.POST + return +} + +// CreateListTransitRouterRouteTableAssociationsResponse creates a response to parse from ListTransitRouterRouteTableAssociations response +func CreateListTransitRouterRouteTableAssociationsResponse() (response *ListTransitRouterRouteTableAssociationsResponse) { + response = &ListTransitRouterRouteTableAssociationsResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/list_transit_router_route_table_propagations.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/list_transit_router_route_table_propagations.go new file mode 100644 index 00000000000..942de6153c9 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/list_transit_router_route_table_propagations.go @@ -0,0 +1,111 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ListTransitRouterRouteTablePropagations invokes the cbn.ListTransitRouterRouteTablePropagations API synchronously +func (client *Client) ListTransitRouterRouteTablePropagations(request *ListTransitRouterRouteTablePropagationsRequest) (response *ListTransitRouterRouteTablePropagationsResponse, err error) { + response = CreateListTransitRouterRouteTablePropagationsResponse() + err = client.DoAction(request, response) + return +} + +// ListTransitRouterRouteTablePropagationsWithChan invokes the cbn.ListTransitRouterRouteTablePropagations API asynchronously +func (client *Client) ListTransitRouterRouteTablePropagationsWithChan(request *ListTransitRouterRouteTablePropagationsRequest) (<-chan *ListTransitRouterRouteTablePropagationsResponse, <-chan error) { + responseChan := make(chan *ListTransitRouterRouteTablePropagationsResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ListTransitRouterRouteTablePropagations(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ListTransitRouterRouteTablePropagationsWithCallback invokes the cbn.ListTransitRouterRouteTablePropagations API asynchronously +func (client *Client) ListTransitRouterRouteTablePropagationsWithCallback(request *ListTransitRouterRouteTablePropagationsRequest, callback func(response *ListTransitRouterRouteTablePropagationsResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ListTransitRouterRouteTablePropagationsResponse + var err error + defer close(result) + response, err = client.ListTransitRouterRouteTablePropagations(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ListTransitRouterRouteTablePropagationsRequest is the request struct for api ListTransitRouterRouteTablePropagations +type ListTransitRouterRouteTablePropagationsRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + TransitRouterRouteTableId string `position:"Query" name:"TransitRouterRouteTableId"` + NextToken string `position:"Query" name:"NextToken"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + TransitRouterAttachmentId string `position:"Query" name:"TransitRouterAttachmentId"` + MaxResults requests.Integer `position:"Query" name:"MaxResults"` + TransitRouterAttachmentIds *[]string `position:"Query" name:"TransitRouterAttachmentIds" type:"Repeated"` +} + +// ListTransitRouterRouteTablePropagationsResponse is the response struct for api ListTransitRouterRouteTablePropagations +type ListTransitRouterRouteTablePropagationsResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + MaxResults int `json:"MaxResults" xml:"MaxResults"` + NextToken string `json:"NextToken" xml:"NextToken"` + TransitRouterPropagations []TransitRouterPropagation `json:"TransitRouterPropagations" xml:"TransitRouterPropagations"` +} + +// CreateListTransitRouterRouteTablePropagationsRequest creates a request to invoke ListTransitRouterRouteTablePropagations API +func CreateListTransitRouterRouteTablePropagationsRequest() (request *ListTransitRouterRouteTablePropagationsRequest) { + request = &ListTransitRouterRouteTablePropagationsRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Cbn", "2017-09-12", "ListTransitRouterRouteTablePropagations", "cbn", "openAPI") + request.Method = requests.POST + return +} + +// CreateListTransitRouterRouteTablePropagationsResponse creates a response to parse from ListTransitRouterRouteTablePropagations response +func CreateListTransitRouterRouteTablePropagationsResponse() (response *ListTransitRouterRouteTablePropagationsResponse) { + response = &ListTransitRouterRouteTablePropagationsResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/list_transit_router_route_tables.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/list_transit_router_route_tables.go new file mode 100644 index 00000000000..d8c36cf6cb2 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/list_transit_router_route_tables.go @@ -0,0 +1,113 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ListTransitRouterRouteTables invokes the cbn.ListTransitRouterRouteTables API synchronously +func (client *Client) ListTransitRouterRouteTables(request *ListTransitRouterRouteTablesRequest) (response *ListTransitRouterRouteTablesResponse, err error) { + response = CreateListTransitRouterRouteTablesResponse() + err = client.DoAction(request, response) + return +} + +// ListTransitRouterRouteTablesWithChan invokes the cbn.ListTransitRouterRouteTables API asynchronously +func (client *Client) ListTransitRouterRouteTablesWithChan(request *ListTransitRouterRouteTablesRequest) (<-chan *ListTransitRouterRouteTablesResponse, <-chan error) { + responseChan := make(chan *ListTransitRouterRouteTablesResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ListTransitRouterRouteTables(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ListTransitRouterRouteTablesWithCallback invokes the cbn.ListTransitRouterRouteTables API asynchronously +func (client *Client) ListTransitRouterRouteTablesWithCallback(request *ListTransitRouterRouteTablesRequest, callback func(response *ListTransitRouterRouteTablesResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ListTransitRouterRouteTablesResponse + var err error + defer close(result) + response, err = client.ListTransitRouterRouteTables(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ListTransitRouterRouteTablesRequest is the request struct for api ListTransitRouterRouteTables +type ListTransitRouterRouteTablesRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + TransitRouterRouteTableNames *[]string `position:"Query" name:"TransitRouterRouteTableNames" type:"Repeated"` + TransitRouterRouteTableType string `position:"Query" name:"TransitRouterRouteTableType"` + TransitRouterRouteTableStatus string `position:"Query" name:"TransitRouterRouteTableStatus"` + TransitRouterRouteTableIds *[]string `position:"Query" name:"TransitRouterRouteTableIds" type:"Repeated"` + NextToken string `position:"Query" name:"NextToken"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + TransitRouterId string `position:"Query" name:"TransitRouterId"` + MaxResults requests.Integer `position:"Query" name:"MaxResults"` +} + +// ListTransitRouterRouteTablesResponse is the response struct for api ListTransitRouterRouteTables +type ListTransitRouterRouteTablesResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + MaxResults int `json:"MaxResults" xml:"MaxResults"` + NextToken string `json:"NextToken" xml:"NextToken"` + TransitRouterRouteTables []TransitRouterRouteTable `json:"TransitRouterRouteTables" xml:"TransitRouterRouteTables"` +} + +// CreateListTransitRouterRouteTablesRequest creates a request to invoke ListTransitRouterRouteTables API +func CreateListTransitRouterRouteTablesRequest() (request *ListTransitRouterRouteTablesRequest) { + request = &ListTransitRouterRouteTablesRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Cbn", "2017-09-12", "ListTransitRouterRouteTables", "cbn", "openAPI") + request.Method = requests.POST + return +} + +// CreateListTransitRouterRouteTablesResponse creates a response to parse from ListTransitRouterRouteTables response +func CreateListTransitRouterRouteTablesResponse() (response *ListTransitRouterRouteTablesResponse) { + response = &ListTransitRouterRouteTablesResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/list_transit_router_vbr_attachments.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/list_transit_router_vbr_attachments.go new file mode 100644 index 00000000000..0ef78ac1eda --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/list_transit_router_vbr_attachments.go @@ -0,0 +1,112 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ListTransitRouterVbrAttachments invokes the cbn.ListTransitRouterVbrAttachments API synchronously +func (client *Client) ListTransitRouterVbrAttachments(request *ListTransitRouterVbrAttachmentsRequest) (response *ListTransitRouterVbrAttachmentsResponse, err error) { + response = CreateListTransitRouterVbrAttachmentsResponse() + err = client.DoAction(request, response) + return +} + +// ListTransitRouterVbrAttachmentsWithChan invokes the cbn.ListTransitRouterVbrAttachments API asynchronously +func (client *Client) ListTransitRouterVbrAttachmentsWithChan(request *ListTransitRouterVbrAttachmentsRequest) (<-chan *ListTransitRouterVbrAttachmentsResponse, <-chan error) { + responseChan := make(chan *ListTransitRouterVbrAttachmentsResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ListTransitRouterVbrAttachments(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ListTransitRouterVbrAttachmentsWithCallback invokes the cbn.ListTransitRouterVbrAttachments API asynchronously +func (client *Client) ListTransitRouterVbrAttachmentsWithCallback(request *ListTransitRouterVbrAttachmentsRequest, callback func(response *ListTransitRouterVbrAttachmentsResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ListTransitRouterVbrAttachmentsResponse + var err error + defer close(result) + response, err = client.ListTransitRouterVbrAttachments(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ListTransitRouterVbrAttachmentsRequest is the request struct for api ListTransitRouterVbrAttachments +type ListTransitRouterVbrAttachmentsRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + CenId string `position:"Query" name:"CenId"` + NextToken string `position:"Query" name:"NextToken"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + TransitRouterId string `position:"Query" name:"TransitRouterId"` + ResourceType string `position:"Query" name:"ResourceType"` + TransitRouterAttachmentId string `position:"Query" name:"TransitRouterAttachmentId"` + MaxResults requests.Integer `position:"Query" name:"MaxResults"` +} + +// ListTransitRouterVbrAttachmentsResponse is the response struct for api ListTransitRouterVbrAttachments +type ListTransitRouterVbrAttachmentsResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + MaxResults int `json:"MaxResults" xml:"MaxResults"` + NextToken string `json:"NextToken" xml:"NextToken"` + TransitRouterAttachments []TransitRouterAttachment `json:"TransitRouterAttachments" xml:"TransitRouterAttachments"` +} + +// CreateListTransitRouterVbrAttachmentsRequest creates a request to invoke ListTransitRouterVbrAttachments API +func CreateListTransitRouterVbrAttachmentsRequest() (request *ListTransitRouterVbrAttachmentsRequest) { + request = &ListTransitRouterVbrAttachmentsRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Cbn", "2017-09-12", "ListTransitRouterVbrAttachments", "cbn", "openAPI") + request.Method = requests.POST + return +} + +// CreateListTransitRouterVbrAttachmentsResponse creates a response to parse from ListTransitRouterVbrAttachments response +func CreateListTransitRouterVbrAttachmentsResponse() (response *ListTransitRouterVbrAttachmentsResponse) { + response = &ListTransitRouterVbrAttachmentsResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/list_transit_router_vpc_attachments.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/list_transit_router_vpc_attachments.go new file mode 100644 index 00000000000..579b88d5a0a --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/list_transit_router_vpc_attachments.go @@ -0,0 +1,112 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ListTransitRouterVpcAttachments invokes the cbn.ListTransitRouterVpcAttachments API synchronously +func (client *Client) ListTransitRouterVpcAttachments(request *ListTransitRouterVpcAttachmentsRequest) (response *ListTransitRouterVpcAttachmentsResponse, err error) { + response = CreateListTransitRouterVpcAttachmentsResponse() + err = client.DoAction(request, response) + return +} + +// ListTransitRouterVpcAttachmentsWithChan invokes the cbn.ListTransitRouterVpcAttachments API asynchronously +func (client *Client) ListTransitRouterVpcAttachmentsWithChan(request *ListTransitRouterVpcAttachmentsRequest) (<-chan *ListTransitRouterVpcAttachmentsResponse, <-chan error) { + responseChan := make(chan *ListTransitRouterVpcAttachmentsResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ListTransitRouterVpcAttachments(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ListTransitRouterVpcAttachmentsWithCallback invokes the cbn.ListTransitRouterVpcAttachments API asynchronously +func (client *Client) ListTransitRouterVpcAttachmentsWithCallback(request *ListTransitRouterVpcAttachmentsRequest, callback func(response *ListTransitRouterVpcAttachmentsResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ListTransitRouterVpcAttachmentsResponse + var err error + defer close(result) + response, err = client.ListTransitRouterVpcAttachments(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ListTransitRouterVpcAttachmentsRequest is the request struct for api ListTransitRouterVpcAttachments +type ListTransitRouterVpcAttachmentsRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + CenId string `position:"Query" name:"CenId"` + NextToken string `position:"Query" name:"NextToken"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + TransitRouterId string `position:"Query" name:"TransitRouterId"` + ResourceType string `position:"Query" name:"ResourceType"` + TransitRouterAttachmentId string `position:"Query" name:"TransitRouterAttachmentId"` + MaxResults requests.Integer `position:"Query" name:"MaxResults"` +} + +// ListTransitRouterVpcAttachmentsResponse is the response struct for api ListTransitRouterVpcAttachments +type ListTransitRouterVpcAttachmentsResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + MaxResults int `json:"MaxResults" xml:"MaxResults"` + NextToken string `json:"NextToken" xml:"NextToken"` + TransitRouterAttachments []TransitRouterAttachment `json:"TransitRouterAttachments" xml:"TransitRouterAttachments"` +} + +// CreateListTransitRouterVpcAttachmentsRequest creates a request to invoke ListTransitRouterVpcAttachments API +func CreateListTransitRouterVpcAttachmentsRequest() (request *ListTransitRouterVpcAttachmentsRequest) { + request = &ListTransitRouterVpcAttachmentsRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Cbn", "2017-09-12", "ListTransitRouterVpcAttachments", "cbn", "openAPI") + request.Method = requests.POST + return +} + +// CreateListTransitRouterVpcAttachmentsResponse creates a response to parse from ListTransitRouterVpcAttachments response +func CreateListTransitRouterVpcAttachmentsResponse() (response *ListTransitRouterVpcAttachmentsResponse) { + response = &ListTransitRouterVpcAttachmentsResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/list_transit_routers.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/list_transit_routers.go new file mode 100644 index 00000000000..7984322f5c7 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/list_transit_routers.go @@ -0,0 +1,111 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ListTransitRouters invokes the cbn.ListTransitRouters API synchronously +func (client *Client) ListTransitRouters(request *ListTransitRoutersRequest) (response *ListTransitRoutersResponse, err error) { + response = CreateListTransitRoutersResponse() + err = client.DoAction(request, response) + return +} + +// ListTransitRoutersWithChan invokes the cbn.ListTransitRouters API asynchronously +func (client *Client) ListTransitRoutersWithChan(request *ListTransitRoutersRequest) (<-chan *ListTransitRoutersResponse, <-chan error) { + responseChan := make(chan *ListTransitRoutersResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ListTransitRouters(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ListTransitRoutersWithCallback invokes the cbn.ListTransitRouters API asynchronously +func (client *Client) ListTransitRoutersWithCallback(request *ListTransitRoutersRequest, callback func(response *ListTransitRoutersResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ListTransitRoutersResponse + var err error + defer close(result) + response, err = client.ListTransitRouters(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ListTransitRoutersRequest is the request struct for api ListTransitRouters +type ListTransitRoutersRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + CenId string `position:"Query" name:"CenId"` + TransitRouterIds *[]string `position:"Query" name:"TransitRouterIds" type:"Repeated"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + TransitRouterId string `position:"Query" name:"TransitRouterId"` +} + +// ListTransitRoutersResponse is the response struct for api ListTransitRouters +type ListTransitRoutersResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + PageNumber int `json:"PageNumber" xml:"PageNumber"` + PageSize int `json:"PageSize" xml:"PageSize"` + TransitRouters []TransitRouter `json:"TransitRouters" xml:"TransitRouters"` +} + +// CreateListTransitRoutersRequest creates a request to invoke ListTransitRouters API +func CreateListTransitRoutersRequest() (request *ListTransitRoutersRequest) { + request = &ListTransitRoutersRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Cbn", "2017-09-12", "ListTransitRouters", "cbn", "openAPI") + request.Method = requests.POST + return +} + +// CreateListTransitRoutersResponse creates a response to parse from ListTransitRouters response +func CreateListTransitRoutersResponse() (response *ListTransitRoutersResponse) { + response = &ListTransitRoutersResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_cen.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_cen.go index 31d521e7806..f743210065b 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_cen.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_cen.go @@ -24,6 +24,7 @@ type Cen struct { Status string `json:"Status" xml:"Status"` CreationTime string `json:"CreationTime" xml:"CreationTime"` Ipv6Level string `json:"Ipv6Level" xml:"Ipv6Level"` + ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` CenBandwidthPackageIds CenBandwidthPackageIds `json:"CenBandwidthPackageIds" xml:"CenBandwidthPackageIds"` Tags TagsInDescribeCens `json:"Tags" xml:"Tags"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_cen_bandwidth_package.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_cen_bandwidth_package.go index 66d40ef1971..3e08de61df4 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_cen_bandwidth_package.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_cen_bandwidth_package.go @@ -37,6 +37,7 @@ type CenBandwidthPackage struct { ReservationInternetChargeType string `json:"ReservationInternetChargeType" xml:"ReservationInternetChargeType"` ReservationActiveTime string `json:"ReservationActiveTime" xml:"ReservationActiveTime"` ReservationOrderType string `json:"ReservationOrderType" xml:"ReservationOrderType"` + ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` CenIds CenIds `json:"CenIds" xml:"CenIds"` OrginInterRegionBandwidthLimits OrginInterRegionBandwidthLimits `json:"OrginInterRegionBandwidthLimits" xml:"OrginInterRegionBandwidthLimits"` Tags TagsInDescribeCenBandwidthPackages `json:"Tags" xml:"Tags"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_master_zones.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_master_zones.go new file mode 100644 index 00000000000..0b51c64f57e --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_master_zones.go @@ -0,0 +1,21 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// MasterZones is a nested struct in cbn response +type MasterZones struct { + MasterZone []string `json:"MasterZone" xml:"MasterZone"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_route_map.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_route_map.go index 8595a3b9fdd..4c82ea9ae41 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_route_map.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_route_map.go @@ -35,6 +35,7 @@ type RouteMap struct { DestinationInstanceIdsReverseMatch bool `json:"DestinationInstanceIdsReverseMatch" xml:"DestinationInstanceIdsReverseMatch"` GatewayZoneId string `json:"GatewayZoneId" xml:"GatewayZoneId"` MatchAddressType string `json:"MatchAddressType" xml:"MatchAddressType"` + TransitRouterRouteTableId string `json:"TransitRouterRouteTableId" xml:"TransitRouterRouteTableId"` SourceInstanceIds SourceInstanceIds `json:"SourceInstanceIds" xml:"SourceInstanceIds"` DestinationInstanceIds DestinationInstanceIds `json:"DestinationInstanceIds" xml:"DestinationInstanceIds"` SourceRouteTableIds SourceRouteTableIds `json:"SourceRouteTableIds" xml:"SourceRouteTableIds"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_slave_zones.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_slave_zones.go similarity index 85% rename from vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_slave_zones.go rename to vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_slave_zones.go index a8fabf1059a..a9be4cc1165 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_slave_zones.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_slave_zones.go @@ -1,4 +1,4 @@ -package rds +package cbn //Licensed under the Apache License, Version 2.0 (the "License"); //you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ package rds // Code generated by Alibaba Cloud SDK Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// SlaveZones is a nested struct in rds response +// SlaveZones is a nested struct in cbn response type SlaveZones struct { - SlaveZone []SlaveZone `json:"SlaveZone" xml:"SlaveZone"` + SlaveZone []string `json:"SlaveZone" xml:"SlaveZone"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router.go new file mode 100644 index 00000000000..4e309eb5940 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router.go @@ -0,0 +1,29 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// TransitRouter is a nested struct in cbn response +type TransitRouter struct { + TransitRouterId string `json:"TransitRouterId" xml:"TransitRouterId"` + Status string `json:"Status" xml:"Status"` + CenId string `json:"CenId" xml:"CenId"` + RegionId string `json:"RegionId" xml:"RegionId"` + AliUid int64 `json:"AliUid" xml:"AliUid"` + Type string `json:"Type" xml:"Type"` + CreationTime string `json:"CreationTime" xml:"CreationTime"` + TransitRouterName string `json:"TransitRouterName" xml:"TransitRouterName"` + TransitRouterDescription string `json:"TransitRouterDescription" xml:"TransitRouterDescription"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_association.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_association.go new file mode 100644 index 00000000000..9b240bccbf2 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_association.go @@ -0,0 +1,25 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// TransitRouterAssociation is a nested struct in cbn response +type TransitRouterAssociation struct { + Status string `json:"Status" xml:"Status"` + TransitRouterAttachmentId string `json:"TransitRouterAttachmentId" xml:"TransitRouterAttachmentId"` + TransitRouterRouteTableId string `json:"TransitRouterRouteTableId" xml:"TransitRouterRouteTableId"` + ResourceId string `json:"ResourceId" xml:"ResourceId"` + ResourceType string `json:"ResourceType" xml:"ResourceType"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_associations.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_associations.go new file mode 100644 index 00000000000..79e23c2e156 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_associations.go @@ -0,0 +1,21 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// TransitRouterAssociations is a nested struct in cbn response +type TransitRouterAssociations struct { + TransitRouterAssociation []TransitRouterAssociation `json:"TransitRouterAssociation" xml:"TransitRouterAssociation"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_attachment.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_attachment.go new file mode 100644 index 00000000000..3d4ed331848 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_attachment.go @@ -0,0 +1,43 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// TransitRouterAttachment is a nested struct in cbn response +type TransitRouterAttachment struct { + PeerTransitRouterRegionId string `json:"PeerTransitRouterRegionId" xml:"PeerTransitRouterRegionId"` + PeerTransitRouterOwnerId int64 `json:"PeerTransitRouterOwnerId" xml:"PeerTransitRouterOwnerId"` + VbrRegionId string `json:"VbrRegionId" xml:"VbrRegionId"` + CreationTime string `json:"CreationTime" xml:"CreationTime"` + CenBandwidthPackageId string `json:"CenBandwidthPackageId" xml:"CenBandwidthPackageId"` + VbrOwnerId int64 `json:"VbrOwnerId" xml:"VbrOwnerId"` + AutoPublishRouteEnabled bool `json:"AutoPublishRouteEnabled" xml:"AutoPublishRouteEnabled"` + VpcOwnerId int64 `json:"VpcOwnerId" xml:"VpcOwnerId"` + VbrId string `json:"VbrId" xml:"VbrId"` + Bandwidth int `json:"Bandwidth" xml:"Bandwidth"` + ResourceType string `json:"ResourceType" xml:"ResourceType"` + RegionId string `json:"RegionId" xml:"RegionId"` + TransitRouterAttachmentId string `json:"TransitRouterAttachmentId" xml:"TransitRouterAttachmentId"` + GeographicSpanId string `json:"GeographicSpanId" xml:"GeographicSpanId"` + VpcRegionId string `json:"VpcRegionId" xml:"VpcRegionId"` + TransitRouterAttachmentDescription string `json:"TransitRouterAttachmentDescription" xml:"TransitRouterAttachmentDescription"` + BandwidthPackageId string `json:"BandwidthPackageId" xml:"BandwidthPackageId"` + TransitRouterId string `json:"TransitRouterId" xml:"TransitRouterId"` + TransitRouterAttachmentName string `json:"TransitRouterAttachmentName" xml:"TransitRouterAttachmentName"` + PeerTransitRouterId string `json:"PeerTransitRouterId" xml:"PeerTransitRouterId"` + Status string `json:"Status" xml:"Status"` + VpcId string `json:"VpcId" xml:"VpcId"` + ZoneMappings []ZoneMapping `json:"ZoneMappings" xml:"ZoneMappings"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_attachments_in_list_transit_router_peer_attachments.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_attachments_in_list_transit_router_peer_attachments.go new file mode 100644 index 00000000000..064a247ee4e --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_attachments_in_list_transit_router_peer_attachments.go @@ -0,0 +1,21 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// TransitRouterAttachmentsInListTransitRouterPeerAttachments is a nested struct in cbn response +type TransitRouterAttachmentsInListTransitRouterPeerAttachments struct { + TransitRouterAttachment []TransitRouterAttachment `json:"TransitRouterAttachment" xml:"TransitRouterAttachment"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_attachments_in_list_transit_router_vbr_attachments.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_attachments_in_list_transit_router_vbr_attachments.go new file mode 100644 index 00000000000..8b068e7d79f --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_attachments_in_list_transit_router_vbr_attachments.go @@ -0,0 +1,21 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// TransitRouterAttachmentsInListTransitRouterVbrAttachments is a nested struct in cbn response +type TransitRouterAttachmentsInListTransitRouterVbrAttachments struct { + TransitRouterAttachment []TransitRouterAttachment `json:"TransitRouterAttachment" xml:"TransitRouterAttachment"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_attachments_in_list_transit_router_vpc_attachments.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_attachments_in_list_transit_router_vpc_attachments.go new file mode 100644 index 00000000000..32f9f5ccc07 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_attachments_in_list_transit_router_vpc_attachments.go @@ -0,0 +1,21 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// TransitRouterAttachmentsInListTransitRouterVpcAttachments is a nested struct in cbn response +type TransitRouterAttachmentsInListTransitRouterVpcAttachments struct { + TransitRouterAttachment []TransitRouterAttachment `json:"TransitRouterAttachment" xml:"TransitRouterAttachment"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_propagation.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_propagation.go new file mode 100644 index 00000000000..05e4b48d77e --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_propagation.go @@ -0,0 +1,25 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// TransitRouterPropagation is a nested struct in cbn response +type TransitRouterPropagation struct { + Status string `json:"Status" xml:"Status"` + TransitRouterAttachmentId string `json:"TransitRouterAttachmentId" xml:"TransitRouterAttachmentId"` + TransitRouterRouteTableId string `json:"TransitRouterRouteTableId" xml:"TransitRouterRouteTableId"` + ResourceId string `json:"ResourceId" xml:"ResourceId"` + ResourceType string `json:"ResourceType" xml:"ResourceType"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_propagations.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_propagations.go new file mode 100644 index 00000000000..69136127a2a --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_propagations.go @@ -0,0 +1,21 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// TransitRouterPropagations is a nested struct in cbn response +type TransitRouterPropagations struct { + TransitRouterPropagation []TransitRouterPropagation `json:"TransitRouterPropagation" xml:"TransitRouterPropagation"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_route_entries.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_route_entries.go new file mode 100644 index 00000000000..f426d089704 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_route_entries.go @@ -0,0 +1,21 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// TransitRouterRouteEntries is a nested struct in cbn response +type TransitRouterRouteEntries struct { + TransitRouterRouteEntry []TransitRouterRouteEntry `json:"TransitRouterRouteEntry" xml:"TransitRouterRouteEntry"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_route_entry.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_route_entry.go new file mode 100644 index 00000000000..58ab5c0a6da --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_route_entry.go @@ -0,0 +1,29 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// TransitRouterRouteEntry is a nested struct in cbn response +type TransitRouterRouteEntry struct { + TransitRouterRouteEntryDescription string `json:"TransitRouterRouteEntryDescription" xml:"TransitRouterRouteEntryDescription"` + TransitRouterRouteEntryDestinationCidrBlock string `json:"TransitRouterRouteEntryDestinationCidrBlock" xml:"TransitRouterRouteEntryDestinationCidrBlock"` + TransitRouterRouteEntryId string `json:"TransitRouterRouteEntryId" xml:"TransitRouterRouteEntryId"` + TransitRouterRouteEntryName string `json:"TransitRouterRouteEntryName" xml:"TransitRouterRouteEntryName"` + TransitRouterRouteEntryNextHopId string `json:"TransitRouterRouteEntryNextHopId" xml:"TransitRouterRouteEntryNextHopId"` + TransitRouterRouteEntryNextHopType string `json:"TransitRouterRouteEntryNextHopType" xml:"TransitRouterRouteEntryNextHopType"` + TransitRouterRouteEntryStatus string `json:"TransitRouterRouteEntryStatus" xml:"TransitRouterRouteEntryStatus"` + TransitRouterRouteEntryType string `json:"TransitRouterRouteEntryType" xml:"TransitRouterRouteEntryType"` + CreateTime string `json:"CreateTime" xml:"CreateTime"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_route_table.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_route_table.go new file mode 100644 index 00000000000..76baef98b51 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_route_table.go @@ -0,0 +1,26 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// TransitRouterRouteTable is a nested struct in cbn response +type TransitRouterRouteTable struct { + TransitRouterRouteTableStatus string `json:"TransitRouterRouteTableStatus" xml:"TransitRouterRouteTableStatus"` + TransitRouterRouteTableName string `json:"TransitRouterRouteTableName" xml:"TransitRouterRouteTableName"` + TransitRouterRouteTableId string `json:"TransitRouterRouteTableId" xml:"TransitRouterRouteTableId"` + TransitRouterRouteTableDescription string `json:"TransitRouterRouteTableDescription" xml:"TransitRouterRouteTableDescription"` + TransitRouterRouteTableType string `json:"TransitRouterRouteTableType" xml:"TransitRouterRouteTableType"` + CreateTime string `json:"CreateTime" xml:"CreateTime"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_route_tables.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_route_tables.go new file mode 100644 index 00000000000..d0057a2d59e --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_router_route_tables.go @@ -0,0 +1,21 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// TransitRouterRouteTables is a nested struct in cbn response +type TransitRouterRouteTables struct { + TransitRouterRouteTable []TransitRouterRouteTable `json:"TransitRouterRouteTable" xml:"TransitRouterRouteTable"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_routers.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_routers.go new file mode 100644 index 00000000000..16ea9f00b38 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_transit_routers.go @@ -0,0 +1,21 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// TransitRouters is a nested struct in cbn response +type TransitRouters struct { + TransitRouter []TransitRouter `json:"TransitRouter" xml:"TransitRouter"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_zone_mapping.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_zone_mapping.go new file mode 100644 index 00000000000..1a7a08bd88f --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_zone_mapping.go @@ -0,0 +1,22 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ZoneMapping is a nested struct in cbn response +type ZoneMapping struct { + ZoneId string `json:"ZoneId" xml:"ZoneId"` + VSwitchId string `json:"VSwitchId" xml:"VSwitchId"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_zone_mappings.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_zone_mappings.go new file mode 100644 index 00000000000..0d12f47e555 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/struct_zone_mappings.go @@ -0,0 +1,21 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ZoneMappings is a nested struct in cbn response +type ZoneMappings struct { + ZoneMapping []ZoneMapping `json:"ZoneMapping" xml:"ZoneMapping"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/update_transit_router.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/update_transit_router.go new file mode 100644 index 00000000000..c5f13f23c88 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/update_transit_router.go @@ -0,0 +1,107 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// UpdateTransitRouter invokes the cbn.UpdateTransitRouter API synchronously +func (client *Client) UpdateTransitRouter(request *UpdateTransitRouterRequest) (response *UpdateTransitRouterResponse, err error) { + response = CreateUpdateTransitRouterResponse() + err = client.DoAction(request, response) + return +} + +// UpdateTransitRouterWithChan invokes the cbn.UpdateTransitRouter API asynchronously +func (client *Client) UpdateTransitRouterWithChan(request *UpdateTransitRouterRequest) (<-chan *UpdateTransitRouterResponse, <-chan error) { + responseChan := make(chan *UpdateTransitRouterResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.UpdateTransitRouter(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// UpdateTransitRouterWithCallback invokes the cbn.UpdateTransitRouter API asynchronously +func (client *Client) UpdateTransitRouterWithCallback(request *UpdateTransitRouterRequest, callback func(response *UpdateTransitRouterResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *UpdateTransitRouterResponse + var err error + defer close(result) + response, err = client.UpdateTransitRouter(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// UpdateTransitRouterRequest is the request struct for api UpdateTransitRouter +type UpdateTransitRouterRequest struct { + *requests.RpcRequest + TransitRouterName string `position:"Query" name:"TransitRouterName"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ClientToken string `position:"Query" name:"ClientToken"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + TransitRouterId string `position:"Query" name:"TransitRouterId"` + TransitRouterDescription string `position:"Query" name:"TransitRouterDescription"` +} + +// UpdateTransitRouterResponse is the response struct for api UpdateTransitRouter +type UpdateTransitRouterResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateUpdateTransitRouterRequest creates a request to invoke UpdateTransitRouter API +func CreateUpdateTransitRouterRequest() (request *UpdateTransitRouterRequest) { + request = &UpdateTransitRouterRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Cbn", "2017-09-12", "UpdateTransitRouter", "cbn", "openAPI") + request.Method = requests.POST + return +} + +// CreateUpdateTransitRouterResponse creates a response to parse from UpdateTransitRouter response +func CreateUpdateTransitRouterResponse() (response *UpdateTransitRouterResponse) { + response = &UpdateTransitRouterResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/update_transit_router_peer_attachment_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/update_transit_router_peer_attachment_attribute.go new file mode 100644 index 00000000000..7ad79f531d6 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/update_transit_router_peer_attachment_attribute.go @@ -0,0 +1,111 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// UpdateTransitRouterPeerAttachmentAttribute invokes the cbn.UpdateTransitRouterPeerAttachmentAttribute API synchronously +func (client *Client) UpdateTransitRouterPeerAttachmentAttribute(request *UpdateTransitRouterPeerAttachmentAttributeRequest) (response *UpdateTransitRouterPeerAttachmentAttributeResponse, err error) { + response = CreateUpdateTransitRouterPeerAttachmentAttributeResponse() + err = client.DoAction(request, response) + return +} + +// UpdateTransitRouterPeerAttachmentAttributeWithChan invokes the cbn.UpdateTransitRouterPeerAttachmentAttribute API asynchronously +func (client *Client) UpdateTransitRouterPeerAttachmentAttributeWithChan(request *UpdateTransitRouterPeerAttachmentAttributeRequest) (<-chan *UpdateTransitRouterPeerAttachmentAttributeResponse, <-chan error) { + responseChan := make(chan *UpdateTransitRouterPeerAttachmentAttributeResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.UpdateTransitRouterPeerAttachmentAttribute(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// UpdateTransitRouterPeerAttachmentAttributeWithCallback invokes the cbn.UpdateTransitRouterPeerAttachmentAttribute API asynchronously +func (client *Client) UpdateTransitRouterPeerAttachmentAttributeWithCallback(request *UpdateTransitRouterPeerAttachmentAttributeRequest, callback func(response *UpdateTransitRouterPeerAttachmentAttributeResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *UpdateTransitRouterPeerAttachmentAttributeResponse + var err error + defer close(result) + response, err = client.UpdateTransitRouterPeerAttachmentAttribute(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// UpdateTransitRouterPeerAttachmentAttributeRequest is the request struct for api UpdateTransitRouterPeerAttachmentAttribute +type UpdateTransitRouterPeerAttachmentAttributeRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ClientToken string `position:"Query" name:"ClientToken"` + TransitRouterAttachmentName string `position:"Query" name:"TransitRouterAttachmentName"` + AutoPublishRouteEnabled requests.Boolean `position:"Query" name:"AutoPublishRouteEnabled"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + Bandwidth requests.Integer `position:"Query" name:"Bandwidth"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + ResourceType string `position:"Query" name:"ResourceType"` + TransitRouterAttachmentId string `position:"Query" name:"TransitRouterAttachmentId"` + TransitRouterAttachmentDescription string `position:"Query" name:"TransitRouterAttachmentDescription"` + CenBandwidthPackageId string `position:"Query" name:"CenBandwidthPackageId"` +} + +// UpdateTransitRouterPeerAttachmentAttributeResponse is the response struct for api UpdateTransitRouterPeerAttachmentAttribute +type UpdateTransitRouterPeerAttachmentAttributeResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateUpdateTransitRouterPeerAttachmentAttributeRequest creates a request to invoke UpdateTransitRouterPeerAttachmentAttribute API +func CreateUpdateTransitRouterPeerAttachmentAttributeRequest() (request *UpdateTransitRouterPeerAttachmentAttributeRequest) { + request = &UpdateTransitRouterPeerAttachmentAttributeRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Cbn", "2017-09-12", "UpdateTransitRouterPeerAttachmentAttribute", "cbn", "openAPI") + request.Method = requests.POST + return +} + +// CreateUpdateTransitRouterPeerAttachmentAttributeResponse creates a response to parse from UpdateTransitRouterPeerAttachmentAttribute response +func CreateUpdateTransitRouterPeerAttachmentAttributeResponse() (response *UpdateTransitRouterPeerAttachmentAttributeResponse) { + response = &UpdateTransitRouterPeerAttachmentAttributeResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/update_transit_router_route_entry.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/update_transit_router_route_entry.go new file mode 100644 index 00000000000..79c0bbee1cf --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/update_transit_router_route_entry.go @@ -0,0 +1,107 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// UpdateTransitRouterRouteEntry invokes the cbn.UpdateTransitRouterRouteEntry API synchronously +func (client *Client) UpdateTransitRouterRouteEntry(request *UpdateTransitRouterRouteEntryRequest) (response *UpdateTransitRouterRouteEntryResponse, err error) { + response = CreateUpdateTransitRouterRouteEntryResponse() + err = client.DoAction(request, response) + return +} + +// UpdateTransitRouterRouteEntryWithChan invokes the cbn.UpdateTransitRouterRouteEntry API asynchronously +func (client *Client) UpdateTransitRouterRouteEntryWithChan(request *UpdateTransitRouterRouteEntryRequest) (<-chan *UpdateTransitRouterRouteEntryResponse, <-chan error) { + responseChan := make(chan *UpdateTransitRouterRouteEntryResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.UpdateTransitRouterRouteEntry(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// UpdateTransitRouterRouteEntryWithCallback invokes the cbn.UpdateTransitRouterRouteEntry API asynchronously +func (client *Client) UpdateTransitRouterRouteEntryWithCallback(request *UpdateTransitRouterRouteEntryRequest, callback func(response *UpdateTransitRouterRouteEntryResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *UpdateTransitRouterRouteEntryResponse + var err error + defer close(result) + response, err = client.UpdateTransitRouterRouteEntry(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// UpdateTransitRouterRouteEntryRequest is the request struct for api UpdateTransitRouterRouteEntry +type UpdateTransitRouterRouteEntryRequest struct { + *requests.RpcRequest + TransitRouterRouteEntryId string `position:"Query" name:"TransitRouterRouteEntryId"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ClientToken string `position:"Query" name:"ClientToken"` + TransitRouterRouteEntryDescription string `position:"Query" name:"TransitRouterRouteEntryDescription"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + TransitRouterRouteEntryName string `position:"Query" name:"TransitRouterRouteEntryName"` +} + +// UpdateTransitRouterRouteEntryResponse is the response struct for api UpdateTransitRouterRouteEntry +type UpdateTransitRouterRouteEntryResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateUpdateTransitRouterRouteEntryRequest creates a request to invoke UpdateTransitRouterRouteEntry API +func CreateUpdateTransitRouterRouteEntryRequest() (request *UpdateTransitRouterRouteEntryRequest) { + request = &UpdateTransitRouterRouteEntryRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Cbn", "2017-09-12", "UpdateTransitRouterRouteEntry", "cbn", "openAPI") + request.Method = requests.POST + return +} + +// CreateUpdateTransitRouterRouteEntryResponse creates a response to parse from UpdateTransitRouterRouteEntry response +func CreateUpdateTransitRouterRouteEntryResponse() (response *UpdateTransitRouterRouteEntryResponse) { + response = &UpdateTransitRouterRouteEntryResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/update_transit_router_route_table.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/update_transit_router_route_table.go new file mode 100644 index 00000000000..4e3dbc81199 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/update_transit_router_route_table.go @@ -0,0 +1,107 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// UpdateTransitRouterRouteTable invokes the cbn.UpdateTransitRouterRouteTable API synchronously +func (client *Client) UpdateTransitRouterRouteTable(request *UpdateTransitRouterRouteTableRequest) (response *UpdateTransitRouterRouteTableResponse, err error) { + response = CreateUpdateTransitRouterRouteTableResponse() + err = client.DoAction(request, response) + return +} + +// UpdateTransitRouterRouteTableWithChan invokes the cbn.UpdateTransitRouterRouteTable API asynchronously +func (client *Client) UpdateTransitRouterRouteTableWithChan(request *UpdateTransitRouterRouteTableRequest) (<-chan *UpdateTransitRouterRouteTableResponse, <-chan error) { + responseChan := make(chan *UpdateTransitRouterRouteTableResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.UpdateTransitRouterRouteTable(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// UpdateTransitRouterRouteTableWithCallback invokes the cbn.UpdateTransitRouterRouteTable API asynchronously +func (client *Client) UpdateTransitRouterRouteTableWithCallback(request *UpdateTransitRouterRouteTableRequest, callback func(response *UpdateTransitRouterRouteTableResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *UpdateTransitRouterRouteTableResponse + var err error + defer close(result) + response, err = client.UpdateTransitRouterRouteTable(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// UpdateTransitRouterRouteTableRequest is the request struct for api UpdateTransitRouterRouteTable +type UpdateTransitRouterRouteTableRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ClientToken string `position:"Query" name:"ClientToken"` + TransitRouterRouteTableId string `position:"Query" name:"TransitRouterRouteTableId"` + TransitRouterRouteTableDescription string `position:"Query" name:"TransitRouterRouteTableDescription"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + TransitRouterRouteTableName string `position:"Query" name:"TransitRouterRouteTableName"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` +} + +// UpdateTransitRouterRouteTableResponse is the response struct for api UpdateTransitRouterRouteTable +type UpdateTransitRouterRouteTableResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateUpdateTransitRouterRouteTableRequest creates a request to invoke UpdateTransitRouterRouteTable API +func CreateUpdateTransitRouterRouteTableRequest() (request *UpdateTransitRouterRouteTableRequest) { + request = &UpdateTransitRouterRouteTableRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Cbn", "2017-09-12", "UpdateTransitRouterRouteTable", "cbn", "openAPI") + request.Method = requests.POST + return +} + +// CreateUpdateTransitRouterRouteTableResponse creates a response to parse from UpdateTransitRouterRouteTable response +func CreateUpdateTransitRouterRouteTableResponse() (response *UpdateTransitRouterRouteTableResponse) { + response = &UpdateTransitRouterRouteTableResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/update_transit_router_vbr_attachment_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/update_transit_router_vbr_attachment_attribute.go new file mode 100644 index 00000000000..fcae55e3dde --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/update_transit_router_vbr_attachment_attribute.go @@ -0,0 +1,109 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// UpdateTransitRouterVbrAttachmentAttribute invokes the cbn.UpdateTransitRouterVbrAttachmentAttribute API synchronously +func (client *Client) UpdateTransitRouterVbrAttachmentAttribute(request *UpdateTransitRouterVbrAttachmentAttributeRequest) (response *UpdateTransitRouterVbrAttachmentAttributeResponse, err error) { + response = CreateUpdateTransitRouterVbrAttachmentAttributeResponse() + err = client.DoAction(request, response) + return +} + +// UpdateTransitRouterVbrAttachmentAttributeWithChan invokes the cbn.UpdateTransitRouterVbrAttachmentAttribute API asynchronously +func (client *Client) UpdateTransitRouterVbrAttachmentAttributeWithChan(request *UpdateTransitRouterVbrAttachmentAttributeRequest) (<-chan *UpdateTransitRouterVbrAttachmentAttributeResponse, <-chan error) { + responseChan := make(chan *UpdateTransitRouterVbrAttachmentAttributeResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.UpdateTransitRouterVbrAttachmentAttribute(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// UpdateTransitRouterVbrAttachmentAttributeWithCallback invokes the cbn.UpdateTransitRouterVbrAttachmentAttribute API asynchronously +func (client *Client) UpdateTransitRouterVbrAttachmentAttributeWithCallback(request *UpdateTransitRouterVbrAttachmentAttributeRequest, callback func(response *UpdateTransitRouterVbrAttachmentAttributeResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *UpdateTransitRouterVbrAttachmentAttributeResponse + var err error + defer close(result) + response, err = client.UpdateTransitRouterVbrAttachmentAttribute(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// UpdateTransitRouterVbrAttachmentAttributeRequest is the request struct for api UpdateTransitRouterVbrAttachmentAttribute +type UpdateTransitRouterVbrAttachmentAttributeRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ClientToken string `position:"Query" name:"ClientToken"` + TransitRouterAttachmentName string `position:"Query" name:"TransitRouterAttachmentName"` + AutoPublishRouteEnabled requests.Boolean `position:"Query" name:"AutoPublishRouteEnabled"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + ResourceType string `position:"Query" name:"ResourceType"` + TransitRouterAttachmentId string `position:"Query" name:"TransitRouterAttachmentId"` + TransitRouterAttachmentDescription string `position:"Query" name:"TransitRouterAttachmentDescription"` +} + +// UpdateTransitRouterVbrAttachmentAttributeResponse is the response struct for api UpdateTransitRouterVbrAttachmentAttribute +type UpdateTransitRouterVbrAttachmentAttributeResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateUpdateTransitRouterVbrAttachmentAttributeRequest creates a request to invoke UpdateTransitRouterVbrAttachmentAttribute API +func CreateUpdateTransitRouterVbrAttachmentAttributeRequest() (request *UpdateTransitRouterVbrAttachmentAttributeRequest) { + request = &UpdateTransitRouterVbrAttachmentAttributeRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Cbn", "2017-09-12", "UpdateTransitRouterVbrAttachmentAttribute", "cbn", "openAPI") + request.Method = requests.POST + return +} + +// CreateUpdateTransitRouterVbrAttachmentAttributeResponse creates a response to parse from UpdateTransitRouterVbrAttachmentAttribute response +func CreateUpdateTransitRouterVbrAttachmentAttributeResponse() (response *UpdateTransitRouterVbrAttachmentAttributeResponse) { + response = &UpdateTransitRouterVbrAttachmentAttributeResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/update_transit_router_vpc_attachment_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/update_transit_router_vpc_attachment_attribute.go new file mode 100644 index 00000000000..b712b15a29a --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cbn/update_transit_router_vpc_attachment_attribute.go @@ -0,0 +1,108 @@ +package cbn + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// UpdateTransitRouterVpcAttachmentAttribute invokes the cbn.UpdateTransitRouterVpcAttachmentAttribute API synchronously +func (client *Client) UpdateTransitRouterVpcAttachmentAttribute(request *UpdateTransitRouterVpcAttachmentAttributeRequest) (response *UpdateTransitRouterVpcAttachmentAttributeResponse, err error) { + response = CreateUpdateTransitRouterVpcAttachmentAttributeResponse() + err = client.DoAction(request, response) + return +} + +// UpdateTransitRouterVpcAttachmentAttributeWithChan invokes the cbn.UpdateTransitRouterVpcAttachmentAttribute API asynchronously +func (client *Client) UpdateTransitRouterVpcAttachmentAttributeWithChan(request *UpdateTransitRouterVpcAttachmentAttributeRequest) (<-chan *UpdateTransitRouterVpcAttachmentAttributeResponse, <-chan error) { + responseChan := make(chan *UpdateTransitRouterVpcAttachmentAttributeResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.UpdateTransitRouterVpcAttachmentAttribute(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// UpdateTransitRouterVpcAttachmentAttributeWithCallback invokes the cbn.UpdateTransitRouterVpcAttachmentAttribute API asynchronously +func (client *Client) UpdateTransitRouterVpcAttachmentAttributeWithCallback(request *UpdateTransitRouterVpcAttachmentAttributeRequest, callback func(response *UpdateTransitRouterVpcAttachmentAttributeResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *UpdateTransitRouterVpcAttachmentAttributeResponse + var err error + defer close(result) + response, err = client.UpdateTransitRouterVpcAttachmentAttribute(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// UpdateTransitRouterVpcAttachmentAttributeRequest is the request struct for api UpdateTransitRouterVpcAttachmentAttribute +type UpdateTransitRouterVpcAttachmentAttributeRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ClientToken string `position:"Query" name:"ClientToken"` + TransitRouterAttachmentName string `position:"Query" name:"TransitRouterAttachmentName"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + ResourceType string `position:"Query" name:"ResourceType"` + TransitRouterAttachmentId string `position:"Query" name:"TransitRouterAttachmentId"` + TransitRouterAttachmentDescription string `position:"Query" name:"TransitRouterAttachmentDescription"` +} + +// UpdateTransitRouterVpcAttachmentAttributeResponse is the response struct for api UpdateTransitRouterVpcAttachmentAttribute +type UpdateTransitRouterVpcAttachmentAttributeResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateUpdateTransitRouterVpcAttachmentAttributeRequest creates a request to invoke UpdateTransitRouterVpcAttachmentAttribute API +func CreateUpdateTransitRouterVpcAttachmentAttributeRequest() (request *UpdateTransitRouterVpcAttachmentAttributeRequest) { + request = &UpdateTransitRouterVpcAttachmentAttributeRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Cbn", "2017-09-12", "UpdateTransitRouterVpcAttachmentAttribute", "cbn", "openAPI") + request.Method = requests.POST + return +} + +// CreateUpdateTransitRouterVpcAttachmentAttributeResponse creates a response to parse from UpdateTransitRouterVpcAttachmentAttribute response +func CreateUpdateTransitRouterVpcAttachmentAttributeResponse() (response *UpdateTransitRouterVpcAttachmentAttributeResponse) { + response = &UpdateTransitRouterVpcAttachmentAttributeResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/create_dynamic_tag_group.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/create_dynamic_tag_group.go index f498c202ae0..ecf1129abb9 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/create_dynamic_tag_group.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/create_dynamic_tag_group.go @@ -78,6 +78,7 @@ type CreateDynamicTagGroupRequest struct { ContactGroupList *[]string `position:"Query" name:"ContactGroupList" type:"Repeated"` TemplateIdList *[]string `position:"Query" name:"TemplateIdList" type:"Repeated"` TagKey string `position:"Query" name:"TagKey"` + TagRegionId string `position:"Query" name:"TagRegionId"` } // CreateDynamicTagGroupMatchExpress is a repeated param struct in CreateDynamicTagGroupRequest diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/describe_alerting_metric_rule_resources.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/describe_alerting_metric_rule_resources.go index 04b861d81a7..2451d976dc3 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/describe_alerting_metric_rule_resources.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/describe_alerting_metric_rule_resources.go @@ -71,11 +71,12 @@ func (client *Client) DescribeAlertingMetricRuleResourcesWithCallback(request *D // DescribeAlertingMetricRuleResourcesRequest is the request struct for api DescribeAlertingMetricRuleResources type DescribeAlertingMetricRuleResourcesRequest struct { *requests.RpcRequest - GroupId string `position:"Query" name:"GroupId"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - Namespace string `position:"Query" name:"Namespace"` - Page requests.Integer `position:"Query" name:"Page"` - RuleId string `position:"Query" name:"RuleId"` + GroupId string `position:"Query" name:"GroupId"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + Namespace string `position:"Query" name:"Namespace"` + Page requests.Integer `position:"Query" name:"Page"` + RuleId string `position:"Query" name:"RuleId"` + Dimensions string `position:"Query" name:"Dimensions"` } // DescribeAlertingMetricRuleResourcesResponse is the response struct for api DescribeAlertingMetricRuleResources diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/describe_dynamic_tag_rule_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/describe_dynamic_tag_rule_list.go index 10a299daa68..9f5fe45c397 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/describe_dynamic_tag_rule_list.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/describe_dynamic_tag_rule_list.go @@ -71,9 +71,11 @@ func (client *Client) DescribeDynamicTagRuleListWithCallback(request *DescribeDy // DescribeDynamicTagRuleListRequest is the request struct for api DescribeDynamicTagRuleList type DescribeDynamicTagRuleListRequest struct { *requests.RpcRequest - PageNumber string `position:"Query" name:"PageNumber"` - PageSize string `position:"Query" name:"PageSize"` - TagKey string `position:"Query" name:"TagKey"` + TagValue string `position:"Query" name:"TagValue"` + PageNumber string `position:"Query" name:"PageNumber"` + PageSize string `position:"Query" name:"PageSize"` + TagKey string `position:"Query" name:"TagKey"` + TagRegionId string `position:"Query" name:"TagRegionId"` } // DescribeDynamicTagRuleListResponse is the response struct for api DescribeDynamicTagRuleList diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/describe_monitor_groups.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/describe_monitor_groups.go index 83d44951918..66b2456469d 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/describe_monitor_groups.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/describe_monitor_groups.go @@ -77,8 +77,10 @@ type DescribeMonitorGroupsRequest struct { Type string `position:"Query" name:"Type"` PageNumber requests.Integer `position:"Query" name:"PageNumber"` ResourceGroupId string `position:"Query" name:"ResourceGroupId"` + GroupFounderTagKey string `position:"Query" name:"GroupFounderTagKey"` PageSize requests.Integer `position:"Query" name:"PageSize"` Tag *[]DescribeMonitorGroupsTag `position:"Query" name:"Tag" type:"Repeated"` + GroupFounderTagValue string `position:"Query" name:"GroupFounderTagValue"` Keyword string `position:"Query" name:"Keyword"` GroupId string `position:"Query" name:"GroupId"` GroupName string `position:"Query" name:"GroupName"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/struct_alarm_in_describe_alert_log_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/struct_alarm_in_describe_alert_log_list.go index 0e2a00d2923..d893981d766 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/struct_alarm_in_describe_alert_log_list.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/struct_alarm_in_describe_alert_log_list.go @@ -17,30 +17,33 @@ package cms // AlarmInDescribeAlertLogList is a nested struct in cms response type AlarmInDescribeAlertLogList struct { - RuleId string `json:"RuleId" xml:"RuleId"` - RuleName string `json:"RuleName" xml:"RuleName"` - Namespace string `json:"Namespace" xml:"Namespace"` - Product string `json:"Product" xml:"Product"` - EventName string `json:"EventName" xml:"EventName"` - GroupId string `json:"GroupId" xml:"GroupId"` - GroupName string `json:"GroupName" xml:"GroupName"` - MetricName string `json:"MetricName" xml:"MetricName"` - InstanceId string `json:"InstanceId" xml:"InstanceId"` - InstanceName string `json:"InstanceName" xml:"InstanceName"` - Level string `json:"Level" xml:"Level"` - LevelChange string `json:"LevelChange" xml:"LevelChange"` - SendStatus string `json:"SendStatus" xml:"SendStatus"` - AlertTime string `json:"AlertTime" xml:"AlertTime"` - Message string `json:"Message" xml:"Message"` - ContactGroups []string `json:"ContactGroups" xml:"ContactGroups"` - WebhookList []string `json:"WebhookList" xml:"WebhookList"` - ContactALIIWWList []string `json:"ContactALIIWWList" xml:"ContactALIIWWList"` - ContactSMSList []string `json:"ContactSMSList" xml:"ContactSMSList"` - ContactOnCallList []string `json:"ContactOnCallList" xml:"ContactOnCallList"` - ContactMailList []string `json:"ContactMailList" xml:"ContactMailList"` - ContactDingList []string `json:"ContactDingList" xml:"ContactDingList"` - DingdingWebhookList []string `json:"DingdingWebhookList" xml:"DingdingWebhookList"` - Escalation Escalation `json:"Escalation" xml:"Escalation"` - ExtendedInfo []ExtInfo `json:"ExtendedInfo" xml:"ExtendedInfo"` - Dimensions []DimensionsItem `json:"Dimensions" xml:"Dimensions"` + RuleId string `json:"RuleId" xml:"RuleId"` + RuleName string `json:"RuleName" xml:"RuleName"` + Namespace string `json:"Namespace" xml:"Namespace"` + Product string `json:"Product" xml:"Product"` + EventName string `json:"EventName" xml:"EventName"` + GroupId string `json:"GroupId" xml:"GroupId"` + GroupName string `json:"GroupName" xml:"GroupName"` + MetricName string `json:"MetricName" xml:"MetricName"` + InstanceId string `json:"InstanceId" xml:"InstanceId"` + InstanceName string `json:"InstanceName" xml:"InstanceName"` + Level string `json:"Level" xml:"Level"` + LevelChange string `json:"LevelChange" xml:"LevelChange"` + SendStatus string `json:"SendStatus" xml:"SendStatus"` + AlertTime string `json:"AlertTime" xml:"AlertTime"` + Message string `json:"Message" xml:"Message"` + BlackListUUID string `json:"BlackListUUID" xml:"BlackListUUID"` + BlackListName string `json:"BlackListName" xml:"BlackListName"` + BlackListDetail string `json:"BlackListDetail" xml:"BlackListDetail"` + ContactGroups []string `json:"ContactGroups" xml:"ContactGroups"` + ContactALIIWWList []string `json:"ContactALIIWWList" xml:"ContactALIIWWList"` + ContactSMSList []string `json:"ContactSMSList" xml:"ContactSMSList"` + ContactOnCallList []string `json:"ContactOnCallList" xml:"ContactOnCallList"` + ContactMailList []string `json:"ContactMailList" xml:"ContactMailList"` + ContactDingList []string `json:"ContactDingList" xml:"ContactDingList"` + DingdingWebhookList []string `json:"DingdingWebhookList" xml:"DingdingWebhookList"` + Escalation Escalation `json:"Escalation" xml:"Escalation"` + ExtendedInfo []ExtInfo `json:"ExtendedInfo" xml:"ExtendedInfo"` + Dimensions []DimensionsItem `json:"Dimensions" xml:"Dimensions"` + WebhookList []WebhookListItem `json:"WebhookList" xml:"WebhookList"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/struct_option_json.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/struct_option_json.go index 2914a905726..80fb60bb7af 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/struct_option_json.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/struct_option_json.go @@ -17,23 +17,28 @@ package cms // OptionJson is a nested struct in cms response type OptionJson struct { - DnsType string `json:"dns_type" xml:"dns_type"` - DnsServer string `json:"dns_server" xml:"dns_server"` - ExpectValue string `json:"expect_value" xml:"expect_value"` - HttpMethod string `json:"http_method" xml:"http_method"` - ResponseContent string `json:"response_content" xml:"response_content"` - MatchRule int `json:"match_rule" xml:"match_rule"` - RequestContent string `json:"request_content" xml:"request_content"` - Cookie string `json:"cookie" xml:"cookie"` - Header string `json:"header" xml:"header"` - Username string `json:"username" xml:"username"` - Password string `json:"password" xml:"password"` - TimeOut int64 `json:"time_out" xml:"time_out"` - PingNum int `json:"ping_num" xml:"ping_num"` - FailureRate float64 `json:"failure_rate" xml:"failure_rate"` - RequestFormat string `json:"request_format" xml:"request_format"` - ResponseFormat string `json:"response_format" xml:"response_format"` - Port int `json:"port" xml:"port"` - Authentication int `json:"authentication" xml:"authentication"` - Traceroute int64 `json:"traceroute" xml:"traceroute"` + DnsType string `json:"dns_type" xml:"dns_type"` + DnsServer string `json:"dns_server" xml:"dns_server"` + ExpectValue string `json:"expect_value" xml:"expect_value"` + HttpMethod string `json:"http_method" xml:"http_method"` + ResponseContent string `json:"response_content" xml:"response_content"` + MatchRule int `json:"match_rule" xml:"match_rule"` + RequestContent string `json:"request_content" xml:"request_content"` + Cookie string `json:"cookie" xml:"cookie"` + Header string `json:"header" xml:"header"` + Username string `json:"username" xml:"username"` + Password string `json:"password" xml:"password"` + TimeOut int64 `json:"time_out" xml:"time_out"` + PingNum int `json:"ping_num" xml:"ping_num"` + FailureRate float64 `json:"failure_rate" xml:"failure_rate"` + RequestFormat string `json:"request_format" xml:"request_format"` + ResponseFormat string `json:"response_format" xml:"response_format"` + Port int `json:"port" xml:"port"` + Authentication int `json:"authentication" xml:"authentication"` + Traceroute int64 `json:"traceroute" xml:"traceroute"` + CertVerify bool `json:"cert_verify" xml:"cert_verify"` + UnfollowRedirect bool `json:"unfollow_redirect" xml:"unfollow_redirect"` + ProxyProtocol bool `json:"proxy_protocol" xml:"proxy_protocol"` + AcceptableResponseCode string `json:"acceptable_response_code" xml:"acceptable_response_code"` + Ipv6Task string `json:"ipv6_task" xml:"ipv6_task"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/struct_resource.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/struct_resource.go index 7ce3df03412..ab3afad7499 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/struct_resource.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/struct_resource.go @@ -17,47 +17,50 @@ package cms // Resource is a nested struct in cms response type Resource struct { - TemplateId string `json:"TemplateId" xml:"TemplateId"` - Name string `json:"Name" xml:"Name"` - Category string `json:"Category" xml:"Category"` - Unit string `json:"Unit" xml:"Unit"` - Desc string `json:"Desc" xml:"Desc"` - BindUrl string `json:"BindUrl" xml:"BindUrl"` - Dimensions string `json:"Dimensions" xml:"Dimensions"` - GroupName string `json:"GroupName" xml:"GroupName"` - ComparisonOperator string `json:"ComparisonOperator" xml:"ComparisonOperator"` - ServiceId string `json:"ServiceId" xml:"ServiceId"` - RestVersion string `json:"RestVersion" xml:"RestVersion"` - RegionId string `json:"RegionId" xml:"RegionId"` - Tag string `json:"Tag" xml:"Tag"` - InstanceId string `json:"InstanceId" xml:"InstanceId"` - DynamicTagRuleId string `json:"DynamicTagRuleId" xml:"DynamicTagRuleId"` - Expression string `json:"Expression" xml:"Expression"` - NetworkType string `json:"NetworkType" xml:"NetworkType"` - Description string `json:"Description" xml:"Description"` - Periods string `json:"Periods" xml:"Periods"` - Type string `json:"Type" xml:"Type"` - Times int `json:"Times" xml:"Times"` - Level int `json:"Level" xml:"Level"` - InstanceName string `json:"InstanceName" xml:"InstanceName"` - Dimension string `json:"Dimension" xml:"Dimension"` - PreCondition string `json:"PreCondition" xml:"PreCondition"` - Id int64 `json:"Id" xml:"Id"` - Threshold string `json:"Threshold" xml:"Threshold"` - GroupFounderTagValue string `json:"GroupFounderTagValue" xml:"GroupFounderTagValue"` - GmtCreate int64 `json:"GmtCreate" xml:"GmtCreate"` - Namespace string `json:"Namespace" xml:"Namespace"` - GroupId int64 `json:"GroupId" xml:"GroupId"` - GmtModified int64 `json:"GmtModified" xml:"GmtModified"` - GroupFounderTagKey string `json:"GroupFounderTagKey" xml:"GroupFounderTagKey"` - MetricName string `json:"MetricName" xml:"MetricName"` - Labels string `json:"Labels" xml:"Labels"` - Statistics string `json:"Statistics" xml:"Statistics"` - TemplateIds TemplateIds `json:"TemplateIds" xml:"TemplateIds"` - Vpc Vpc `json:"Vpc" xml:"Vpc"` - Region Region `json:"Region" xml:"Region"` - AlertResults []Result `json:"AlertResults" xml:"AlertResults"` - Tags TagsInDescribeMonitorGroupInstanceAttribute `json:"Tags" xml:"Tags"` - ContactGroups ContactGroupsInDescribeMonitorGroups `json:"ContactGroups" xml:"ContactGroups"` - AlertTemplates AlertTemplates `json:"AlertTemplates" xml:"AlertTemplates"` + TemplateId string `json:"TemplateId" xml:"TemplateId"` + Name string `json:"Name" xml:"Name"` + Category string `json:"Category" xml:"Category"` + Unit string `json:"Unit" xml:"Unit"` + SystemEventTemplates string `json:"SystemEventTemplates" xml:"SystemEventTemplates"` + Desc string `json:"Desc" xml:"Desc"` + BindUrl string `json:"BindUrl" xml:"BindUrl"` + Dimensions string `json:"Dimensions" xml:"Dimensions"` + GroupName string `json:"GroupName" xml:"GroupName"` + ComparisonOperator string `json:"ComparisonOperator" xml:"ComparisonOperator"` + ServiceId string `json:"ServiceId" xml:"ServiceId"` + RestVersion string `json:"RestVersion" xml:"RestVersion"` + RegionId string `json:"RegionId" xml:"RegionId"` + Tag string `json:"Tag" xml:"Tag"` + InstanceId string `json:"InstanceId" xml:"InstanceId"` + DynamicTagRuleId string `json:"DynamicTagRuleId" xml:"DynamicTagRuleId"` + Expression string `json:"Expression" xml:"Expression"` + NetworkType string `json:"NetworkType" xml:"NetworkType"` + Description string `json:"Description" xml:"Description"` + Periods string `json:"Periods" xml:"Periods"` + Type string `json:"Type" xml:"Type"` + Times int `json:"Times" xml:"Times"` + Level int `json:"Level" xml:"Level"` + InstanceName string `json:"InstanceName" xml:"InstanceName"` + Dimension string `json:"Dimension" xml:"Dimension"` + PreCondition string `json:"PreCondition" xml:"PreCondition"` + HostAvailabilityTemplates string `json:"HostAvailabilityTemplates" xml:"HostAvailabilityTemplates"` + Id int64 `json:"Id" xml:"Id"` + Threshold string `json:"Threshold" xml:"Threshold"` + GroupFounderTagValue string `json:"GroupFounderTagValue" xml:"GroupFounderTagValue"` + GmtCreate int64 `json:"GmtCreate" xml:"GmtCreate"` + Namespace string `json:"Namespace" xml:"Namespace"` + GroupId int64 `json:"GroupId" xml:"GroupId"` + GmtModified int64 `json:"GmtModified" xml:"GmtModified"` + GroupFounderTagKey string `json:"GroupFounderTagKey" xml:"GroupFounderTagKey"` + MetricName string `json:"MetricName" xml:"MetricName"` + Labels string `json:"Labels" xml:"Labels"` + ProcessMonitorTemplates string `json:"ProcessMonitorTemplates" xml:"ProcessMonitorTemplates"` + Statistics string `json:"Statistics" xml:"Statistics"` + TemplateIds TemplateIds `json:"TemplateIds" xml:"TemplateIds"` + Vpc Vpc `json:"Vpc" xml:"Vpc"` + Region Region `json:"Region" xml:"Region"` + AlertResults []Result `json:"AlertResults" xml:"AlertResults"` + Tags TagsInDescribeMonitorGroupInstanceAttribute `json:"Tags" xml:"Tags"` + ContactGroups ContactGroupsInDescribeMonitorGroups `json:"ContactGroups" xml:"ContactGroups"` + AlertTemplates AlertTemplates `json:"AlertTemplates" xml:"AlertTemplates"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/struct_webhook_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/struct_webhook_list.go index 37b5c525423..915f92f36f6 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/struct_webhook_list.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/struct_webhook_list.go @@ -17,5 +17,5 @@ package cms // WebhookList is a nested struct in cms response type WebhookList struct { - WebhookList []string `json:"WebhookList" xml:"WebhookList"` + WebhookListItem []WebhookListItem `json:"WebhookList" xml:"WebhookList"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/struct_webhook_list_item.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/struct_webhook_list_item.go new file mode 100644 index 00000000000..2c9405498fd --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cms/struct_webhook_list_item.go @@ -0,0 +1,23 @@ +package cms + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// WebhookListItem is a nested struct in cms response +type WebhookListItem struct { + Url string `json:"url" xml:"url"` + Code string `json:"code" xml:"code"` + Message string `json:"message" xml:"message"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/config_web_ip_set.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/config_web_ip_set.go index b78aea2ac0c..692b7e53d0e 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/config_web_ip_set.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/config_web_ip_set.go @@ -71,10 +71,10 @@ func (client *Client) ConfigWebIpSetWithCallback(request *ConfigWebIpSetRequest, // ConfigWebIpSetRequest is the request struct for api ConfigWebIpSet type ConfigWebIpSetRequest struct { *requests.RpcRequest - BlackList *[]string `position:"Query" name:"BlackList" type:"Repeated"` - WhiteList *[]string `position:"Query" name:"WhiteList" type:"Repeated"` ResourceGroupId string `position:"Query" name:"ResourceGroupId"` SourceIp string `position:"Query" name:"SourceIp"` + BlackList *[]string `position:"Query" name:"BlackList" type:"Repeated"` + WhiteList *[]string `position:"Query" name:"WhiteList" type:"Repeated"` Domain string `position:"Query" name:"Domain"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/describe_attack_analysis_max_qps.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/describe_attack_analysis_max_qps.go new file mode 100644 index 00000000000..08bc22b49d5 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/describe_attack_analysis_max_qps.go @@ -0,0 +1,102 @@ +package ddoscoo + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeAttackAnalysisMaxQps invokes the ddoscoo.DescribeAttackAnalysisMaxQps API synchronously +func (client *Client) DescribeAttackAnalysisMaxQps(request *DescribeAttackAnalysisMaxQpsRequest) (response *DescribeAttackAnalysisMaxQpsResponse, err error) { + response = CreateDescribeAttackAnalysisMaxQpsResponse() + err = client.DoAction(request, response) + return +} + +// DescribeAttackAnalysisMaxQpsWithChan invokes the ddoscoo.DescribeAttackAnalysisMaxQps API asynchronously +func (client *Client) DescribeAttackAnalysisMaxQpsWithChan(request *DescribeAttackAnalysisMaxQpsRequest) (<-chan *DescribeAttackAnalysisMaxQpsResponse, <-chan error) { + responseChan := make(chan *DescribeAttackAnalysisMaxQpsResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeAttackAnalysisMaxQps(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeAttackAnalysisMaxQpsWithCallback invokes the ddoscoo.DescribeAttackAnalysisMaxQps API asynchronously +func (client *Client) DescribeAttackAnalysisMaxQpsWithCallback(request *DescribeAttackAnalysisMaxQpsRequest, callback func(response *DescribeAttackAnalysisMaxQpsResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeAttackAnalysisMaxQpsResponse + var err error + defer close(result) + response, err = client.DescribeAttackAnalysisMaxQps(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeAttackAnalysisMaxQpsRequest is the request struct for api DescribeAttackAnalysisMaxQps +type DescribeAttackAnalysisMaxQpsRequest struct { + *requests.RpcRequest + EndTime requests.Integer `position:"Query" name:"EndTime"` + StartTime requests.Integer `position:"Query" name:"StartTime"` + SourceIp string `position:"Query" name:"SourceIp"` +} + +// DescribeAttackAnalysisMaxQpsResponse is the response struct for api DescribeAttackAnalysisMaxQps +type DescribeAttackAnalysisMaxQpsResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Qps int64 `json:"Qps" xml:"Qps"` +} + +// CreateDescribeAttackAnalysisMaxQpsRequest creates a request to invoke DescribeAttackAnalysisMaxQps API +func CreateDescribeAttackAnalysisMaxQpsRequest() (request *DescribeAttackAnalysisMaxQpsRequest) { + request = &DescribeAttackAnalysisMaxQpsRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("ddoscoo", "2020-01-01", "DescribeAttackAnalysisMaxQps", "", "") + request.Method = requests.POST + return +} + +// CreateDescribeAttackAnalysisMaxQpsResponse creates a response to parse from DescribeAttackAnalysisMaxQps response +func CreateDescribeAttackAnalysisMaxQpsResponse() (response *DescribeAttackAnalysisMaxQpsResponse) { + response = &DescribeAttackAnalysisMaxQpsResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/describe_domain_overview.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/describe_domain_overview.go index eb53d05d935..cf4f5dd9f28 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/describe_domain_overview.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/describe_domain_overview.go @@ -71,10 +71,10 @@ func (client *Client) DescribeDomainOverviewWithCallback(request *DescribeDomain // DescribeDomainOverviewRequest is the request struct for api DescribeDomainOverview type DescribeDomainOverviewRequest struct { *requests.RpcRequest - EndTime requests.Integer `position:"Query" name:"EndTime"` StartTime requests.Integer `position:"Query" name:"StartTime"` ResourceGroupId string `position:"Query" name:"ResourceGroupId"` SourceIp string `position:"Query" name:"SourceIp"` + EndTime requests.Integer `position:"Query" name:"EndTime"` Domain string `position:"Query" name:"Domain"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/describe_domain_resource.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/describe_domain_resource.go index ee45ac9abf4..f6d517fe67e 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/describe_domain_resource.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/describe_domain_resource.go @@ -82,8 +82,8 @@ type DescribeDomainResourceRequest struct { // DescribeDomainResourceResponse is the response struct for api DescribeDomainResource type DescribeDomainResourceResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` TotalCount int64 `json:"TotalCount" xml:"TotalCount"` + RequestId string `json:"RequestId" xml:"RequestId"` WebRules []WebRule `json:"WebRules" xml:"WebRules"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/describe_domain_status_code_count.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/describe_domain_status_code_count.go index b70b683f801..830cc8ce7fd 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/describe_domain_status_code_count.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/describe_domain_status_code_count.go @@ -71,10 +71,10 @@ func (client *Client) DescribeDomainStatusCodeCountWithCallback(request *Describ // DescribeDomainStatusCodeCountRequest is the request struct for api DescribeDomainStatusCodeCount type DescribeDomainStatusCodeCountRequest struct { *requests.RpcRequest - EndTime requests.Integer `position:"Query" name:"EndTime"` StartTime requests.Integer `position:"Query" name:"StartTime"` ResourceGroupId string `position:"Query" name:"ResourceGroupId"` SourceIp string `position:"Query" name:"SourceIp"` + EndTime requests.Integer `position:"Query" name:"EndTime"` Domain string `position:"Query" name:"Domain"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/describe_port.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/describe_port.go index 45c62083881..da08f9f894c 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/describe_port.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/describe_port.go @@ -83,8 +83,8 @@ type DescribePortRequest struct { // DescribePortResponse is the response struct for api DescribePort type DescribePortResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` TotalCount int64 `json:"TotalCount" xml:"TotalCount"` + RequestId string `json:"RequestId" xml:"RequestId"` NetworkRules []NetworkRule `json:"NetworkRules" xml:"NetworkRules"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/struct_eip_info.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/struct_eip_info.go index bfeb5a8e6ab..cbf60fd7c7a 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/struct_eip_info.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/struct_eip_info.go @@ -17,6 +17,8 @@ package ddoscoo // EipInfo is a nested struct in ddoscoo response type EipInfo struct { - Eip string `json:"Eip" xml:"Eip"` - Status string `json:"Status" xml:"Status"` + Eip string `json:"Eip" xml:"Eip"` + Status string `json:"Status" xml:"Status"` + IpVersion string `json:"IpVersion" xml:"IpVersion"` + IpMode string `json:"IpMode" xml:"IpMode"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/struct_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/struct_instance.go index 412bcf8f30c..153c57275c5 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/struct_instance.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/struct_instance.go @@ -23,7 +23,9 @@ type Instance struct { InstanceId string `json:"InstanceId" xml:"InstanceId"` DebtStatus int `json:"DebtStatus" xml:"DebtStatus"` Enabled int `json:"Enabled" xml:"Enabled"` + IpMode string `json:"IpMode" xml:"IpMode"` ExpireTime int64 `json:"ExpireTime" xml:"ExpireTime"` CreateTime int64 `json:"CreateTime" xml:"CreateTime"` + IpVersion string `json:"IpVersion" xml:"IpVersion"` Edition int `json:"Edition" xml:"Edition"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/struct_status_code.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/struct_status_code.go index 5b742c9bb17..9f53a6c0b68 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/struct_status_code.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/struct_status_code.go @@ -17,18 +17,18 @@ package ddoscoo // StatusCode is a nested struct in ddoscoo response type StatusCode struct { - Index int `json:"Index" xml:"Index"` Time int64 `json:"Time" xml:"Time"` - Status2XX int64 `json:"Status2XX" xml:"Status2XX"` - Status501 int64 `json:"Status501" xml:"Status501"` Status502 int64 `json:"Status502" xml:"Status502"` - Status503 int64 `json:"Status503" xml:"Status503"` - Status504 int64 `json:"Status504" xml:"Status504"` - Status200 int64 `json:"Status200" xml:"Status200"` - Status405 int64 `json:"Status405" xml:"Status405"` + Status501 int64 `json:"Status501" xml:"Status501"` + Status403 int64 `json:"Status403" xml:"Status403"` Status5XX int64 `json:"Status5XX" xml:"Status5XX"` + Index int `json:"Index" xml:"Index"` + Status3XX int64 `json:"Status3XX" xml:"Status3XX"` + Status405 int64 `json:"Status405" xml:"Status405"` Status4XX int64 `json:"Status4XX" xml:"Status4XX"` - Status403 int64 `json:"Status403" xml:"Status403"` + Status504 int64 `json:"Status504" xml:"Status504"` Status404 int64 `json:"Status404" xml:"Status404"` - Status3XX int64 `json:"Status3XX" xml:"Status3XX"` + Status2XX int64 `json:"Status2XX" xml:"Status2XX"` + Status503 int64 `json:"Status503" xml:"Status503"` + Status200 int64 `json:"Status200" xml:"Status200"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/struct_status_code_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/struct_status_code_list.go deleted file mode 100644 index 2216a1fec33..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/struct_status_code_list.go +++ /dev/null @@ -1,21 +0,0 @@ -package ddoscoo - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// StatusCodeList is a nested struct in ddoscoo response -type StatusCodeList struct { - StatusCode []StatusCode `json:"StatusCode" xml:"StatusCode"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/struct_status_code_list_in_describe_domain_status_code_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/struct_status_code_list_in_describe_domain_status_code_list.go new file mode 100644 index 00000000000..be4ee253001 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/struct_status_code_list_in_describe_domain_status_code_list.go @@ -0,0 +1,21 @@ +package ddoscoo + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// StatusCodeListInDescribeDomainStatusCodeList is a nested struct in ddoscoo response +type StatusCodeListInDescribeDomainStatusCodeList struct { + StatusCode []StatusCode `json:"StatusCode" xml:"StatusCode"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/struct_web_rule.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/struct_web_rule.go index 5177eb9a458..923b3709540 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/struct_web_rule.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ddoscoo/struct_web_rule.go @@ -29,8 +29,8 @@ type WebRule struct { HttpsExt string `json:"HttpsExt" xml:"HttpsExt"` ProxyEnabled bool `json:"ProxyEnabled" xml:"ProxyEnabled"` RsType int `json:"RsType" xml:"RsType"` - CcRuleEnabled bool `json:"CcRuleEnabled" xml:"CcRuleEnabled"` CcTemplate string `json:"CcTemplate" xml:"CcTemplate"` + CcRuleEnabled bool `json:"CcRuleEnabled" xml:"CcRuleEnabled"` PolicyMode string `json:"PolicyMode" xml:"PolicyMode"` CcEnabled bool `json:"CcEnabled" xml:"CcEnabled"` Https2HttpEnable bool `json:"Https2HttpEnable" xml:"Https2HttpEnable"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/allocate_node_private_network_address.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/allocate_node_private_network_address.go index deb466be112..240b6922b58 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/allocate_node_private_network_address.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/allocate_node_private_network_address.go @@ -94,7 +94,7 @@ func CreateAllocateNodePrivateNetworkAddressRequest() (request *AllocateNodePriv request = &AllocateNodePrivateNetworkAddressRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "AllocateNodePrivateNetworkAddress", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "AllocateNodePrivateNetworkAddress", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/allocate_public_network_address.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/allocate_public_network_address.go index 336f19043c0..a6b89db1c0c 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/allocate_public_network_address.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/allocate_public_network_address.go @@ -91,7 +91,7 @@ func CreateAllocatePublicNetworkAddressRequest() (request *AllocatePublicNetwork request = &AllocatePublicNetworkAddressRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "AllocatePublicNetworkAddress", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "AllocatePublicNetworkAddress", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/check_cloud_resource_authorized.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/check_cloud_resource_authorized.go index 2b3bc1ae083..48874ea5de3 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/check_cloud_resource_authorized.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/check_cloud_resource_authorized.go @@ -93,7 +93,7 @@ func CreateCheckCloudResourceAuthorizedRequest() (request *CheckCloudResourceAut request = &CheckCloudResourceAuthorizedRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "CheckCloudResourceAuthorized", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "CheckCloudResourceAuthorized", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/check_recovery_condition.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/check_recovery_condition.go index ca771868417..4a676490cba 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/check_recovery_condition.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/check_recovery_condition.go @@ -96,7 +96,7 @@ func CreateCheckRecoveryConditionRequest() (request *CheckRecoveryConditionReque request = &CheckRecoveryConditionRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "CheckRecoveryCondition", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "CheckRecoveryCondition", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/create_backup.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/create_backup.go index aec672b2223..040d93fb483 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/create_backup.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/create_backup.go @@ -92,7 +92,7 @@ func CreateCreateBackupRequest() (request *CreateBackupRequest) { request = &CreateBackupRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "CreateBackup", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "CreateBackup", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/create_db_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/create_db_instance.go index 40c417a727d..74c08233471 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/create_db_instance.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/create_db_instance.go @@ -117,7 +117,7 @@ func CreateCreateDBInstanceRequest() (request *CreateDBInstanceRequest) { request = &CreateDBInstanceRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "CreateDBInstance", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "CreateDBInstance", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/create_node.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/create_node.go index c1fff06e61e..ba3d0138825 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/create_node.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/create_node.go @@ -75,9 +75,11 @@ type CreateNodeRequest struct { NodeType string `position:"Query" name:"NodeType"` ClientToken string `position:"Query" name:"ClientToken"` ReadonlyReplicas requests.Integer `position:"Query" name:"ReadonlyReplicas"` + CouponNo string `position:"Query" name:"CouponNo"` NodeClass string `position:"Query" name:"NodeClass"` SecurityToken string `position:"Query" name:"SecurityToken"` DBInstanceId string `position:"Query" name:"DBInstanceId"` + BusinessInfo string `position:"Query" name:"BusinessInfo"` AutoPay requests.Boolean `position:"Query" name:"AutoPay"` FromApp string `position:"Query" name:"FromApp"` ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` @@ -99,7 +101,7 @@ func CreateCreateNodeRequest() (request *CreateNodeRequest) { request = &CreateNodeRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "CreateNode", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "CreateNode", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/create_recommendation_task.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/create_recommendation_task.go index 264a26ad081..7b44d857599 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/create_recommendation_task.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/create_recommendation_task.go @@ -93,7 +93,7 @@ func CreateCreateRecommendationTaskRequest() (request *CreateRecommendationTaskR request = &CreateRecommendationTaskRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "CreateRecommendationTask", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "CreateRecommendationTask", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/create_serverless_db_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/create_serverless_db_instance.go index e1107e2cf8b..fd345ff033d 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/create_serverless_db_instance.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/create_serverless_db_instance.go @@ -108,7 +108,7 @@ func CreateCreateServerlessDBInstanceRequest() (request *CreateServerlessDBInsta request = &CreateServerlessDBInstanceRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "CreateServerlessDBInstance", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "CreateServerlessDBInstance", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/create_sharding_db_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/create_sharding_db_instance.go index 19603df522b..b1641069aaf 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/create_sharding_db_instance.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/create_sharding_db_instance.go @@ -129,7 +129,7 @@ func CreateCreateShardingDBInstanceRequest() (request *CreateShardingDBInstanceR request = &CreateShardingDBInstanceRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "CreateShardingDBInstance", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "CreateShardingDBInstance", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/delete_db_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/delete_db_instance.go index f4e395c8679..6a1e4064421 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/delete_db_instance.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/delete_db_instance.go @@ -91,7 +91,7 @@ func CreateDeleteDBInstanceRequest() (request *DeleteDBInstanceRequest) { request = &DeleteDBInstanceRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DeleteDBInstance", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DeleteDBInstance", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/delete_node.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/delete_node.go index 3f9f8e29e9e..c7895b64c70 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/delete_node.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/delete_node.go @@ -94,7 +94,7 @@ func CreateDeleteNodeRequest() (request *DeleteNodeRequest) { request = &DeleteNodeRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DeleteNode", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DeleteNode", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_accounts.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_accounts.go index b5b2f7ef2a2..22bc633ee06 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_accounts.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_accounts.go @@ -92,7 +92,7 @@ func CreateDescribeAccountsRequest() (request *DescribeAccountsRequest) { request = &DescribeAccountsRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeAccounts", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeAccounts", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_active_operation_task_count.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_active_operation_task_count.go index bc91defbf29..30811405a94 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_active_operation_task_count.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_active_operation_task_count.go @@ -92,7 +92,7 @@ func CreateDescribeActiveOperationTaskCountRequest() (request *DescribeActiveOpe request = &DescribeActiveOperationTaskCountRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeActiveOperationTaskCount", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeActiveOperationTaskCount", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_active_operation_task_type.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_active_operation_task_type.go index d2d545d2a5c..48c61f26cf6 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_active_operation_task_type.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_active_operation_task_type.go @@ -92,7 +92,7 @@ func CreateDescribeActiveOperationTaskTypeRequest() (request *DescribeActiveOper request = &DescribeActiveOperationTaskTypeRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeActiveOperationTaskType", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeActiveOperationTaskType", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_audit_files.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_audit_files.go index fbe1b9fbf03..b1c942f7247 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_audit_files.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_audit_files.go @@ -98,7 +98,7 @@ func CreateDescribeAuditFilesRequest() (request *DescribeAuditFilesRequest) { request = &DescribeAuditFilesRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeAuditFiles", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeAuditFiles", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_audit_log_filter.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_audit_log_filter.go index fbe55635885..0f9d1248724 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_audit_log_filter.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_audit_log_filter.go @@ -93,7 +93,7 @@ func CreateDescribeAuditLogFilterRequest() (request *DescribeAuditLogFilterReque request = &DescribeAuditLogFilterRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeAuditLogFilter", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeAuditLogFilter", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_audit_policy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_audit_policy.go index a5d938e925a..bb52e872f4f 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_audit_policy.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_audit_policy.go @@ -91,7 +91,7 @@ func CreateDescribeAuditPolicyRequest() (request *DescribeAuditPolicyRequest) { request = &DescribeAuditPolicyRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeAuditPolicy", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeAuditPolicy", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_audit_records.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_audit_records.go index b400c026f2a..e62b8a6267d 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_audit_records.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_audit_records.go @@ -104,7 +104,7 @@ func CreateDescribeAuditRecordsRequest() (request *DescribeAuditRecordsRequest) request = &DescribeAuditRecordsRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeAuditRecords", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeAuditRecords", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_available_engine_version.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_available_engine_version.go index d20f6616d86..97fec938846 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_available_engine_version.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_available_engine_version.go @@ -91,7 +91,7 @@ func CreateDescribeAvailableEngineVersionRequest() (request *DescribeAvailableEn request = &DescribeAvailableEngineVersionRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeAvailableEngineVersion", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeAvailableEngineVersion", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_available_resource.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_available_resource.go index c322ed74ef4..c9653731167 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_available_resource.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_available_resource.go @@ -92,7 +92,7 @@ func CreateDescribeAvailableResourceRequest() (request *DescribeAvailableResourc request = &DescribeAvailableResourceRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeAvailableResource", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeAvailableResource", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_available_time_range.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_available_time_range.go index 4277210c5f3..ae33d6f8635 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_available_time_range.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_available_time_range.go @@ -92,7 +92,7 @@ func CreateDescribeAvailableTimeRangeRequest() (request *DescribeAvailableTimeRa request = &DescribeAvailableTimeRangeRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeAvailableTimeRange", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeAvailableTimeRange", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_backup_d_bs.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_backup_d_bs.go index 705c0e0be1e..5b9712420a8 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_backup_d_bs.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_backup_d_bs.go @@ -99,7 +99,7 @@ func CreateDescribeBackupDBsRequest() (request *DescribeBackupDBsRequest) { request = &DescribeBackupDBsRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeBackupDBs", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeBackupDBs", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_backup_policy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_backup_policy.go index 8cd981d2a0e..04fa7f5b2e0 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_backup_policy.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_backup_policy.go @@ -94,7 +94,7 @@ func CreateDescribeBackupPolicyRequest() (request *DescribeBackupPolicyRequest) request = &DescribeBackupPolicyRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeBackupPolicy", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeBackupPolicy", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_backups.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_backups.go index 55d6fee9434..34fc669c855 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_backups.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_backups.go @@ -100,7 +100,7 @@ func CreateDescribeBackupsRequest() (request *DescribeBackupsRequest) { request = &DescribeBackupsRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeBackups", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeBackups", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_db_instance_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_db_instance_attribute.go index d64e9f4f6a9..506180adc15 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_db_instance_attribute.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_db_instance_attribute.go @@ -93,7 +93,7 @@ func CreateDescribeDBInstanceAttributeRequest() (request *DescribeDBInstanceAttr request = &DescribeDBInstanceAttributeRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeDBInstanceAttribute", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeDBInstanceAttribute", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_db_instance_encryption_key.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_db_instance_encryption_key.go index d07fc46ad21..db74fbca80b 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_db_instance_encryption_key.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_db_instance_encryption_key.go @@ -99,7 +99,7 @@ func CreateDescribeDBInstanceEncryptionKeyRequest() (request *DescribeDBInstance request = &DescribeDBInstanceEncryptionKeyRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeDBInstanceEncryptionKey", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeDBInstanceEncryptionKey", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_db_instance_monitor.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_db_instance_monitor.go index f1d2e31872e..eb392e3a17f 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_db_instance_monitor.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_db_instance_monitor.go @@ -91,7 +91,7 @@ func CreateDescribeDBInstanceMonitorRequest() (request *DescribeDBInstanceMonito request = &DescribeDBInstanceMonitorRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeDBInstanceMonitor", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeDBInstanceMonitor", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_db_instance_performance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_db_instance_performance.go index eb408e9a3ce..1809a4e66b6 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_db_instance_performance.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_db_instance_performance.go @@ -101,7 +101,7 @@ func CreateDescribeDBInstancePerformanceRequest() (request *DescribeDBInstancePe request = &DescribeDBInstancePerformanceRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeDBInstancePerformance", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeDBInstancePerformance", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_db_instance_ssl.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_db_instance_ssl.go index 36962838e39..d362baadee2 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_db_instance_ssl.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_db_instance_ssl.go @@ -93,7 +93,7 @@ func CreateDescribeDBInstanceSSLRequest() (request *DescribeDBInstanceSSLRequest request = &DescribeDBInstanceSSLRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeDBInstanceSSL", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeDBInstanceSSL", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_db_instance_tde_info.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_db_instance_tde_info.go index 014d985159e..61ad28527e1 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_db_instance_tde_info.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_db_instance_tde_info.go @@ -91,7 +91,7 @@ func CreateDescribeDBInstanceTDEInfoRequest() (request *DescribeDBInstanceTDEInf request = &DescribeDBInstanceTDEInfoRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeDBInstanceTDEInfo", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeDBInstanceTDEInfo", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_db_instances.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_db_instances.go index 91030751212..81624434cc1 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_db_instances.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_db_instances.go @@ -119,7 +119,7 @@ func CreateDescribeDBInstancesRequest() (request *DescribeDBInstancesRequest) { request = &DescribeDBInstancesRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeDBInstances", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeDBInstances", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_dedicated_cluster_instance_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_dedicated_cluster_instance_list.go index 3c7819b015a..b8626833b1b 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_dedicated_cluster_instance_list.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_dedicated_cluster_instance_list.go @@ -104,7 +104,7 @@ func CreateDescribeDedicatedClusterInstanceListRequest() (request *DescribeDedic request = &DescribeDedicatedClusterInstanceListRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeDedicatedClusterInstanceList", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeDedicatedClusterInstanceList", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_error_log_records.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_error_log_records.go index 15de5d44252..eb54d34a5c3 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_error_log_records.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_error_log_records.go @@ -103,7 +103,7 @@ func CreateDescribeErrorLogRecordsRequest() (request *DescribeErrorLogRecordsReq request = &DescribeErrorLogRecordsRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeErrorLogRecords", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeErrorLogRecords", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_instance_auto_renewal_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_instance_auto_renewal_attribute.go index a2702838598..d058b4eea2a 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_instance_auto_renewal_attribute.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_instance_auto_renewal_attribute.go @@ -97,7 +97,7 @@ func CreateDescribeInstanceAutoRenewalAttributeRequest() (request *DescribeInsta request = &DescribeInstanceAutoRenewalAttributeRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeInstanceAutoRenewalAttribute", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeInstanceAutoRenewalAttribute", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_kernel_release_notes.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_kernel_release_notes.go index eb5a6b0de9f..bef44d5bf36 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_kernel_release_notes.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_kernel_release_notes.go @@ -91,7 +91,7 @@ func CreateDescribeKernelReleaseNotesRequest() (request *DescribeKernelReleaseNo request = &DescribeKernelReleaseNotesRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeKernelReleaseNotes", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeKernelReleaseNotes", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_mongo_db_log_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_mongo_db_log_config.go index 75aa7a9a35f..f7ba0c99435 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_mongo_db_log_config.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_mongo_db_log_config.go @@ -93,7 +93,7 @@ func CreateDescribeMongoDBLogConfigRequest() (request *DescribeMongoDBLogConfigR request = &DescribeMongoDBLogConfigRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeMongoDBLogConfig", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeMongoDBLogConfig", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_parameter_modification_history.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_parameter_modification_history.go index 3db2e79dafd..2a790403d48 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_parameter_modification_history.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_parameter_modification_history.go @@ -95,7 +95,7 @@ func CreateDescribeParameterModificationHistoryRequest() (request *DescribeParam request = &DescribeParameterModificationHistoryRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeParameterModificationHistory", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeParameterModificationHistory", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_parameter_templates.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_parameter_templates.go index fc0c5e78cc4..7c0243d0c3f 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_parameter_templates.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_parameter_templates.go @@ -95,7 +95,7 @@ func CreateDescribeParameterTemplatesRequest() (request *DescribeParameterTempla request = &DescribeParameterTemplatesRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeParameterTemplates", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeParameterTemplates", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_parameters.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_parameters.go index 25bcdfc8eca..8a327a4d265 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_parameters.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_parameters.go @@ -96,7 +96,7 @@ func CreateDescribeParametersRequest() (request *DescribeParametersRequest) { request = &DescribeParametersRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeParameters", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeParameters", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_price.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_price.go index c54e1a05530..9c1f6c6a1f6 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_price.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_price.go @@ -102,7 +102,7 @@ func CreateDescribePriceRequest() (request *DescribePriceRequest) { request = &DescribePriceRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribePrice", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribePrice", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_regions.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_regions.go index fd38532d500..bc0e1023b23 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_regions.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_regions.go @@ -91,7 +91,7 @@ func CreateDescribeRegionsRequest() (request *DescribeRegionsRequest) { request = &DescribeRegionsRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeRegions", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeRegions", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_renewal_price.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_renewal_price.go index ddf1b42708f..f38551cd4ae 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_renewal_price.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_renewal_price.go @@ -95,7 +95,7 @@ func CreateDescribeRenewalPriceRequest() (request *DescribeRenewalPriceRequest) request = &DescribeRenewalPriceRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeRenewalPrice", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeRenewalPrice", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_replica_set_role.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_replica_set_role.go index 07e134415e9..3c08c82fcbf 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_replica_set_role.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_replica_set_role.go @@ -92,7 +92,7 @@ func CreateDescribeReplicaSetRoleRequest() (request *DescribeReplicaSetRoleReque request = &DescribeReplicaSetRoleRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeReplicaSetRole", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeReplicaSetRole", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_role_zone_info.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_role_zone_info.go index 7c819d4f5d4..addf7074096 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_role_zone_info.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_role_zone_info.go @@ -91,7 +91,7 @@ func CreateDescribeRoleZoneInfoRequest() (request *DescribeRoleZoneInfoRequest) request = &DescribeRoleZoneInfoRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeRoleZoneInfo", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeRoleZoneInfo", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_running_log_records.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_running_log_records.go index 842106cb702..438915882ed 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_running_log_records.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_running_log_records.go @@ -105,7 +105,7 @@ func CreateDescribeRunningLogRecordsRequest() (request *DescribeRunningLogRecord request = &DescribeRunningLogRecordsRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeRunningLogRecords", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeRunningLogRecords", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_security_group_configuration.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_security_group_configuration.go index 000902f5941..cd33d8e208e 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_security_group_configuration.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_security_group_configuration.go @@ -91,7 +91,7 @@ func CreateDescribeSecurityGroupConfigurationRequest() (request *DescribeSecurit request = &DescribeSecurityGroupConfigurationRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeSecurityGroupConfiguration", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeSecurityGroupConfiguration", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_security_ips.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_security_ips.go index 9e4da43045f..6e224a52fc0 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_security_ips.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_security_ips.go @@ -92,7 +92,7 @@ func CreateDescribeSecurityIpsRequest() (request *DescribeSecurityIpsRequest) { request = &DescribeSecurityIpsRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeSecurityIps", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeSecurityIps", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_sharding_network_address.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_sharding_network_address.go index 7dad9c5e65d..6957fe3b137 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_sharding_network_address.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_sharding_network_address.go @@ -93,7 +93,7 @@ func CreateDescribeShardingNetworkAddressRequest() (request *DescribeShardingNet request = &DescribeShardingNetworkAddressRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeShardingNetworkAddress", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeShardingNetworkAddress", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_slow_log_records.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_slow_log_records.go index c6c9f18450e..f2ebc282dd3 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_slow_log_records.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_slow_log_records.go @@ -103,7 +103,7 @@ func CreateDescribeSlowLogRecordsRequest() (request *DescribeSlowLogRecordsReque request = &DescribeSlowLogRecordsRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeSlowLogRecords", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeSlowLogRecords", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_tags.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_tags.go index 748985e761f..11e8bea9f07 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_tags.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_tags.go @@ -93,7 +93,7 @@ func CreateDescribeTagsRequest() (request *DescribeTagsRequest) { request = &DescribeTagsRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeTags", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeTags", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_user_encryption_key_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_user_encryption_key_list.go index c4a8bf20fb5..e7cc3504794 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_user_encryption_key_list.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/describe_user_encryption_key_list.go @@ -92,7 +92,7 @@ func CreateDescribeUserEncryptionKeyListRequest() (request *DescribeUserEncrypti request = &DescribeUserEncryptionKeyListRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DescribeUserEncryptionKeyList", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DescribeUserEncryptionKeyList", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/destroy_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/destroy_instance.go index 280cda79ab3..7070ee252e9 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/destroy_instance.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/destroy_instance.go @@ -93,7 +93,7 @@ func CreateDestroyInstanceRequest() (request *DestroyInstanceRequest) { request = &DestroyInstanceRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "DestroyInstance", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "DestroyInstance", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/evaluate_resource.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/evaluate_resource.go index 651f3c5ba14..273bc4bc4e3 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/evaluate_resource.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/evaluate_resource.go @@ -98,7 +98,7 @@ func CreateEvaluateResourceRequest() (request *EvaluateResourceRequest) { request = &EvaluateResourceRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "EvaluateResource", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "EvaluateResource", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/list_tag_resources.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/list_tag_resources.go index 0be85eff86c..b5e5147ee5f 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/list_tag_resources.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/list_tag_resources.go @@ -100,7 +100,7 @@ func CreateListTagResourcesRequest() (request *ListTagResourcesRequest) { request = &ListTagResourcesRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "ListTagResources", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "ListTagResources", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/migrate_available_zone.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/migrate_available_zone.go index 3411f77beba..1a77fbf97dc 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/migrate_available_zone.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/migrate_available_zone.go @@ -92,7 +92,7 @@ func CreateMigrateAvailableZoneRequest() (request *MigrateAvailableZoneRequest) request = &MigrateAvailableZoneRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "MigrateAvailableZone", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "MigrateAvailableZone", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/migrate_to_other_zone.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/migrate_to_other_zone.go index 2cdd0bd00f0..9f75bd9f169 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/migrate_to_other_zone.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/migrate_to_other_zone.go @@ -92,7 +92,7 @@ func CreateMigrateToOtherZoneRequest() (request *MigrateToOtherZoneRequest) { request = &MigrateToOtherZoneRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "MigrateToOtherZone", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "MigrateToOtherZone", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_account_description.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_account_description.go index 3b8d9f8cbc1..7827bac9629 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_account_description.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_account_description.go @@ -92,7 +92,7 @@ func CreateModifyAccountDescriptionRequest() (request *ModifyAccountDescriptionR request = &ModifyAccountDescriptionRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "ModifyAccountDescription", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "ModifyAccountDescription", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_audit_log_filter.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_audit_log_filter.go index b2b95d67240..1bba94a3451 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_audit_log_filter.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_audit_log_filter.go @@ -92,7 +92,7 @@ func CreateModifyAuditLogFilterRequest() (request *ModifyAuditLogFilterRequest) request = &ModifyAuditLogFilterRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "ModifyAuditLogFilter", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "ModifyAuditLogFilter", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_audit_policy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_audit_policy.go index 37fa397759a..1a0272c03fc 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_audit_policy.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_audit_policy.go @@ -92,7 +92,7 @@ func CreateModifyAuditPolicyRequest() (request *ModifyAuditPolicyRequest) { request = &ModifyAuditPolicyRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "ModifyAuditPolicy", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "ModifyAuditPolicy", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_backup_policy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_backup_policy.go index 5121a5b67db..ce0a5345bcb 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_backup_policy.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_backup_policy.go @@ -92,7 +92,7 @@ func CreateModifyBackupPolicyRequest() (request *ModifyBackupPolicyRequest) { request = &ModifyBackupPolicyRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "ModifyBackupPolicy", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "ModifyBackupPolicy", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_connection_string.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_connection_string.go index 0f01432fe5b..a5967bdb300 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_connection_string.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_connection_string.go @@ -93,7 +93,7 @@ func CreateModifyDBInstanceConnectionStringRequest() (request *ModifyDBInstanceC request = &ModifyDBInstanceConnectionStringRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "ModifyDBInstanceConnectionString", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "ModifyDBInstanceConnectionString", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_description.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_description.go index 6301dfd5482..d39f8243e27 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_description.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_description.go @@ -92,7 +92,7 @@ func CreateModifyDBInstanceDescriptionRequest() (request *ModifyDBInstanceDescri request = &ModifyDBInstanceDescriptionRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "ModifyDBInstanceDescription", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "ModifyDBInstanceDescription", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_maintain_time.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_maintain_time.go index 2567cbebf0a..5f48c7f3bec 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_maintain_time.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_maintain_time.go @@ -92,7 +92,7 @@ func CreateModifyDBInstanceMaintainTimeRequest() (request *ModifyDBInstanceMaint request = &ModifyDBInstanceMaintainTimeRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "ModifyDBInstanceMaintainTime", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "ModifyDBInstanceMaintainTime", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_monitor.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_monitor.go index 8396c18ee41..db3c59fa39e 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_monitor.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_monitor.go @@ -91,7 +91,7 @@ func CreateModifyDBInstanceMonitorRequest() (request *ModifyDBInstanceMonitorReq request = &ModifyDBInstanceMonitorRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "ModifyDBInstanceMonitor", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "ModifyDBInstanceMonitor", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_net_expire_time.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_net_expire_time.go index 2f338d183cd..a93c4ea1012 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_net_expire_time.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_net_expire_time.go @@ -92,7 +92,7 @@ func CreateModifyDBInstanceNetExpireTimeRequest() (request *ModifyDBInstanceNetE request = &ModifyDBInstanceNetExpireTimeRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "ModifyDBInstanceNetExpireTime", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "ModifyDBInstanceNetExpireTime", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_network_type.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_network_type.go index 85282efef6f..a2bf77587f1 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_network_type.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_network_type.go @@ -95,7 +95,7 @@ func CreateModifyDBInstanceNetworkTypeRequest() (request *ModifyDBInstanceNetwor request = &ModifyDBInstanceNetworkTypeRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "ModifyDBInstanceNetworkType", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "ModifyDBInstanceNetworkType", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_spec.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_spec.go index 5a1e6e41367..220cad18e61 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_spec.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_spec.go @@ -101,7 +101,7 @@ func CreateModifyDBInstanceSpecRequest() (request *ModifyDBInstanceSpecRequest) request = &ModifyDBInstanceSpecRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "ModifyDBInstanceSpec", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "ModifyDBInstanceSpec", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_ssl.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_ssl.go index 99fc2d92dfb..8b0d8b583bb 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_ssl.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_ssl.go @@ -91,7 +91,7 @@ func CreateModifyDBInstanceSSLRequest() (request *ModifyDBInstanceSSLRequest) { request = &ModifyDBInstanceSSLRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "ModifyDBInstanceSSL", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "ModifyDBInstanceSSL", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_tde.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_tde.go index bb9f306ff10..c3f02925657 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_tde.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_db_instance_tde.go @@ -94,7 +94,7 @@ func CreateModifyDBInstanceTDERequest() (request *ModifyDBInstanceTDERequest) { request = &ModifyDBInstanceTDERequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "ModifyDBInstanceTDE", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "ModifyDBInstanceTDE", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_instance_auto_renewal_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_instance_auto_renewal_attribute.go index 1bd7eeea773..073262e76be 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_instance_auto_renewal_attribute.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_instance_auto_renewal_attribute.go @@ -92,7 +92,7 @@ func CreateModifyInstanceAutoRenewalAttributeRequest() (request *ModifyInstanceA request = &ModifyInstanceAutoRenewalAttributeRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "ModifyInstanceAutoRenewalAttribute", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "ModifyInstanceAutoRenewalAttribute", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_instance_vpc_auth_mode.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_instance_vpc_auth_mode.go index 2ea67c51774..f8ecf4b2ad7 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_instance_vpc_auth_mode.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_instance_vpc_auth_mode.go @@ -92,7 +92,7 @@ func CreateModifyInstanceVpcAuthModeRequest() (request *ModifyInstanceVpcAuthMod request = &ModifyInstanceVpcAuthModeRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "ModifyInstanceVpcAuthMode", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "ModifyInstanceVpcAuthMode", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_node_spec.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_node_spec.go index f0868cacacb..2516000ff2e 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_node_spec.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_node_spec.go @@ -100,7 +100,7 @@ func CreateModifyNodeSpecRequest() (request *ModifyNodeSpecRequest) { request = &ModifyNodeSpecRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "ModifyNodeSpec", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "ModifyNodeSpec", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_node_spec_batch.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_node_spec_batch.go new file mode 100644 index 00000000000..8d3f17a4039 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_node_spec_batch.go @@ -0,0 +1,113 @@ +package dds + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ModifyNodeSpecBatch invokes the dds.ModifyNodeSpecBatch API synchronously +func (client *Client) ModifyNodeSpecBatch(request *ModifyNodeSpecBatchRequest) (response *ModifyNodeSpecBatchResponse, err error) { + response = CreateModifyNodeSpecBatchResponse() + err = client.DoAction(request, response) + return +} + +// ModifyNodeSpecBatchWithChan invokes the dds.ModifyNodeSpecBatch API asynchronously +func (client *Client) ModifyNodeSpecBatchWithChan(request *ModifyNodeSpecBatchRequest) (<-chan *ModifyNodeSpecBatchResponse, <-chan error) { + responseChan := make(chan *ModifyNodeSpecBatchResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ModifyNodeSpecBatch(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ModifyNodeSpecBatchWithCallback invokes the dds.ModifyNodeSpecBatch API asynchronously +func (client *Client) ModifyNodeSpecBatchWithCallback(request *ModifyNodeSpecBatchRequest, callback func(response *ModifyNodeSpecBatchResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ModifyNodeSpecBatchResponse + var err error + defer close(result) + response, err = client.ModifyNodeSpecBatch(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ModifyNodeSpecBatchRequest is the request struct for api ModifyNodeSpecBatch +type ModifyNodeSpecBatchRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ClientToken string `position:"Query" name:"ClientToken"` + NodesInfo string `position:"Query" name:"NodesInfo"` + CouponNo string `position:"Query" name:"CouponNo"` + SecurityToken string `position:"Query" name:"SecurityToken"` + EffectiveTime string `position:"Query" name:"EffectiveTime"` + DBInstanceId string `position:"Query" name:"DBInstanceId"` + BusinessInfo string `position:"Query" name:"BusinessInfo"` + AutoPay requests.Boolean `position:"Query" name:"AutoPay"` + FromApp string `position:"Query" name:"FromApp"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + OrderType string `position:"Query" name:"OrderType"` +} + +// ModifyNodeSpecBatchResponse is the response struct for api ModifyNodeSpecBatch +type ModifyNodeSpecBatchResponse struct { + *responses.BaseResponse + OrderId string `json:"OrderId" xml:"OrderId"` + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateModifyNodeSpecBatchRequest creates a request to invoke ModifyNodeSpecBatch API +func CreateModifyNodeSpecBatchRequest() (request *ModifyNodeSpecBatchRequest) { + request = &ModifyNodeSpecBatchRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Dds", "2015-12-01", "ModifyNodeSpecBatch", "Dds", "openAPI") + request.Method = requests.POST + return +} + +// CreateModifyNodeSpecBatchResponse creates a response to parse from ModifyNodeSpecBatch response +func CreateModifyNodeSpecBatchResponse() (response *ModifyNodeSpecBatchResponse) { + response = &ModifyNodeSpecBatchResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_parameters.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_parameters.go index fe309ad3205..54d7383be29 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_parameters.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_parameters.go @@ -93,7 +93,7 @@ func CreateModifyParametersRequest() (request *ModifyParametersRequest) { request = &ModifyParametersRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "ModifyParameters", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "ModifyParameters", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_resource_group.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_resource_group.go similarity index 90% rename from vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_resource_group.go rename to vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_resource_group.go index 49802daf1da..e964b00a4db 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_resource_group.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_resource_group.go @@ -1,4 +1,4 @@ -package rds +package dds //Licensed under the Apache License, Version 2.0 (the "License"); //you may not use this file except in compliance with the License. @@ -20,14 +20,14 @@ import ( "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" ) -// ModifyResourceGroup invokes the rds.ModifyResourceGroup API synchronously +// ModifyResourceGroup invokes the dds.ModifyResourceGroup API synchronously func (client *Client) ModifyResourceGroup(request *ModifyResourceGroupRequest) (response *ModifyResourceGroupResponse, err error) { response = CreateModifyResourceGroupResponse() err = client.DoAction(request, response) return } -// ModifyResourceGroupWithChan invokes the rds.ModifyResourceGroup API asynchronously +// ModifyResourceGroupWithChan invokes the dds.ModifyResourceGroup API asynchronously func (client *Client) ModifyResourceGroupWithChan(request *ModifyResourceGroupRequest) (<-chan *ModifyResourceGroupResponse, <-chan error) { responseChan := make(chan *ModifyResourceGroupResponse, 1) errChan := make(chan error, 1) @@ -49,7 +49,7 @@ func (client *Client) ModifyResourceGroupWithChan(request *ModifyResourceGroupRe return responseChan, errChan } -// ModifyResourceGroupWithCallback invokes the rds.ModifyResourceGroup API asynchronously +// ModifyResourceGroupWithCallback invokes the dds.ModifyResourceGroup API asynchronously func (client *Client) ModifyResourceGroupWithCallback(request *ModifyResourceGroupRequest, callback func(response *ModifyResourceGroupResponse, err error)) <-chan int { result := make(chan int, 1) err := client.AddAsyncTask(func() { @@ -72,8 +72,8 @@ func (client *Client) ModifyResourceGroupWithCallback(request *ModifyResourceGro type ModifyResourceGroupRequest struct { *requests.RpcRequest ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ClientToken string `position:"Query" name:"ClientToken"` ResourceGroupId string `position:"Query" name:"ResourceGroupId"` + SecurityToken string `position:"Query" name:"SecurityToken"` DBInstanceId string `position:"Query" name:"DBInstanceId"` ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` OwnerAccount string `position:"Query" name:"OwnerAccount"` @@ -91,7 +91,7 @@ func CreateModifyResourceGroupRequest() (request *ModifyResourceGroupRequest) { request = &ModifyResourceGroupRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyResourceGroup", "rds", "openAPI") + request.InitWithApiInfo("Dds", "2015-12-01", "ModifyResourceGroup", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_security_group_configuration.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_security_group_configuration.go index a6b7b5c8af3..15f40b8f49a 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_security_group_configuration.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_security_group_configuration.go @@ -91,7 +91,7 @@ func CreateModifySecurityGroupConfigurationRequest() (request *ModifySecurityGro request = &ModifySecurityGroupConfigurationRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "ModifySecurityGroupConfiguration", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "ModifySecurityGroupConfiguration", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_security_ips.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_security_ips.go index f08ca7c7037..b4dacc540df 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_security_ips.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/modify_security_ips.go @@ -94,7 +94,7 @@ func CreateModifySecurityIpsRequest() (request *ModifySecurityIpsRequest) { request = &ModifySecurityIpsRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "ModifySecurityIps", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "ModifySecurityIps", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/release_node_private_network_address.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/release_node_private_network_address.go index 3a8a17e96d9..e6cc786825a 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/release_node_private_network_address.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/release_node_private_network_address.go @@ -92,7 +92,7 @@ func CreateReleaseNodePrivateNetworkAddressRequest() (request *ReleaseNodePrivat request = &ReleaseNodePrivateNetworkAddressRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "ReleaseNodePrivateNetworkAddress", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "ReleaseNodePrivateNetworkAddress", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/release_public_network_address.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/release_public_network_address.go index bbf7a40a900..e92a64a0cd7 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/release_public_network_address.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/release_public_network_address.go @@ -91,7 +91,7 @@ func CreateReleasePublicNetworkAddressRequest() (request *ReleasePublicNetworkAd request = &ReleasePublicNetworkAddressRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "ReleasePublicNetworkAddress", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "ReleasePublicNetworkAddress", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/renew_db_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/renew_db_instance.go index 35cc103e44d..0a5395ebccf 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/renew_db_instance.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/renew_db_instance.go @@ -96,7 +96,7 @@ func CreateRenewDBInstanceRequest() (request *RenewDBInstanceRequest) { request = &RenewDBInstanceRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "RenewDBInstance", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "RenewDBInstance", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/reset_account_password.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/reset_account_password.go index 54827882426..7c372d69c6f 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/reset_account_password.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/reset_account_password.go @@ -92,7 +92,7 @@ func CreateResetAccountPasswordRequest() (request *ResetAccountPasswordRequest) request = &ResetAccountPasswordRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "ResetAccountPassword", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "ResetAccountPassword", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/restart_db_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/restart_db_instance.go index 729127ecffd..9a9051d8a0f 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/restart_db_instance.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/restart_db_instance.go @@ -91,7 +91,7 @@ func CreateRestartDBInstanceRequest() (request *RestartDBInstanceRequest) { request = &RestartDBInstanceRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "RestartDBInstance", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "RestartDBInstance", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/restore_db_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/restore_db_instance.go index 75d3b8fdfef..170fdd7a2f3 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/restore_db_instance.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/restore_db_instance.go @@ -91,7 +91,7 @@ func CreateRestoreDBInstanceRequest() (request *RestoreDBInstanceRequest) { request = &RestoreDBInstanceRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "RestoreDBInstance", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "RestoreDBInstance", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/switch_db_instance_ha.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/switch_db_instance_ha.go index 95562fe391f..2931da6240b 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/switch_db_instance_ha.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/switch_db_instance_ha.go @@ -93,7 +93,7 @@ func CreateSwitchDBInstanceHARequest() (request *SwitchDBInstanceHARequest) { request = &SwitchDBInstanceHARequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "SwitchDBInstanceHA", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "SwitchDBInstanceHA", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/tag_resources.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/tag_resources.go index 4d73992b2e1..883954d7d27 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/tag_resources.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/tag_resources.go @@ -98,7 +98,7 @@ func CreateTagResourcesRequest() (request *TagResourcesRequest) { request = &TagResourcesRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "TagResources", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "TagResources", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/transform_to_pre_paid.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/transform_to_pre_paid.go index 6992328f3d5..703377ccd5e 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/transform_to_pre_paid.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/transform_to_pre_paid.go @@ -98,7 +98,7 @@ func CreateTransformToPrePaidRequest() (request *TransformToPrePaidRequest) { request = &TransformToPrePaidRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "TransformToPrePaid", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "TransformToPrePaid", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/untag_resources.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/untag_resources.go index 88bd469ddeb..3d5dde5d66a 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/untag_resources.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/untag_resources.go @@ -93,7 +93,7 @@ func CreateUntagResourcesRequest() (request *UntagResourcesRequest) { request = &UntagResourcesRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "UntagResources", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "UntagResources", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/upgrade_db_instance_engine_version.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/upgrade_db_instance_engine_version.go index fac2f00a51d..fc191526d6c 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/upgrade_db_instance_engine_version.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/upgrade_db_instance_engine_version.go @@ -91,7 +91,7 @@ func CreateUpgradeDBInstanceEngineVersionRequest() (request *UpgradeDBInstanceEn request = &UpgradeDBInstanceEngineVersionRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "UpgradeDBInstanceEngineVersion", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "UpgradeDBInstanceEngineVersion", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/upgrade_db_instance_kernel_version.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/upgrade_db_instance_kernel_version.go index 9c3efd06175..0ea6f494663 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/upgrade_db_instance_kernel_version.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/dds/upgrade_db_instance_kernel_version.go @@ -90,7 +90,7 @@ func CreateUpgradeDBInstanceKernelVersionRequest() (request *UpgradeDBInstanceKe request = &UpgradeDBInstanceKernelVersionRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Dds", "2015-12-01", "UpgradeDBInstanceKernelVersion", "", "") + request.InitWithApiInfo("Dds", "2015-12-01", "UpgradeDBInstanceKernelVersion", "Dds", "openAPI") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/allocate_public_ip_address.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/allocate_public_ip_address.go index 1db2a15b6e2..a92f37eac29 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/allocate_public_ip_address.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/allocate_public_ip_address.go @@ -83,8 +83,8 @@ type AllocatePublicIpAddressRequest struct { // AllocatePublicIpAddressResponse is the response struct for api AllocatePublicIpAddress type AllocatePublicIpAddressResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` IpAddress string `json:"IpAddress" xml:"IpAddress"` + RequestId string `json:"RequestId" xml:"RequestId"` } // CreateAllocatePublicIpAddressRequest creates a request to invoke AllocatePublicIpAddress API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/assign_ipv6_addresses.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/assign_ipv6_addresses.go index 748dd4f536c..81111d9f290 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/assign_ipv6_addresses.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/assign_ipv6_addresses.go @@ -83,7 +83,9 @@ type AssignIpv6AddressesRequest struct { // AssignIpv6AddressesResponse is the response struct for api AssignIpv6Addresses type AssignIpv6AddressesResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` + RequestId string `json:"RequestId" xml:"RequestId"` + NetworkInterfaceId string `json:"NetworkInterfaceId" xml:"NetworkInterfaceId"` + Ipv6Sets Ipv6SetsInAssignIpv6Addresses `json:"Ipv6Sets" xml:"Ipv6Sets"` } // CreateAssignIpv6AddressesRequest creates a request to invoke AssignIpv6Addresses API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/copy_snapshot.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/copy_snapshot.go index f191d9d381a..8f6211e7ba1 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/copy_snapshot.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/copy_snapshot.go @@ -92,8 +92,8 @@ type CopySnapshotTag struct { // CopySnapshotResponse is the response struct for api CopySnapshot type CopySnapshotResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` SnapshotId string `json:"SnapshotId" xml:"SnapshotId"` + RequestId string `json:"RequestId" xml:"RequestId"` } // CreateCopySnapshotRequest creates a request to invoke CopySnapshot API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_auto_snapshot_policy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_auto_snapshot_policy.go index 677d89ab61a..51641fdf563 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_auto_snapshot_policy.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_auto_snapshot_policy.go @@ -75,6 +75,7 @@ type CreateAutoSnapshotPolicyRequest struct { CopiedSnapshotsRetentionDays requests.Integer `position:"Query" name:"CopiedSnapshotsRetentionDays"` TimePoints string `position:"Query" name:"timePoints"` RepeatWeekdays string `position:"Query" name:"repeatWeekdays"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` Tag *[]CreateAutoSnapshotPolicyTag `position:"Query" name:"Tag" type:"Repeated"` EnableCrossRegionCopy requests.Boolean `position:"Query" name:"EnableCrossRegionCopy"` ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` @@ -93,8 +94,8 @@ type CreateAutoSnapshotPolicyTag struct { // CreateAutoSnapshotPolicyResponse is the response struct for api CreateAutoSnapshotPolicy type CreateAutoSnapshotPolicyResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` AutoSnapshotPolicyId string `json:"AutoSnapshotPolicyId" xml:"AutoSnapshotPolicyId"` + RequestId string `json:"RequestId" xml:"RequestId"` } // CreateCreateAutoSnapshotPolicyRequest creates a request to invoke CreateAutoSnapshotPolicy API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_capacity_reservation.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_capacity_reservation.go index eb31bbd8132..1c328672625 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_capacity_reservation.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_capacity_reservation.go @@ -107,8 +107,8 @@ type CreateCapacityReservationTag struct { // CreateCapacityReservationResponse is the response struct for api CreateCapacityReservation type CreateCapacityReservationResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` PrivatePoolOptionsId string `json:"PrivatePoolOptionsId" xml:"PrivatePoolOptionsId"` + RequestId string `json:"RequestId" xml:"RequestId"` } // CreateCreateCapacityReservationRequest creates a request to invoke CreateCapacityReservation API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_dedicated_block_storage_cluster.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_dedicated_block_storage_cluster.go index 1ccf7ac015f..b29395a3534 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_dedicated_block_storage_cluster.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_dedicated_block_storage_cluster.go @@ -75,11 +75,11 @@ type CreateDedicatedBlockStorageClusterRequest struct { DedicatedBlockStorageClusterName string `position:"Query" name:"DedicatedBlockStorageClusterName"` ClientToken string `position:"Query" name:"ClientToken"` Description string `position:"Query" name:"Description"` + Type string `position:"Query" name:"Type"` Capacity requests.Integer `position:"Query" name:"Capacity"` Period requests.Integer `position:"Query" name:"Period"` FromApp string `position:"Query" name:"FromApp"` ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - PerformanceLevel string `position:"Query" name:"PerformanceLevel"` OwnerAccount string `position:"Query" name:"OwnerAccount"` OwnerId requests.Integer `position:"Query" name:"OwnerId"` PeriodUnit string `position:"Query" name:"PeriodUnit"` @@ -90,8 +90,8 @@ type CreateDedicatedBlockStorageClusterRequest struct { // CreateDedicatedBlockStorageClusterResponse is the response struct for api CreateDedicatedBlockStorageCluster type CreateDedicatedBlockStorageClusterResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` DedicatedBlockStorageClusterOrderId string `json:"DedicatedBlockStorageClusterOrderId" xml:"DedicatedBlockStorageClusterOrderId"` + RequestId string `json:"RequestId" xml:"RequestId"` DedicatedBlockStorageClusterId string `json:"DedicatedBlockStorageClusterId" xml:"DedicatedBlockStorageClusterId"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_disk.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_disk.go index 98b40e685ea..f45d58360c4 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_disk.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_disk.go @@ -71,30 +71,30 @@ func (client *Client) CreateDiskWithCallback(request *CreateDiskRequest, callbac // CreateDiskRequest is the request struct for api CreateDisk type CreateDiskRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - SnapshotId string `position:"Query" name:"SnapshotId"` - ClientToken string `position:"Query" name:"ClientToken"` - EncryptAlgorithm string `position:"Query" name:"EncryptAlgorithm"` - Description string `position:"Query" name:"Description"` - DiskName string `position:"Query" name:"DiskName"` - ResourceGroupId string `position:"Query" name:"ResourceGroupId"` - DiskCategory string `position:"Query" name:"DiskCategory"` - StorageSetPartitionNumber requests.Integer `position:"Query" name:"StorageSetPartitionNumber"` - MultiAttach string `position:"Query" name:"MultiAttach"` - Tag *[]CreateDiskTag `position:"Query" name:"Tag" type:"Repeated"` - AdvancedFeatures string `position:"Query" name:"AdvancedFeatures"` - Arn *[]CreateDiskArn `position:"Query" name:"Arn" type:"Repeated"` - DedicatedBlockStorageClusterId string `position:"Query" name:"DedicatedBlockStorageClusterId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - PerformanceLevel string `position:"Query" name:"PerformanceLevel"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - InstanceId string `position:"Query" name:"InstanceId"` - StorageSetId string `position:"Query" name:"StorageSetId"` - Size requests.Integer `position:"Query" name:"Size"` - Encrypted requests.Boolean `position:"Query" name:"Encrypted"` - ZoneId string `position:"Query" name:"ZoneId"` - KMSKeyId string `position:"Query" name:"KMSKeyId"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + SnapshotId string `position:"Query" name:"SnapshotId"` + ClientToken string `position:"Query" name:"ClientToken"` + EncryptAlgorithm string `position:"Query" name:"EncryptAlgorithm"` + Description string `position:"Query" name:"Description"` + DiskName string `position:"Query" name:"DiskName"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` + DiskCategory string `position:"Query" name:"DiskCategory"` + StorageSetPartitionNumber requests.Integer `position:"Query" name:"StorageSetPartitionNumber"` + MultiAttach string `position:"Query" name:"MultiAttach"` + Tag *[]CreateDiskTag `position:"Query" name:"Tag" type:"Repeated"` + AdvancedFeatures string `position:"Query" name:"AdvancedFeatures"` + Arn *[]CreateDiskArn `position:"Query" name:"Arn" type:"Repeated"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + PerformanceLevel string `position:"Query" name:"PerformanceLevel"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + InstanceId string `position:"Query" name:"InstanceId"` + StorageSetId string `position:"Query" name:"StorageSetId"` + Size requests.Integer `position:"Query" name:"Size"` + Encrypted requests.Boolean `position:"Query" name:"Encrypted"` + ZoneId string `position:"Query" name:"ZoneId"` + StorageClusterId string `position:"Query" name:"StorageClusterId"` + KMSKeyId string `position:"Query" name:"KMSKeyId"` } // CreateDiskTag is a repeated param struct in CreateDiskRequest diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_forward_entry.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_forward_entry.go index eba36d25f3a..8ef63b45867 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_forward_entry.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_forward_entry.go @@ -86,8 +86,8 @@ type CreateForwardEntryRequest struct { // CreateForwardEntryResponse is the response struct for api CreateForwardEntry type CreateForwardEntryResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` ForwardEntryId string `json:"ForwardEntryId" xml:"ForwardEntryId"` + RequestId string `json:"RequestId" xml:"RequestId"` } // CreateCreateForwardEntryRequest creates a request to invoke CreateForwardEntry API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_image.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_image.go index 29b8b64cf21..26d76af6ec4 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_image.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_image.go @@ -99,15 +99,15 @@ type CreateImageDiskDeviceMapping struct { // CreateImageTag is a repeated param struct in CreateImageRequest type CreateImageTag struct { - Value string `name:"Value"` + Value string `name:"value"` Key string `name:"Key"` } // CreateImageResponse is the response struct for api CreateImage type CreateImageResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` ImageId string `json:"ImageId" xml:"ImageId"` + RequestId string `json:"RequestId" xml:"RequestId"` } // CreateCreateImageRequest creates a request to invoke CreateImage API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_image_component.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_image_component.go index b585ab4c00d..9ed58462f75 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_image_component.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_image_component.go @@ -94,8 +94,8 @@ type CreateImageComponentTag struct { // CreateImageComponentResponse is the response struct for api CreateImageComponent type CreateImageComponentResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` ImageComponentId string `json:"ImageComponentId" xml:"ImageComponentId"` + RequestId string `json:"RequestId" xml:"RequestId"` } // CreateCreateImageComponentRequest creates a request to invoke CreateImageComponent API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_image_pipeline.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_image_pipeline.go index 73c8a8d66fe..46e0037a6d9 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_image_pipeline.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_image_pipeline.go @@ -102,8 +102,8 @@ type CreateImagePipelineTag struct { // CreateImagePipelineResponse is the response struct for api CreateImagePipeline type CreateImagePipelineResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` ImagePipelineId string `json:"ImagePipelineId" xml:"ImagePipelineId"` + RequestId string `json:"RequestId" xml:"RequestId"` } // CreateCreateImagePipelineRequest creates a request to invoke CreateImagePipeline API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_instance.go index c9b649e3a48..99396aebc3d 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_instance.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_instance.go @@ -82,6 +82,7 @@ type CreateInstanceRequest struct { PrivatePoolOptionsMatchCriteria string `position:"Query" name:"PrivatePoolOptions.MatchCriteria"` HostName string `position:"Query" name:"HostName"` Password string `position:"Query" name:"Password"` + SystemDisk string `position:"Query" name:"SystemDisk"` DeploymentSetGroupNo requests.Integer `position:"Query" name:"DeploymentSetGroupNo"` StorageSetPartitionNumber requests.Integer `position:"Query" name:"StorageSetPartitionNumber"` Tag *[]CreateInstanceTag `position:"Query" name:"Tag" type:"Repeated"` @@ -162,6 +163,7 @@ type CreateInstanceDataDisk struct { PerformanceLevel string `name:"PerformanceLevel"` EncryptAlgorithm string `name:"EncryptAlgorithm"` Description string `name:"Description"` + StorageClusterId string `name:"StorageClusterId"` Category string `name:"Category"` KMSKeyId string `name:"KMSKeyId"` Device string `name:"Device"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_network_interface.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_network_interface.go index 6699462c4c9..a8810383dbc 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_network_interface.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_network_interface.go @@ -84,6 +84,7 @@ type CreateNetworkInterfaceRequest struct { NetworkInterfaceName string `position:"Query" name:"NetworkInterfaceName"` Visible requests.Boolean `position:"Query" name:"Visible"` ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + Ipv6AddressCount requests.Integer `position:"Query" name:"Ipv6AddressCount"` OwnerAccount string `position:"Query" name:"OwnerAccount"` QueuePairNumber requests.Integer `position:"Query" name:"QueuePairNumber"` OwnerId requests.Integer `position:"Query" name:"OwnerId"` @@ -92,6 +93,7 @@ type CreateNetworkInterfaceRequest struct { VSwitchId string `position:"Query" name:"VSwitchId"` PrivateIpAddress *[]string `position:"Query" name:"PrivateIpAddress" type:"Repeated"` PrimaryIpAddress string `position:"Query" name:"PrimaryIpAddress"` + Ipv6Address *[]string `position:"Query" name:"Ipv6Address" type:"Repeated"` } // CreateNetworkInterfaceTag is a repeated param struct in CreateNetworkInterfaceRequest @@ -103,24 +105,25 @@ type CreateNetworkInterfaceTag struct { // CreateNetworkInterfaceResponse is the response struct for api CreateNetworkInterface type CreateNetworkInterfaceResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - NetworkInterfaceId string `json:"NetworkInterfaceId" xml:"NetworkInterfaceId"` Status string `json:"Status" xml:"Status"` Type string `json:"Type" xml:"Type"` VpcId string `json:"VpcId" xml:"VpcId"` - VSwitchId string `json:"VSwitchId" xml:"VSwitchId"` - ZoneId string `json:"ZoneId" xml:"ZoneId"` - PrivateIpAddress string `json:"PrivateIpAddress" xml:"PrivateIpAddress"` - MacAddress string `json:"MacAddress" xml:"MacAddress"` NetworkInterfaceName string `json:"NetworkInterfaceName" xml:"NetworkInterfaceName"` - Description string `json:"Description" xml:"Description"` - ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` + MacAddress string `json:"MacAddress" xml:"MacAddress"` + NetworkInterfaceId string `json:"NetworkInterfaceId" xml:"NetworkInterfaceId"` ServiceID int64 `json:"ServiceID" xml:"ServiceID"` - ServiceManaged bool `json:"ServiceManaged" xml:"ServiceManaged"` OwnerId string `json:"OwnerId" xml:"OwnerId"` + ServiceManaged bool `json:"ServiceManaged" xml:"ServiceManaged"` + VSwitchId string `json:"VSwitchId" xml:"VSwitchId"` + RequestId string `json:"RequestId" xml:"RequestId"` + Description string `json:"Description" xml:"Description"` + ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` + ZoneId string `json:"ZoneId" xml:"ZoneId"` + PrivateIpAddress string `json:"PrivateIpAddress" xml:"PrivateIpAddress"` SecurityGroupIds SecurityGroupIdsInCreateNetworkInterface `json:"SecurityGroupIds" xml:"SecurityGroupIds"` PrivateIpSets PrivateIpSetsInCreateNetworkInterface `json:"PrivateIpSets" xml:"PrivateIpSets"` Tags TagsInCreateNetworkInterface `json:"Tags" xml:"Tags"` + Ipv6Sets Ipv6SetsInCreateNetworkInterface `json:"Ipv6Sets" xml:"Ipv6Sets"` } // CreateCreateNetworkInterfaceRequest creates a request to invoke CreateNetworkInterface API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_snapshot.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_snapshot.go index c613e457a4b..f2a2a2eeb5e 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_snapshot.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_snapshot.go @@ -89,15 +89,15 @@ type CreateSnapshotRequest struct { // CreateSnapshotTag is a repeated param struct in CreateSnapshotRequest type CreateSnapshotTag struct { - Value string `name:"Value"` + Value string `name:"value"` Key string `name:"Key"` } // CreateSnapshotResponse is the response struct for api CreateSnapshot type CreateSnapshotResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` SnapshotId string `json:"SnapshotId" xml:"SnapshotId"` + RequestId string `json:"RequestId" xml:"RequestId"` } // CreateCreateSnapshotRequest creates a request to invoke CreateSnapshot API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_snapshot_group.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_snapshot_group.go index c4b41f0e476..e942ee0caf5 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_snapshot_group.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_snapshot_group.go @@ -71,16 +71,25 @@ func (client *Client) CreateSnapshotGroupWithCallback(request *CreateSnapshotGro // CreateSnapshotGroupRequest is the request struct for api CreateSnapshotGroup type CreateSnapshotGroupRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - InstantAccess requests.Boolean `position:"Query" name:"InstantAccess"` - ExcludeDiskId *[]string `position:"Query" name:"ExcludeDiskId" type:"Repeated"` - Description string `position:"Query" name:"Description"` - InstantAccessRetentionDays requests.Integer `position:"Query" name:"InstantAccessRetentionDays"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - InstanceId string `position:"Query" name:"InstanceId"` - Name string `position:"Query" name:"Name"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + InstantAccess requests.Boolean `position:"Query" name:"InstantAccess"` + ExcludeDiskId *[]string `position:"Query" name:"ExcludeDiskId" type:"Repeated"` + Description string `position:"Query" name:"Description"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` + InstantAccessRetentionDays requests.Integer `position:"Query" name:"InstantAccessRetentionDays"` + DiskId *[]string `position:"Query" name:"DiskId" type:"Repeated"` + Tag *[]CreateSnapshotGroupTag `position:"Query" name:"Tag" type:"Repeated"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + InstanceId string `position:"Query" name:"InstanceId"` + Name string `position:"Query" name:"Name"` +} + +// CreateSnapshotGroupTag is a repeated param struct in CreateSnapshotGroupRequest +type CreateSnapshotGroupTag struct { + Key string `name:"Key"` + Value string `name:"Value"` } // CreateSnapshotGroupResponse is the response struct for api CreateSnapshotGroup diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_auto_snapshot_policy_ex.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_auto_snapshot_policy_ex.go index 5a0f17bbb9b..37404db644d 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_auto_snapshot_policy_ex.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_auto_snapshot_policy_ex.go @@ -74,6 +74,7 @@ type DescribeAutoSnapshotPolicyExRequest struct { ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` AutoSnapshotPolicyId string `position:"Query" name:"AutoSnapshotPolicyId"` PageNumber requests.Integer `position:"Query" name:"PageNumber"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` PageSize requests.Integer `position:"Query" name:"PageSize"` Tag *[]DescribeAutoSnapshotPolicyExTag `position:"Query" name:"Tag" type:"Repeated"` ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` @@ -90,10 +91,10 @@ type DescribeAutoSnapshotPolicyExTag struct { // DescribeAutoSnapshotPolicyExResponse is the response struct for api DescribeAutoSnapshotPolicyEx type DescribeAutoSnapshotPolicyExResponse struct { *responses.BaseResponse + PageSize int `json:"PageSize" xml:"PageSize"` RequestId string `json:"RequestId" xml:"RequestId"` - TotalCount int `json:"TotalCount" xml:"TotalCount"` PageNumber int `json:"PageNumber" xml:"PageNumber"` - PageSize int `json:"PageSize" xml:"PageSize"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` AutoSnapshotPolicies AutoSnapshotPolicies `json:"AutoSnapshotPolicies" xml:"AutoSnapshotPolicies"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_capacity_reservations.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_capacity_reservations.go index e04fcc7ee79..28085812287 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_capacity_reservations.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_capacity_reservations.go @@ -97,10 +97,10 @@ type DescribeCapacityReservationsTag struct { // DescribeCapacityReservationsResponse is the response struct for api DescribeCapacityReservations type DescribeCapacityReservationsResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` NextToken string `json:"NextToken" xml:"NextToken"` - MaxResults int `json:"MaxResults" xml:"MaxResults"` + RequestId string `json:"RequestId" xml:"RequestId"` TotalCount int `json:"TotalCount" xml:"TotalCount"` + MaxResults int `json:"MaxResults" xml:"MaxResults"` CapacityReservationSet CapacityReservationSet `json:"CapacityReservationSet" xml:"CapacityReservationSet"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_cloud_assistant_status.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_cloud_assistant_status.go index 101cff195be..4f064e3cf27 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_cloud_assistant_status.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_cloud_assistant_status.go @@ -84,10 +84,10 @@ type DescribeCloudAssistantStatusRequest struct { // DescribeCloudAssistantStatusResponse is the response struct for api DescribeCloudAssistantStatus type DescribeCloudAssistantStatusResponse struct { *responses.BaseResponse + PageSize int64 `json:"PageSize" xml:"PageSize"` RequestId string `json:"RequestId" xml:"RequestId"` - TotalCount int64 `json:"TotalCount" xml:"TotalCount"` PageNumber int64 `json:"PageNumber" xml:"PageNumber"` - PageSize int64 `json:"PageSize" xml:"PageSize"` + TotalCount int64 `json:"TotalCount" xml:"TotalCount"` InstanceCloudAssistantStatusSet InstanceCloudAssistantStatusSet `json:"InstanceCloudAssistantStatusSet" xml:"InstanceCloudAssistantStatusSet"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_dedicated_block_storage_clusters.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_dedicated_block_storage_clusters.go index 3f62915640d..38cfd37c02d 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_dedicated_block_storage_clusters.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_dedicated_block_storage_clusters.go @@ -86,8 +86,8 @@ type DescribeDedicatedBlockStorageClustersRequest struct { // DescribeDedicatedBlockStorageClustersResponse is the response struct for api DescribeDedicatedBlockStorageClusters type DescribeDedicatedBlockStorageClustersResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` NextToken string `json:"NextToken" xml:"NextToken"` + RequestId string `json:"RequestId" xml:"RequestId"` DedicatedBlockStorageClusters DedicatedBlockStorageClusters `json:"DedicatedBlockStorageClusters" xml:"DedicatedBlockStorageClusters"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_dedicated_hosts.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_dedicated_hosts.go index 921fc82fe9c..935026b436c 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_dedicated_hosts.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_dedicated_hosts.go @@ -71,21 +71,22 @@ func (client *Client) DescribeDedicatedHostsWithCallback(request *DescribeDedica // DescribeDedicatedHostsRequest is the request struct for api DescribeDedicatedHosts type DescribeDedicatedHostsRequest struct { *requests.RpcRequest - DedicatedHostIds string `position:"Query" name:"DedicatedHostIds"` - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - ResourceGroupId string `position:"Query" name:"ResourceGroupId"` - LockReason string `position:"Query" name:"LockReason"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - DedicatedHostType string `position:"Query" name:"DedicatedHostType"` - Tag *[]DescribeDedicatedHostsTag `position:"Query" name:"Tag" type:"Repeated"` - NeedHostDetail string `position:"Query" name:"NeedHostDetail"` - DedicatedHostName string `position:"Query" name:"DedicatedHostName"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - ZoneId string `position:"Query" name:"ZoneId"` - Status string `position:"Query" name:"Status"` + DedicatedHostIds string `position:"Query" name:"DedicatedHostIds"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` + LockReason string `position:"Query" name:"LockReason"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + DedicatedHostClusterId string `position:"Query" name:"DedicatedHostClusterId"` + DedicatedHostType string `position:"Query" name:"DedicatedHostType"` + Tag *[]DescribeDedicatedHostsTag `position:"Query" name:"Tag" type:"Repeated"` + NeedHostDetail string `position:"Query" name:"NeedHostDetail"` + DedicatedHostName string `position:"Query" name:"DedicatedHostName"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + ZoneId string `position:"Query" name:"ZoneId"` + Status string `position:"Query" name:"Status"` } // DescribeDedicatedHostsTag is a repeated param struct in DescribeDedicatedHostsRequest @@ -97,10 +98,10 @@ type DescribeDedicatedHostsTag struct { // DescribeDedicatedHostsResponse is the response struct for api DescribeDedicatedHosts type DescribeDedicatedHostsResponse struct { *responses.BaseResponse + PageSize int `json:"PageSize" xml:"PageSize"` RequestId string `json:"RequestId" xml:"RequestId"` - TotalCount int `json:"TotalCount" xml:"TotalCount"` PageNumber int `json:"PageNumber" xml:"PageNumber"` - PageSize int `json:"PageSize" xml:"PageSize"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` DedicatedHosts DedicatedHosts `json:"DedicatedHosts" xml:"DedicatedHosts"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_image_components.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_image_components.go index 34af17001f9..0350c30d3a3 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_image_components.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_image_components.go @@ -76,6 +76,7 @@ type DescribeImageComponentsRequest struct { ResourceGroupId string `position:"Query" name:"ResourceGroupId"` NextToken string `position:"Query" name:"NextToken"` Tag *[]DescribeImageComponentsTag `position:"Query" name:"Tag" type:"Repeated"` + Owner string `position:"Query" name:"Owner"` ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` OwnerAccount string `position:"Query" name:"OwnerAccount"` OwnerId requests.Integer `position:"Query" name:"OwnerId"` @@ -92,9 +93,9 @@ type DescribeImageComponentsTag struct { // DescribeImageComponentsResponse is the response struct for api DescribeImageComponents type DescribeImageComponentsResponse struct { *responses.BaseResponse + NextToken string `json:"NextToken" xml:"NextToken"` RequestId string `json:"RequestId" xml:"RequestId"` TotalCount int `json:"TotalCount" xml:"TotalCount"` - NextToken string `json:"NextToken" xml:"NextToken"` MaxResults int `json:"MaxResults" xml:"MaxResults"` ImageComponent ImageComponent `json:"ImageComponent" xml:"ImageComponent"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_image_pipeline_executions.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_image_pipeline_executions.go index 12ef8d1d797..f29b7ba6359 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_image_pipeline_executions.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_image_pipeline_executions.go @@ -92,9 +92,9 @@ type DescribeImagePipelineExecutionsTag struct { // DescribeImagePipelineExecutionsResponse is the response struct for api DescribeImagePipelineExecutions type DescribeImagePipelineExecutionsResponse struct { *responses.BaseResponse + NextToken string `json:"NextToken" xml:"NextToken"` RequestId string `json:"RequestId" xml:"RequestId"` TotalCount int `json:"TotalCount" xml:"TotalCount"` - NextToken string `json:"NextToken" xml:"NextToken"` MaxResults int `json:"MaxResults" xml:"MaxResults"` ImagePipelineExecution ImagePipelineExecution `json:"ImagePipelineExecution" xml:"ImagePipelineExecution"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_image_pipelines.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_image_pipelines.go index fd5897cd240..a3f63718868 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_image_pipelines.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_image_pipelines.go @@ -92,9 +92,9 @@ type DescribeImagePipelinesTag struct { // DescribeImagePipelinesResponse is the response struct for api DescribeImagePipelines type DescribeImagePipelinesResponse struct { *responses.BaseResponse + NextToken string `json:"NextToken" xml:"NextToken"` RequestId string `json:"RequestId" xml:"RequestId"` TotalCount int `json:"TotalCount" xml:"TotalCount"` - NextToken string `json:"NextToken" xml:"NextToken"` MaxResults int `json:"MaxResults" xml:"MaxResults"` ImagePipeline ImagePipeline `json:"ImagePipeline" xml:"ImagePipeline"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_images.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_images.go index 2191c9b65e5..a897ffb23ac 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_images.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_images.go @@ -72,6 +72,7 @@ func (client *Client) DescribeImagesWithCallback(request *DescribeImagesRequest, type DescribeImagesRequest struct { *requests.RpcRequest ActionType string `position:"Query" name:"ActionType"` + ImageOwnerId requests.Integer `position:"Query" name:"ImageOwnerId"` ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` ImageId string `position:"Query" name:"ImageId"` SnapshotId string `position:"Query" name:"SnapshotId"` @@ -82,6 +83,7 @@ type DescribeImagesRequest struct { IsSupportIoOptimized requests.Boolean `position:"Query" name:"IsSupportIoOptimized"` ImageName string `position:"Query" name:"ImageName"` IsSupportCloudinit requests.Boolean `position:"Query" name:"IsSupportCloudinit"` + IsPublic requests.Boolean `position:"Query" name:"IsPublic"` PageSize requests.Integer `position:"Query" name:"PageSize"` InstanceType string `position:"Query" name:"InstanceType"` Tag *[]DescribeImagesTag `position:"Query" name:"Tag" type:"Repeated"` @@ -99,7 +101,7 @@ type DescribeImagesRequest struct { // DescribeImagesTag is a repeated param struct in DescribeImagesRequest type DescribeImagesTag struct { - Value string `name:"Value"` + Value string `name:"value"` Key string `name:"Key"` } @@ -112,11 +114,11 @@ type DescribeImagesFilter struct { // DescribeImagesResponse is the response struct for api DescribeImages type DescribeImagesResponse struct { *responses.BaseResponse + PageSize int `json:"PageSize" xml:"PageSize"` + PageNumber int `json:"PageNumber" xml:"PageNumber"` RequestId string `json:"RequestId" xml:"RequestId"` - RegionId string `json:"RegionId" xml:"RegionId"` TotalCount int `json:"TotalCount" xml:"TotalCount"` - PageNumber int `json:"PageNumber" xml:"PageNumber"` - PageSize int `json:"PageSize" xml:"PageSize"` + RegionId string `json:"RegionId" xml:"RegionId"` Images Images `json:"Images" xml:"Images"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_instance_history_events.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_instance_history_events.go index 27d0c098382..68731689f4f 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_instance_history_events.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_instance_history_events.go @@ -71,34 +71,42 @@ func (client *Client) DescribeInstanceHistoryEventsWithCallback(request *Describ // DescribeInstanceHistoryEventsRequest is the request struct for api DescribeInstanceHistoryEvents type DescribeInstanceHistoryEventsRequest struct { *requests.RpcRequest - EventId *[]string `position:"Query" name:"EventId" type:"Repeated"` - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - EventCycleStatus string `position:"Query" name:"EventCycleStatus"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - ImpactLevel string `position:"Query" name:"ImpactLevel"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - InstanceEventCycleStatus *[]string `position:"Query" name:"InstanceEventCycleStatus" type:"Repeated"` - EventPublishTimeEnd string `position:"Query" name:"EventPublishTime.End"` - ResourceId *[]string `position:"Query" name:"ResourceId" type:"Repeated"` - InstanceEventType *[]string `position:"Query" name:"InstanceEventType" type:"Repeated"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - NotBeforeStart string `position:"Query" name:"NotBefore.Start"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - ResourceType string `position:"Query" name:"ResourceType"` - EventPublishTimeStart string `position:"Query" name:"EventPublishTime.Start"` - InstanceId string `position:"Query" name:"InstanceId"` - NotBeforeEnd string `position:"Query" name:"NotBefore.End"` - EventType string `position:"Query" name:"EventType"` + EventId *[]string `position:"Query" name:"EventId" type:"Repeated"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + EventCycleStatus string `position:"Query" name:"EventCycleStatus"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` + ImpactLevel string `position:"Query" name:"ImpactLevel"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + InstanceEventCycleStatus *[]string `position:"Query" name:"InstanceEventCycleStatus" type:"Repeated"` + Tag *[]DescribeInstanceHistoryEventsTag `position:"Query" name:"Tag" type:"Repeated"` + EventPublishTimeEnd string `position:"Query" name:"EventPublishTime.End"` + ResourceId *[]string `position:"Query" name:"ResourceId" type:"Repeated"` + InstanceEventType *[]string `position:"Query" name:"InstanceEventType" type:"Repeated"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + NotBeforeStart string `position:"Query" name:"NotBefore.Start"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + ResourceType string `position:"Query" name:"ResourceType"` + EventPublishTimeStart string `position:"Query" name:"EventPublishTime.Start"` + InstanceId string `position:"Query" name:"InstanceId"` + NotBeforeEnd string `position:"Query" name:"NotBefore.End"` + EventType string `position:"Query" name:"EventType"` +} + +// DescribeInstanceHistoryEventsTag is a repeated param struct in DescribeInstanceHistoryEventsRequest +type DescribeInstanceHistoryEventsTag struct { + Key string `name:"Key"` + Value string `name:"Value"` } // DescribeInstanceHistoryEventsResponse is the response struct for api DescribeInstanceHistoryEvents type DescribeInstanceHistoryEventsResponse struct { *responses.BaseResponse + PageSize int `json:"PageSize" xml:"PageSize"` RequestId string `json:"RequestId" xml:"RequestId"` - TotalCount int `json:"TotalCount" xml:"TotalCount"` PageNumber int `json:"PageNumber" xml:"PageNumber"` - PageSize int `json:"PageSize" xml:"PageSize"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` InstanceSystemEventSet InstanceSystemEventSet `json:"InstanceSystemEventSet" xml:"InstanceSystemEventSet"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_instance_modification_price.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_instance_modification_price.go index ab5425b37cc..60dd8b78e00 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_instance_modification_price.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_instance_modification_price.go @@ -83,9 +83,9 @@ type DescribeInstanceModificationPriceRequest struct { // DescribeInstanceModificationPriceDataDisk is a repeated param struct in DescribeInstanceModificationPriceRequest type DescribeInstanceModificationPriceDataDisk struct { + PerformanceLevel string `name:"PerformanceLevel"` Size string `name:"Size"` Category string `name:"Category"` - PerformanceLevel string `name:"PerformanceLevel"` } // DescribeInstanceModificationPriceResponse is the response struct for api DescribeInstanceModificationPrice diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_instance_types.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_instance_types.go index 97ddc6d777d..9f6389f8451 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_instance_types.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_instance_types.go @@ -73,16 +73,19 @@ type DescribeInstanceTypesRequest struct { *requests.RpcRequest ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` InstanceTypes *[]string `position:"Query" name:"InstanceTypes" type:"Repeated"` + NextToken string `position:"Query" name:"NextToken"` ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` OwnerAccount string `position:"Query" name:"OwnerAccount"` InstanceTypeFamily string `position:"Query" name:"InstanceTypeFamily"` OwnerId requests.Integer `position:"Query" name:"OwnerId"` + MaxResults requests.Integer `position:"Query" name:"MaxResults"` } // DescribeInstanceTypesResponse is the response struct for api DescribeInstanceTypes type DescribeInstanceTypesResponse struct { *responses.BaseResponse RequestId string `json:"RequestId" xml:"RequestId"` + NextToken string `json:"NextToken" xml:"NextToken"` InstanceTypes InstanceTypesInDescribeInstanceTypes `json:"InstanceTypes" xml:"InstanceTypes"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_price.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_price.go index 44181620fa8..b7ccf82f0d6 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_price.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_price.go @@ -82,7 +82,9 @@ type DescribePriceRequest struct { AssuranceTimes string `position:"Query" name:"AssuranceTimes"` OwnerId requests.Integer `position:"Query" name:"OwnerId"` InstanceCpuCoreCount requests.Integer `position:"Query" name:"InstanceCpuCoreCount"` + SpotStrategy string `position:"Query" name:"SpotStrategy"` InternetChargeType string `position:"Query" name:"InternetChargeType"` + ZoneId string `position:"Query" name:"ZoneId"` InstanceNetworkType string `position:"Query" name:"InstanceNetworkType"` InstanceAmount requests.Integer `position:"Query" name:"InstanceAmount"` InstanceTypeList *[]string `position:"Query" name:"InstanceTypeList" type:"Repeated"` @@ -105,6 +107,7 @@ type DescribePriceRequest struct { ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` OwnerAccount string `position:"Query" name:"OwnerAccount"` DataDisk2Size requests.Integer `position:"Query" name:"DataDisk.2.Size"` + SpotDuration requests.Integer `position:"Query" name:"SpotDuration"` ResourceType string `position:"Query" name:"ResourceType"` DataDisk1Category string `position:"Query" name:"DataDisk.1.Category"` DataDisk2PerformanceLevel string `position:"Query" name:"DataDisk.2.PerformanceLevel"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_security_groups.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_security_groups.go index da88e742b00..ee11481fa99 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_security_groups.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_security_groups.go @@ -79,6 +79,7 @@ type DescribeSecurityGroupsRequest struct { SecurityGroupName string `position:"Query" name:"SecurityGroupName"` PageNumber requests.Integer `position:"Query" name:"PageNumber"` ResourceGroupId string `position:"Query" name:"ResourceGroupId"` + NextToken string `position:"Query" name:"NextToken"` PageSize requests.Integer `position:"Query" name:"PageSize"` Tag *[]DescribeSecurityGroupsTag `position:"Query" name:"Tag" type:"Repeated"` DryRun requests.Boolean `position:"Query" name:"DryRun"` @@ -88,22 +89,24 @@ type DescribeSecurityGroupsRequest struct { SecurityGroupIds string `position:"Query" name:"SecurityGroupIds"` SecurityGroupType string `position:"Query" name:"SecurityGroupType"` VpcId string `position:"Query" name:"VpcId"` + MaxResults requests.Integer `position:"Query" name:"MaxResults"` } // DescribeSecurityGroupsTag is a repeated param struct in DescribeSecurityGroupsRequest type DescribeSecurityGroupsTag struct { - Value string `name:"Value"` + Value string `name:"value"` Key string `name:"Key"` } // DescribeSecurityGroupsResponse is the response struct for api DescribeSecurityGroups type DescribeSecurityGroupsResponse struct { *responses.BaseResponse + PageSize int `json:"PageSize" xml:"PageSize"` + PageNumber int `json:"PageNumber" xml:"PageNumber"` RequestId string `json:"RequestId" xml:"RequestId"` - RegionId string `json:"RegionId" xml:"RegionId"` TotalCount int `json:"TotalCount" xml:"TotalCount"` - PageNumber int `json:"PageNumber" xml:"PageNumber"` - PageSize int `json:"PageSize" xml:"PageSize"` + RegionId string `json:"RegionId" xml:"RegionId"` + NextToken string `json:"NextToken" xml:"NextToken"` SecurityGroups SecurityGroups `json:"SecurityGroups" xml:"SecurityGroups"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_snapshot_groups.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_snapshot_groups.go index 76915dad927..0117b489263 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_snapshot_groups.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_snapshot_groups.go @@ -71,24 +71,32 @@ func (client *Client) DescribeSnapshotGroupsWithCallback(request *DescribeSnapsh // DescribeSnapshotGroupsRequest is the request struct for api DescribeSnapshotGroups type DescribeSnapshotGroupsRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - NextToken string `position:"Query" name:"NextToken"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - SnapshotGroupId *[]string `position:"Query" name:"SnapshotGroupId" type:"Repeated"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - AdditionalAttributes *[]string `position:"Query" name:"AdditionalAttributes" type:"Repeated"` - InstanceId string `position:"Query" name:"InstanceId"` - Name string `position:"Query" name:"Name"` - MaxResults requests.Integer `position:"Query" name:"MaxResults"` - Status *[]string `position:"Query" name:"Status" type:"Repeated"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` + NextToken string `position:"Query" name:"NextToken"` + Tag *[]DescribeSnapshotGroupsTag `position:"Query" name:"Tag" type:"Repeated"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + SnapshotGroupId *[]string `position:"Query" name:"SnapshotGroupId" type:"Repeated"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + AdditionalAttributes *[]string `position:"Query" name:"AdditionalAttributes" type:"Repeated"` + InstanceId string `position:"Query" name:"InstanceId"` + Name string `position:"Query" name:"Name"` + MaxResults requests.Integer `position:"Query" name:"MaxResults"` + Status *[]string `position:"Query" name:"Status" type:"Repeated"` +} + +// DescribeSnapshotGroupsTag is a repeated param struct in DescribeSnapshotGroupsRequest +type DescribeSnapshotGroupsTag struct { + Key string `name:"Key"` + Value string `name:"Value"` } // DescribeSnapshotGroupsResponse is the response struct for api DescribeSnapshotGroups type DescribeSnapshotGroupsResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` NextToken string `json:"NextToken" xml:"NextToken"` + RequestId string `json:"RequestId" xml:"RequestId"` SnapshotGroups SnapshotGroups `json:"SnapshotGroups" xml:"SnapshotGroups"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_snapshot_links.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_snapshot_links.go index 6e8160ba7b0..9bdb4d5e9f1 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_snapshot_links.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_snapshot_links.go @@ -85,10 +85,10 @@ type DescribeSnapshotLinksRequest struct { // DescribeSnapshotLinksResponse is the response struct for api DescribeSnapshotLinks type DescribeSnapshotLinksResponse struct { *responses.BaseResponse + PageSize int `json:"PageSize" xml:"PageSize"` RequestId string `json:"RequestId" xml:"RequestId"` - TotalCount int `json:"TotalCount" xml:"TotalCount"` PageNumber int `json:"PageNumber" xml:"PageNumber"` - PageSize int `json:"PageSize" xml:"PageSize"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` SnapshotLinks SnapshotLinks `json:"SnapshotLinks" xml:"SnapshotLinks"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_snapshots.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_snapshots.go index 4527873afcf..b70aeeab90e 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_snapshots.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_snapshots.go @@ -102,18 +102,18 @@ type DescribeSnapshotsRequest struct { // DescribeSnapshotsTag is a repeated param struct in DescribeSnapshotsRequest type DescribeSnapshotsTag struct { - Value string `name:"Value"` + Value string `name:"value"` Key string `name:"Key"` } // DescribeSnapshotsResponse is the response struct for api DescribeSnapshots type DescribeSnapshotsResponse struct { *responses.BaseResponse + NextToken string `json:"NextToken" xml:"NextToken"` + PageSize int `json:"PageSize" xml:"PageSize"` + PageNumber int `json:"PageNumber" xml:"PageNumber"` RequestId string `json:"RequestId" xml:"RequestId"` TotalCount int `json:"TotalCount" xml:"TotalCount"` - PageNumber int `json:"PageNumber" xml:"PageNumber"` - PageSize int `json:"PageSize" xml:"PageSize"` - NextToken string `json:"NextToken" xml:"NextToken"` Snapshots SnapshotsInDescribeSnapshots `json:"Snapshots" xml:"Snapshots"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_storage_capacity_units.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_storage_capacity_units.go index 346145c5a4a..5adc5328123 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_storage_capacity_units.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_storage_capacity_units.go @@ -71,26 +71,33 @@ func (client *Client) DescribeStorageCapacityUnitsWithCallback(request *Describe // DescribeStorageCapacityUnitsRequest is the request struct for api DescribeStorageCapacityUnits type DescribeStorageCapacityUnitsRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - Capacity requests.Integer `position:"Query" name:"Capacity"` - StorageCapacityUnitId *[]string `position:"Query" name:"StorageCapacityUnitId" type:"Repeated"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - Name string `position:"Query" name:"Name"` - Status *[]string `position:"Query" name:"Status" type:"Repeated"` - AllocationType string `position:"Query" name:"AllocationType"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` + Capacity requests.Integer `position:"Query" name:"Capacity"` + StorageCapacityUnitId *[]string `position:"Query" name:"StorageCapacityUnitId" type:"Repeated"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + Tag *[]DescribeStorageCapacityUnitsTag `position:"Query" name:"Tag" type:"Repeated"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + Name string `position:"Query" name:"Name"` + AllocationType string `position:"Query" name:"AllocationType"` + Status *[]string `position:"Query" name:"Status" type:"Repeated"` +} + +// DescribeStorageCapacityUnitsTag is a repeated param struct in DescribeStorageCapacityUnitsRequest +type DescribeStorageCapacityUnitsTag struct { + Key string `name:"Key"` + Value string `name:"Value"` } // DescribeStorageCapacityUnitsResponse is the response struct for api DescribeStorageCapacityUnits type DescribeStorageCapacityUnitsResponse struct { *responses.BaseResponse + PageSize int `json:"PageSize" xml:"PageSize"` RequestId string `json:"RequestId" xml:"RequestId"` - TotalCount int `json:"TotalCount" xml:"TotalCount"` PageNumber int `json:"PageNumber" xml:"PageNumber"` - PageSize int `json:"PageSize" xml:"PageSize"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` StorageCapacityUnits StorageCapacityUnits `json:"StorageCapacityUnits" xml:"StorageCapacityUnits"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/import_image.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/import_image.go index cc17c5c1412..7315b441012 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/import_image.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/import_image.go @@ -107,9 +107,9 @@ type ImportImageTag struct { type ImportImageResponse struct { *responses.BaseResponse RequestId string `json:"RequestId" xml:"RequestId"` + ImageId string `json:"ImageId" xml:"ImageId"` TaskId string `json:"TaskId" xml:"TaskId"` RegionId string `json:"RegionId" xml:"RegionId"` - ImageId string `json:"ImageId" xml:"ImageId"` } // CreateImportImageRequest creates a request to invoke ImportImage API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/list_tag_resources.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/list_tag_resources.go index ac1f5c2cfea..11e7a93e0ef 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/list_tag_resources.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/list_tag_resources.go @@ -90,15 +90,15 @@ type ListTagResourcesTag struct { // ListTagResourcesTagFilter is a repeated param struct in ListTagResourcesRequest type ListTagResourcesTagFilter struct { - TagKey string `name:"TagKey"` TagValues *[]string `name:"TagValues" type:"Repeated"` + TagKey string `name:"TagKey"` } // ListTagResourcesResponse is the response struct for api ListTagResources type ListTagResourcesResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` NextToken string `json:"NextToken" xml:"NextToken"` + RequestId string `json:"RequestId" xml:"RequestId"` TagResources TagResources `json:"TagResources" xml:"TagResources"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/modify_dedicated_host_auto_renew_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/modify_dedicated_host_auto_renew_attribute.go index 690845d2b39..3ba9bcbb89e 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/modify_dedicated_host_auto_renew_attribute.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/modify_dedicated_host_auto_renew_attribute.go @@ -75,6 +75,7 @@ type ModifyDedicatedHostAutoRenewAttributeRequest struct { ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` Duration requests.Integer `position:"Query" name:"Duration"` RenewalStatus string `position:"Query" name:"RenewalStatus"` + AutoRenewWithEcs string `position:"Query" name:"AutoRenewWithEcs"` ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` OwnerAccount string `position:"Query" name:"OwnerAccount"` OwnerId requests.Integer `position:"Query" name:"OwnerId"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/modify_image_share_permission.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/modify_image_share_permission.go index 0642075232d..99656f9aa96 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/modify_image_share_permission.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/modify_image_share_permission.go @@ -73,6 +73,7 @@ type ModifyImageSharePermissionRequest struct { *requests.RpcRequest ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` ImageId string `position:"Query" name:"ImageId"` + IsPublic requests.Boolean `position:"Query" name:"IsPublic"` LaunchPermission string `position:"Query" name:"LaunchPermission"` ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` OwnerAccount string `position:"Query" name:"OwnerAccount"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/modify_instance_charge_type.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/modify_instance_charge_type.go index 79c71fc1982..d7474bfecb0 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/modify_instance_charge_type.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/modify_instance_charge_type.go @@ -89,8 +89,8 @@ type ModifyInstanceChargeTypeRequest struct { // ModifyInstanceChargeTypeResponse is the response struct for api ModifyInstanceChargeType type ModifyInstanceChargeTypeResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` OrderId string `json:"OrderId" xml:"OrderId"` + RequestId string `json:"RequestId" xml:"RequestId"` FeeOfInstances FeeOfInstancesInModifyInstanceChargeType `json:"FeeOfInstances" xml:"FeeOfInstances"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/purchase_storage_capacity_unit.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/purchase_storage_capacity_unit.go index 4ab28556b20..ba0f01d4491 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/purchase_storage_capacity_unit.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/purchase_storage_capacity_unit.go @@ -71,26 +71,33 @@ func (client *Client) PurchaseStorageCapacityUnitWithCallback(request *PurchaseS // PurchaseStorageCapacityUnitRequest is the request struct for api PurchaseStorageCapacityUnit type PurchaseStorageCapacityUnitRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ClientToken string `position:"Query" name:"ClientToken"` - Description string `position:"Query" name:"Description"` - StartTime string `position:"Query" name:"StartTime"` - Capacity requests.Integer `position:"Query" name:"Capacity"` - Period requests.Integer `position:"Query" name:"Period"` - Amount requests.Integer `position:"Query" name:"Amount"` - FromApp string `position:"Query" name:"FromApp"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - PeriodUnit string `position:"Query" name:"PeriodUnit"` - Name string `position:"Query" name:"Name"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ClientToken string `position:"Query" name:"ClientToken"` + Description string `position:"Query" name:"Description"` + StartTime string `position:"Query" name:"StartTime"` + Capacity requests.Integer `position:"Query" name:"Capacity"` + Tag *[]PurchaseStorageCapacityUnitTag `position:"Query" name:"Tag" type:"Repeated"` + Period requests.Integer `position:"Query" name:"Period"` + Amount requests.Integer `position:"Query" name:"Amount"` + FromApp string `position:"Query" name:"FromApp"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + PeriodUnit string `position:"Query" name:"PeriodUnit"` + Name string `position:"Query" name:"Name"` +} + +// PurchaseStorageCapacityUnitTag is a repeated param struct in PurchaseStorageCapacityUnitRequest +type PurchaseStorageCapacityUnitTag struct { + Key string `name:"Key"` + Value string `name:"Value"` } // PurchaseStorageCapacityUnitResponse is the response struct for api PurchaseStorageCapacityUnit type PurchaseStorageCapacityUnitResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` OrderId string `json:"OrderId" xml:"OrderId"` + RequestId string `json:"RequestId" xml:"RequestId"` StorageCapacityUnitIds StorageCapacityUnitIds `json:"StorageCapacityUnitIds" xml:"StorageCapacityUnitIds"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/run_instances.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/run_instances.go index 19a2d338c12..7c6f1d14639 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/run_instances.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/run_instances.go @@ -71,89 +71,91 @@ func (client *Client) RunInstancesWithCallback(request *RunInstancesRequest, cal // RunInstancesRequest is the request struct for api RunInstances type RunInstancesRequest struct { *requests.RpcRequest - UniqueSuffix requests.Boolean `position:"Query" name:"UniqueSuffix"` - SecurityEnhancementStrategy string `position:"Query" name:"SecurityEnhancementStrategy"` - MinAmount requests.Integer `position:"Query" name:"MinAmount"` - DeletionProtection requests.Boolean `position:"Query" name:"DeletionProtection"` - ResourceGroupId string `position:"Query" name:"ResourceGroupId"` - PrivatePoolOptionsMatchCriteria string `position:"Query" name:"PrivatePoolOptions.MatchCriteria"` - HostName string `position:"Query" name:"HostName"` - Password string `position:"Query" name:"Password"` - DeploymentSetGroupNo requests.Integer `position:"Query" name:"DeploymentSetGroupNo"` - SystemDiskAutoSnapshotPolicyId string `position:"Query" name:"SystemDisk.AutoSnapshotPolicyId"` - CpuOptionsCore requests.Integer `position:"Query" name:"CpuOptions.Core"` - Period requests.Integer `position:"Query" name:"Period"` - DryRun requests.Boolean `position:"Query" name:"DryRun"` - CpuOptionsNuma string `position:"Query" name:"CpuOptions.Numa"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - SpotStrategy string `position:"Query" name:"SpotStrategy"` - PrivateIpAddress string `position:"Query" name:"PrivateIpAddress"` - PeriodUnit string `position:"Query" name:"PeriodUnit"` - AutoRenew requests.Boolean `position:"Query" name:"AutoRenew"` - InternetChargeType string `position:"Query" name:"InternetChargeType"` - InternetMaxBandwidthIn requests.Integer `position:"Query" name:"InternetMaxBandwidthIn"` - Affinity string `position:"Query" name:"Affinity"` - ImageId string `position:"Query" name:"ImageId"` - SpotInterruptionBehavior string `position:"Query" name:"SpotInterruptionBehavior"` - NetworkInterfaceQueueNumber requests.Integer `position:"Query" name:"NetworkInterfaceQueueNumber"` - IoOptimized string `position:"Query" name:"IoOptimized"` - SecurityGroupId string `position:"Query" name:"SecurityGroupId"` - HibernationOptionsConfigured requests.Boolean `position:"Query" name:"HibernationOptions.Configured"` - SystemDiskPerformanceLevel string `position:"Query" name:"SystemDisk.PerformanceLevel"` - PasswordInherit requests.Boolean `position:"Query" name:"PasswordInherit"` - InstanceType string `position:"Query" name:"InstanceType"` - Arn *[]RunInstancesArn `position:"Query" name:"Arn" type:"Repeated"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - SchedulerOptionsDedicatedHostClusterId string `position:"Query" name:"SchedulerOptions.DedicatedHostClusterId"` - SystemDiskDiskName string `position:"Query" name:"SystemDisk.DiskName"` - DedicatedHostId string `position:"Query" name:"DedicatedHostId"` - SpotDuration requests.Integer `position:"Query" name:"SpotDuration"` - SecurityGroupIds *[]string `position:"Query" name:"SecurityGroupIds" type:"Repeated"` - SystemDiskSize string `position:"Query" name:"SystemDisk.Size"` - ImageFamily string `position:"Query" name:"ImageFamily"` - LaunchTemplateName string `position:"Query" name:"LaunchTemplateName"` - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - HpcClusterId string `position:"Query" name:"HpcClusterId"` - HttpPutResponseHopLimit requests.Integer `position:"Query" name:"HttpPutResponseHopLimit"` - Isp string `position:"Query" name:"Isp"` - KeyPairName string `position:"Query" name:"KeyPairName"` - SpotPriceLimit requests.Float `position:"Query" name:"SpotPriceLimit"` - StorageSetPartitionNumber requests.Integer `position:"Query" name:"StorageSetPartitionNumber"` - Tag *[]RunInstancesTag `position:"Query" name:"Tag" type:"Repeated"` - PrivatePoolOptionsId string `position:"Query" name:"PrivatePoolOptions.Id"` - AutoRenewPeriod requests.Integer `position:"Query" name:"AutoRenewPeriod"` - LaunchTemplateId string `position:"Query" name:"LaunchTemplateId"` - Ipv6AddressCount requests.Integer `position:"Query" name:"Ipv6AddressCount"` - HostNames *[]string `position:"Query" name:"HostNames" type:"Repeated"` - CapacityReservationPreference string `position:"Query" name:"CapacityReservationPreference"` - VSwitchId string `position:"Query" name:"VSwitchId"` - InstanceName string `position:"Query" name:"InstanceName"` - ZoneId string `position:"Query" name:"ZoneId"` - Ipv6Address *[]string `position:"Query" name:"Ipv6Address" type:"Repeated"` - ClientToken string `position:"Query" name:"ClientToken"` - InternetMaxBandwidthOut requests.Integer `position:"Query" name:"InternetMaxBandwidthOut"` - Description string `position:"Query" name:"Description"` - CpuOptionsThreadsPerCore requests.Integer `position:"Query" name:"CpuOptions.ThreadsPerCore"` - SystemDiskCategory string `position:"Query" name:"SystemDisk.Category"` - SecurityOptionsTrustedSystemMode string `position:"Query" name:"SecurityOptions.TrustedSystemMode"` - CapacityReservationId string `position:"Query" name:"CapacityReservationId"` - UserData string `position:"Query" name:"UserData"` - HttpEndpoint string `position:"Query" name:"HttpEndpoint"` - InstanceChargeType string `position:"Query" name:"InstanceChargeType"` - DeploymentSetId string `position:"Query" name:"DeploymentSetId"` - NetworkInterface *[]RunInstancesNetworkInterface `position:"Query" name:"NetworkInterface" type:"Repeated"` - Amount requests.Integer `position:"Query" name:"Amount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - Tenancy string `position:"Query" name:"Tenancy"` - RamRoleName string `position:"Query" name:"RamRoleName"` - AutoReleaseTime string `position:"Query" name:"AutoReleaseTime"` - CreditSpecification string `position:"Query" name:"CreditSpecification"` - LaunchTemplateVersion requests.Integer `position:"Query" name:"LaunchTemplateVersion"` - SchedulerOptionsManagedPrivateSpaceId string `position:"Query" name:"SchedulerOptions.ManagedPrivateSpaceId"` - DataDisk *[]RunInstancesDataDisk `position:"Query" name:"DataDisk" type:"Repeated"` - StorageSetId string `position:"Query" name:"StorageSetId"` - HttpTokens string `position:"Query" name:"HttpTokens"` - SystemDiskDescription string `position:"Query" name:"SystemDisk.Description"` + UniqueSuffix requests.Boolean `position:"Query" name:"UniqueSuffix"` + SecurityEnhancementStrategy string `position:"Query" name:"SecurityEnhancementStrategy"` + MinAmount requests.Integer `position:"Query" name:"MinAmount"` + DeletionProtection requests.Boolean `position:"Query" name:"DeletionProtection"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` + PrivatePoolOptionsMatchCriteria string `position:"Query" name:"PrivatePoolOptions.MatchCriteria"` + HostName string `position:"Query" name:"HostName"` + Password string `position:"Query" name:"Password"` + SystemDisk string `position:"Query" name:"SystemDisk"` + DeploymentSetGroupNo requests.Integer `position:"Query" name:"DeploymentSetGroupNo"` + SystemDiskAutoSnapshotPolicyId string `position:"Query" name:"SystemDisk.AutoSnapshotPolicyId"` + CpuOptionsCore requests.Integer `position:"Query" name:"CpuOptions.Core"` + Period requests.Integer `position:"Query" name:"Period"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + CpuOptionsNuma string `position:"Query" name:"CpuOptions.Numa"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SpotStrategy string `position:"Query" name:"SpotStrategy"` + PrivateIpAddress string `position:"Query" name:"PrivateIpAddress"` + PeriodUnit string `position:"Query" name:"PeriodUnit"` + AutoRenew requests.Boolean `position:"Query" name:"AutoRenew"` + InternetChargeType string `position:"Query" name:"InternetChargeType"` + InternetMaxBandwidthIn requests.Integer `position:"Query" name:"InternetMaxBandwidthIn"` + Affinity string `position:"Query" name:"Affinity"` + ImageId string `position:"Query" name:"ImageId"` + SpotInterruptionBehavior string `position:"Query" name:"SpotInterruptionBehavior"` + NetworkInterfaceQueueNumber requests.Integer `position:"Query" name:"NetworkInterfaceQueueNumber"` + IoOptimized string `position:"Query" name:"IoOptimized"` + SecurityGroupId string `position:"Query" name:"SecurityGroupId"` + HibernationOptionsConfigured requests.Boolean `position:"Query" name:"HibernationOptions.Configured"` + SystemDiskPerformanceLevel string `position:"Query" name:"SystemDisk.PerformanceLevel"` + PasswordInherit requests.Boolean `position:"Query" name:"PasswordInherit"` + InstanceType string `position:"Query" name:"InstanceType"` + Arn *[]RunInstancesArn `position:"Query" name:"Arn" type:"Repeated"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + SchedulerOptionsDedicatedHostClusterId string `position:"Query" name:"SchedulerOptions.DedicatedHostClusterId"` + SystemDiskDiskName string `position:"Query" name:"SystemDisk.DiskName"` + DedicatedHostId string `position:"Query" name:"DedicatedHostId"` + SpotDuration requests.Integer `position:"Query" name:"SpotDuration"` + SecurityGroupIds *[]string `position:"Query" name:"SecurityGroupIds" type:"Repeated"` + SystemDiskSize string `position:"Query" name:"SystemDisk.Size"` + ImageFamily string `position:"Query" name:"ImageFamily"` + LaunchTemplateName string `position:"Query" name:"LaunchTemplateName"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + HpcClusterId string `position:"Query" name:"HpcClusterId"` + HttpPutResponseHopLimit requests.Integer `position:"Query" name:"HttpPutResponseHopLimit"` + Isp string `position:"Query" name:"Isp"` + KeyPairName string `position:"Query" name:"KeyPairName"` + SpotPriceLimit requests.Float `position:"Query" name:"SpotPriceLimit"` + StorageSetPartitionNumber requests.Integer `position:"Query" name:"StorageSetPartitionNumber"` + Tag *[]RunInstancesTag `position:"Query" name:"Tag" type:"Repeated"` + PrivatePoolOptionsId string `position:"Query" name:"PrivatePoolOptions.Id"` + AutoRenewPeriod requests.Integer `position:"Query" name:"AutoRenewPeriod"` + LaunchTemplateId string `position:"Query" name:"LaunchTemplateId"` + Ipv6AddressCount requests.Integer `position:"Query" name:"Ipv6AddressCount"` + HostNames *[]string `position:"Query" name:"HostNames" type:"Repeated"` + CapacityReservationPreference string `position:"Query" name:"CapacityReservationPreference"` + VSwitchId string `position:"Query" name:"VSwitchId"` + InstanceName string `position:"Query" name:"InstanceName"` + ZoneId string `position:"Query" name:"ZoneId"` + Ipv6Address *[]string `position:"Query" name:"Ipv6Address" type:"Repeated"` + SecurityOptionsConfidentialComputingMode string `position:"Query" name:"SecurityOptions.ConfidentialComputingMode"` + ClientToken string `position:"Query" name:"ClientToken"` + InternetMaxBandwidthOut requests.Integer `position:"Query" name:"InternetMaxBandwidthOut"` + Description string `position:"Query" name:"Description"` + CpuOptionsThreadsPerCore requests.Integer `position:"Query" name:"CpuOptions.ThreadsPerCore"` + SystemDiskCategory string `position:"Query" name:"SystemDisk.Category"` + SecurityOptionsTrustedSystemMode string `position:"Query" name:"SecurityOptions.TrustedSystemMode"` + CapacityReservationId string `position:"Query" name:"CapacityReservationId"` + UserData string `position:"Query" name:"UserData"` + HttpEndpoint string `position:"Query" name:"HttpEndpoint"` + InstanceChargeType string `position:"Query" name:"InstanceChargeType"` + DeploymentSetId string `position:"Query" name:"DeploymentSetId"` + NetworkInterface *[]RunInstancesNetworkInterface `position:"Query" name:"NetworkInterface" type:"Repeated"` + Amount requests.Integer `position:"Query" name:"Amount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + Tenancy string `position:"Query" name:"Tenancy"` + RamRoleName string `position:"Query" name:"RamRoleName"` + AutoReleaseTime string `position:"Query" name:"AutoReleaseTime"` + CreditSpecification string `position:"Query" name:"CreditSpecification"` + LaunchTemplateVersion requests.Integer `position:"Query" name:"LaunchTemplateVersion"` + SchedulerOptionsManagedPrivateSpaceId string `position:"Query" name:"SchedulerOptions.ManagedPrivateSpaceId"` + DataDisk *[]RunInstancesDataDisk `position:"Query" name:"DataDisk" type:"Repeated"` + StorageSetId string `position:"Query" name:"StorageSetId"` + HttpTokens string `position:"Query" name:"HttpTokens"` + SystemDiskDescription string `position:"Query" name:"SystemDisk.Description"` } // RunInstancesArn is a repeated param struct in RunInstancesRequest @@ -194,6 +196,7 @@ type RunInstancesDataDisk struct { EncryptAlgorithm string `name:"EncryptAlgorithm"` DeleteWithInstance string `name:"DeleteWithInstance"` KMSKeyId string `name:"KMSKeyId"` + StorageClusterId string `name:"StorageClusterId"` } // RunInstancesResponse is the response struct for api RunInstances diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/start_image_pipeline_execution.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/start_image_pipeline_execution.go index efec868eb18..04afe3b8b17 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/start_image_pipeline_execution.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/start_image_pipeline_execution.go @@ -89,8 +89,8 @@ type StartImagePipelineExecutionTemplateTag struct { // StartImagePipelineExecutionResponse is the response struct for api StartImagePipelineExecution type StartImagePipelineExecutionResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` ExecutionId string `json:"ExecutionId" xml:"ExecutionId"` + RequestId string `json:"RequestId" xml:"RequestId"` } // CreateStartImagePipelineExecutionRequest creates a request to invoke StartImagePipelineExecution API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/start_terminal_session.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/start_terminal_session.go new file mode 100644 index 00000000000..920f5a50162 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/start_terminal_session.go @@ -0,0 +1,106 @@ +package ecs + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// StartTerminalSession invokes the ecs.StartTerminalSession API synchronously +func (client *Client) StartTerminalSession(request *StartTerminalSessionRequest) (response *StartTerminalSessionResponse, err error) { + response = CreateStartTerminalSessionResponse() + err = client.DoAction(request, response) + return +} + +// StartTerminalSessionWithChan invokes the ecs.StartTerminalSession API asynchronously +func (client *Client) StartTerminalSessionWithChan(request *StartTerminalSessionRequest) (<-chan *StartTerminalSessionResponse, <-chan error) { + responseChan := make(chan *StartTerminalSessionResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.StartTerminalSession(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// StartTerminalSessionWithCallback invokes the ecs.StartTerminalSession API asynchronously +func (client *Client) StartTerminalSessionWithCallback(request *StartTerminalSessionRequest, callback func(response *StartTerminalSessionResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *StartTerminalSessionResponse + var err error + defer close(result) + response, err = client.StartTerminalSession(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// StartTerminalSessionRequest is the request struct for api StartTerminalSession +type StartTerminalSessionRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + InstanceId *[]string `position:"Query" name:"InstanceId" type:"Repeated"` +} + +// StartTerminalSessionResponse is the response struct for api StartTerminalSession +type StartTerminalSessionResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + SessionId string `json:"SessionId" xml:"SessionId"` + SecurityToken string `json:"SecurityToken" xml:"SecurityToken"` + WebSocketUrl string `json:"WebSocketUrl" xml:"WebSocketUrl"` +} + +// CreateStartTerminalSessionRequest creates a request to invoke StartTerminalSession API +func CreateStartTerminalSessionRequest() (request *StartTerminalSessionRequest) { + request = &StartTerminalSessionRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Ecs", "2014-05-26", "StartTerminalSession", "ecs", "openAPI") + request.Method = requests.POST + return +} + +// CreateStartTerminalSessionResponse creates a response to parse from StartTerminalSession response +func CreateStartTerminalSessionResponse() (response *StartTerminalSessionResponse) { + response = &StartTerminalSessionResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_allocated_resource.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_allocated_resource.go index f7bca64d415..bc681925b4d 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_allocated_resource.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_allocated_resource.go @@ -18,7 +18,7 @@ package ecs // AllocatedResource is a nested struct in ecs response type AllocatedResource struct { TotalAmount int `json:"TotalAmount" xml:"TotalAmount"` - InstanceType string `json:"InstanceType" xml:"InstanceType"` UsedAmount int `json:"UsedAmount" xml:"UsedAmount"` + InstanceType string `json:"InstanceType" xml:"InstanceType"` ZoneId string `json:"zoneId" xml:"zoneId"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_auto_snapshot_policy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_auto_snapshot_policy.go index c2e8e41e86b..8c7d33241f3 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_auto_snapshot_policy.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_auto_snapshot_policy.go @@ -17,18 +17,19 @@ package ecs // AutoSnapshotPolicy is a nested struct in ecs response type AutoSnapshotPolicy struct { - AutoSnapshotPolicyId string `json:"AutoSnapshotPolicyId" xml:"AutoSnapshotPolicyId"` - RegionId string `json:"RegionId" xml:"RegionId"` - AutoSnapshotPolicyName string `json:"AutoSnapshotPolicyName" xml:"AutoSnapshotPolicyName"` TimePoints string `json:"TimePoints" xml:"TimePoints"` - RepeatWeekdays string `json:"RepeatWeekdays" xml:"RepeatWeekdays"` - RetentionDays int `json:"RetentionDays" xml:"RetentionDays"` - DiskNums int `json:"DiskNums" xml:"DiskNums"` - VolumeNums int `json:"VolumeNums" xml:"VolumeNums"` CreationTime string `json:"CreationTime" xml:"CreationTime"` Status string `json:"Status" xml:"Status"` - EnableCrossRegionCopy bool `json:"EnableCrossRegionCopy" xml:"EnableCrossRegionCopy"` + AutoSnapshotPolicyName string `json:"AutoSnapshotPolicyName" xml:"AutoSnapshotPolicyName"` TargetCopyRegions string `json:"TargetCopyRegions" xml:"TargetCopyRegions"` CopiedSnapshotsRetentionDays int `json:"CopiedSnapshotsRetentionDays" xml:"CopiedSnapshotsRetentionDays"` + AutoSnapshotPolicyId string `json:"AutoSnapshotPolicyId" xml:"AutoSnapshotPolicyId"` + RetentionDays int `json:"RetentionDays" xml:"RetentionDays"` + RegionId string `json:"RegionId" xml:"RegionId"` + DiskNums int `json:"DiskNums" xml:"DiskNums"` + EnableCrossRegionCopy bool `json:"EnableCrossRegionCopy" xml:"EnableCrossRegionCopy"` + RepeatWeekdays string `json:"RepeatWeekdays" xml:"RepeatWeekdays"` + VolumeNums int `json:"VolumeNums" xml:"VolumeNums"` + ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` Tags TagsInDescribeAutoSnapshotPolicyEx `json:"Tags" xml:"Tags"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_capacity.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_capacity.go index 00da0ec23b7..ee11238ad76 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_capacity.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_capacity.go @@ -17,13 +17,13 @@ package ecs // Capacity is a nested struct in ecs response type Capacity struct { - TotalVcpus int `json:"TotalVcpus" xml:"TotalVcpus"` - AvailableVcpus int `json:"AvailableVcpus" xml:"AvailableVcpus"` - TotalVgpus int `json:"TotalVgpus" xml:"TotalVgpus"` - AvailableVgpus int `json:"AvailableVgpus" xml:"AvailableVgpus"` - TotalMemory float64 `json:"TotalMemory" xml:"TotalMemory"` AvailableMemory float64 `json:"AvailableMemory" xml:"AvailableMemory"` + LocalStorageCategory string `json:"LocalStorageCategory" xml:"LocalStorageCategory"` + TotalMemory float64 `json:"TotalMemory" xml:"TotalMemory"` TotalLocalStorage int `json:"TotalLocalStorage" xml:"TotalLocalStorage"` + TotalVcpus int `json:"TotalVcpus" xml:"TotalVcpus"` + TotalVgpus int `json:"TotalVgpus" xml:"TotalVgpus"` AvailableLocalStorage int `json:"AvailableLocalStorage" xml:"AvailableLocalStorage"` - LocalStorageCategory string `json:"LocalStorageCategory" xml:"LocalStorageCategory"` + AvailableVcpus int `json:"AvailableVcpus" xml:"AvailableVcpus"` + AvailableVgpus int `json:"AvailableVgpus" xml:"AvailableVgpus"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_capacity_reservation_item.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_capacity_reservation_item.go index bbd563dca9d..0797b97e8b1 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_capacity_reservation_item.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_capacity_reservation_item.go @@ -27,9 +27,9 @@ type CapacityReservationItem struct { EndTime string `json:"EndTime" xml:"EndTime"` ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` Status string `json:"Status" xml:"Status"` - Description string `json:"Description" xml:"Description"` InstanceChargeType string `json:"InstanceChargeType" xml:"InstanceChargeType"` + Description string `json:"Description" xml:"Description"` PrivatePoolOptionsId string `json:"PrivatePoolOptionsId" xml:"PrivatePoolOptionsId"` - Tags TagsInDescribeCapacityReservations `json:"Tags" xml:"Tags"` AllocatedResources AllocatedResourcesInDescribeCapacityReservations `json:"AllocatedResources" xml:"AllocatedResources"` + Tags TagsInDescribeCapacityReservations `json:"Tags" xml:"Tags"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_dedicated_block_storage_cluster.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_dedicated_block_storage_cluster.go index b7e1714380f..bd70a11aef8 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_dedicated_block_storage_cluster.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_dedicated_block_storage_cluster.go @@ -17,14 +17,14 @@ package ecs // DedicatedBlockStorageCluster is a nested struct in ecs response type DedicatedBlockStorageCluster struct { - DedicatedBlockStorageClusterId string `json:"DedicatedBlockStorageClusterId" xml:"DedicatedBlockStorageClusterId"` - DedicatedBlockStorageClusterName string `json:"DedicatedBlockStorageClusterName" xml:"DedicatedBlockStorageClusterName"` - Description string `json:"Description" xml:"Description"` - ZoneId string `json:"ZoneId" xml:"ZoneId"` Status string `json:"Status" xml:"Status"` - Category string `json:"Category" xml:"Category"` - PerformanceLevel string `json:"PerformanceLevel" xml:"PerformanceLevel"` + Type string `json:"Type" xml:"Type"` + Description string `json:"Description" xml:"Description"` ExpiredTime string `json:"ExpiredTime" xml:"ExpiredTime"` CreateTime string `json:"CreateTime" xml:"CreateTime"` + ZoneId string `json:"ZoneId" xml:"ZoneId"` + Category string `json:"Category" xml:"Category"` + DedicatedBlockStorageClusterName string `json:"DedicatedBlockStorageClusterName" xml:"DedicatedBlockStorageClusterName"` + DedicatedBlockStorageClusterId string `json:"DedicatedBlockStorageClusterId" xml:"DedicatedBlockStorageClusterId"` DedicatedBlockStorageClusterCapacity DedicatedBlockStorageClusterCapacity `json:"DedicatedBlockStorageClusterCapacity" xml:"DedicatedBlockStorageClusterCapacity"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_dedicated_block_storage_cluster_capacity.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_dedicated_block_storage_cluster_capacity.go index 0a5cd23fd34..ff092fb4329 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_dedicated_block_storage_cluster_capacity.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_dedicated_block_storage_cluster_capacity.go @@ -17,6 +17,6 @@ package ecs // DedicatedBlockStorageClusterCapacity is a nested struct in ecs response type DedicatedBlockStorageClusterCapacity struct { - AvailableCapacity int64 `json:"AvailableCapacity" xml:"AvailableCapacity"` TotalCapacity int64 `json:"TotalCapacity" xml:"TotalCapacity"` + AvailableCapacity int64 `json:"AvailableCapacity" xml:"AvailableCapacity"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_dedicated_host.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_dedicated_host.go index 13489e2a547..0871d02fa69 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_dedicated_host.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_dedicated_host.go @@ -17,28 +17,28 @@ package ecs // DedicatedHost is a nested struct in ecs response type DedicatedHost struct { - DedicatedHostId string `json:"DedicatedHostId" xml:"DedicatedHostId"` - AutoPlacement string `json:"AutoPlacement" xml:"AutoPlacement"` - RegionId string `json:"RegionId" xml:"RegionId"` - ZoneId string `json:"ZoneId" xml:"ZoneId"` - DedicatedHostName string `json:"DedicatedHostName" xml:"DedicatedHostName"` - MachineId string `json:"MachineId" xml:"MachineId"` - Description string `json:"Description" xml:"Description"` - DedicatedHostType string `json:"DedicatedHostType" xml:"DedicatedHostType"` - Sockets int `json:"Sockets" xml:"Sockets"` + CreationTime string `json:"CreationTime" xml:"CreationTime"` + Status string `json:"Status" xml:"Status"` Cores int `json:"Cores" xml:"Cores"` - PhysicalGpus int `json:"PhysicalGpus" xml:"PhysicalGpus"` + AutoPlacement string `json:"AutoPlacement" xml:"AutoPlacement"` GPUSpec string `json:"GPUSpec" xml:"GPUSpec"` - ActionOnMaintenance string `json:"ActionOnMaintenance" xml:"ActionOnMaintenance"` - Status string `json:"Status" xml:"Status"` - CreationTime string `json:"CreationTime" xml:"CreationTime"` + AutoReleaseTime string `json:"AutoReleaseTime" xml:"AutoReleaseTime"` ChargeType string `json:"ChargeType" xml:"ChargeType"` + CpuOverCommitRatio float64 `json:"CpuOverCommitRatio" xml:"CpuOverCommitRatio"` + ActionOnMaintenance string `json:"ActionOnMaintenance" xml:"ActionOnMaintenance"` SaleCycle string `json:"SaleCycle" xml:"SaleCycle"` + PhysicalGpus int `json:"PhysicalGpus" xml:"PhysicalGpus"` + RegionId string `json:"RegionId" xml:"RegionId"` + DedicatedHostName string `json:"DedicatedHostName" xml:"DedicatedHostName"` + Description string `json:"Description" xml:"Description"` + DedicatedHostClusterId string `json:"DedicatedHostClusterId" xml:"DedicatedHostClusterId"` ExpiredTime string `json:"ExpiredTime" xml:"ExpiredTime"` - AutoReleaseTime string `json:"AutoReleaseTime" xml:"AutoReleaseTime"` + DedicatedHostType string `json:"DedicatedHostType" xml:"DedicatedHostType"` ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` - DedicatedHostClusterId string `json:"DedicatedHostClusterId" xml:"DedicatedHostClusterId"` - CpuOverCommitRatio float64 `json:"CpuOverCommitRatio" xml:"CpuOverCommitRatio"` + ZoneId string `json:"ZoneId" xml:"ZoneId"` + DedicatedHostId string `json:"DedicatedHostId" xml:"DedicatedHostId"` + Sockets int `json:"Sockets" xml:"Sockets"` + MachineId string `json:"MachineId" xml:"MachineId"` SupportedInstanceTypeFamilies SupportedInstanceTypeFamiliesInDescribeDedicatedHosts `json:"SupportedInstanceTypeFamilies" xml:"SupportedInstanceTypeFamilies"` SupportedCustomInstanceTypeFamilies SupportedCustomInstanceTypeFamilies `json:"SupportedCustomInstanceTypeFamilies" xml:"SupportedCustomInstanceTypeFamilies"` SupportedInstanceTypesList SupportedInstanceTypesListInDescribeDedicatedHosts `json:"SupportedInstanceTypesList" xml:"SupportedInstanceTypesList"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_dedicated_host_renew_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_dedicated_host_renew_attribute.go index 4c390a287e6..7c1ce28b3b8 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_dedicated_host_renew_attribute.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_dedicated_host_renew_attribute.go @@ -17,9 +17,10 @@ package ecs // DedicatedHostRenewAttribute is a nested struct in ecs response type DedicatedHostRenewAttribute struct { - DedicatedHostId string `json:"DedicatedHostId" xml:"DedicatedHostId"` - AutoRenewEnabled bool `json:"AutoRenewEnabled" xml:"AutoRenewEnabled"` - Duration int `json:"Duration" xml:"Duration"` PeriodUnit string `json:"PeriodUnit" xml:"PeriodUnit"` + Duration int `json:"Duration" xml:"Duration"` + DedicatedHostId string `json:"DedicatedHostId" xml:"DedicatedHostId"` RenewalStatus string `json:"RenewalStatus" xml:"RenewalStatus"` + AutoRenewEnabled bool `json:"AutoRenewEnabled" xml:"AutoRenewEnabled"` + AutoRenewWithEcs string `json:"AutoRenewWithEcs" xml:"AutoRenewWithEcs"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_disk.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_disk.go index 91f3a813c54..754562fd446 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_disk.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_disk.go @@ -17,47 +17,47 @@ package ecs // Disk is a nested struct in ecs response type Disk struct { - Category string `json:"Category" xml:"Category"` - BdfId string `json:"BdfId" xml:"BdfId"` - ImageId string `json:"ImageId" xml:"ImageId"` - DeleteAutoSnapshot bool `json:"DeleteAutoSnapshot" xml:"DeleteAutoSnapshot"` - AutoSnapshotPolicyId string `json:"AutoSnapshotPolicyId" xml:"AutoSnapshotPolicyId"` - EnableAutomatedSnapshotPolicy bool `json:"EnableAutomatedSnapshotPolicy" xml:"EnableAutomatedSnapshotPolicy"` - SerialNumber string `json:"SerialNumber" xml:"SerialNumber"` - DiskId string `json:"DiskId" xml:"DiskId"` - Size int `json:"Size" xml:"Size"` - IOPS int `json:"IOPS" xml:"IOPS"` - MountInstanceNum int `json:"MountInstanceNum" xml:"MountInstanceNum"` - RegionId string `json:"RegionId" xml:"RegionId"` - StorageSetId string `json:"StorageSetId" xml:"StorageSetId"` - ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` - InstanceId string `json:"InstanceId" xml:"InstanceId"` - Description string `json:"Description" xml:"Description"` - Type string `json:"Type" xml:"Type"` - ExpiredTime string `json:"ExpiredTime" xml:"ExpiredTime"` - Device string `json:"Device" xml:"Device"` - MultiAttach string `json:"MultiAttach" xml:"MultiAttach"` - CreationTime string `json:"CreationTime" xml:"CreationTime"` - IOPSRead int `json:"IOPSRead" xml:"IOPSRead"` - SourceSnapshotId string `json:"SourceSnapshotId" xml:"SourceSnapshotId"` - StorageSetPartitionNumber int `json:"StorageSetPartitionNumber" xml:"StorageSetPartitionNumber"` - DedicatedBlockStorageClusterId string `json:"DedicatedBlockStorageClusterId" xml:"DedicatedBlockStorageClusterId"` - Portable bool `json:"Portable" xml:"Portable"` - KMSKeyId string `json:"KMSKeyId" xml:"KMSKeyId"` - ProductCode string `json:"ProductCode" xml:"ProductCode"` - Encrypted bool `json:"Encrypted" xml:"Encrypted"` - EnableAutoSnapshot bool `json:"EnableAutoSnapshot" xml:"EnableAutoSnapshot"` - DetachedTime string `json:"DetachedTime" xml:"DetachedTime"` - DeleteWithInstance bool `json:"DeleteWithInstance" xml:"DeleteWithInstance"` - DiskChargeType string `json:"DiskChargeType" xml:"DiskChargeType"` - ZoneId string `json:"ZoneId" xml:"ZoneId"` - PerformanceLevel string `json:"PerformanceLevel" xml:"PerformanceLevel"` - Status string `json:"Status" xml:"Status"` - DiskName string `json:"DiskName" xml:"DiskName"` - IOPSWrite int `json:"IOPSWrite" xml:"IOPSWrite"` - AttachedTime string `json:"AttachedTime" xml:"AttachedTime"` - Attachments Attachments `json:"Attachments" xml:"Attachments"` - Tags TagsInDescribeDisks `json:"Tags" xml:"Tags"` - MountInstances MountInstances `json:"MountInstances" xml:"MountInstances"` - OperationLocks OperationLocksInDescribeDisks `json:"OperationLocks" xml:"OperationLocks"` + Category string `json:"Category" xml:"Category"` + BdfId string `json:"BdfId" xml:"BdfId"` + ImageId string `json:"ImageId" xml:"ImageId"` + DeleteAutoSnapshot bool `json:"DeleteAutoSnapshot" xml:"DeleteAutoSnapshot"` + StorageClusterId string `json:"StorageClusterId" xml:"StorageClusterId"` + AutoSnapshotPolicyId string `json:"AutoSnapshotPolicyId" xml:"AutoSnapshotPolicyId"` + EnableAutomatedSnapshotPolicy bool `json:"EnableAutomatedSnapshotPolicy" xml:"EnableAutomatedSnapshotPolicy"` + SerialNumber string `json:"SerialNumber" xml:"SerialNumber"` + DiskId string `json:"DiskId" xml:"DiskId"` + Size int `json:"Size" xml:"Size"` + IOPS int `json:"IOPS" xml:"IOPS"` + MountInstanceNum int `json:"MountInstanceNum" xml:"MountInstanceNum"` + RegionId string `json:"RegionId" xml:"RegionId"` + StorageSetId string `json:"StorageSetId" xml:"StorageSetId"` + ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` + InstanceId string `json:"InstanceId" xml:"InstanceId"` + Description string `json:"Description" xml:"Description"` + Type string `json:"Type" xml:"Type"` + ExpiredTime string `json:"ExpiredTime" xml:"ExpiredTime"` + Device string `json:"Device" xml:"Device"` + MultiAttach string `json:"MultiAttach" xml:"MultiAttach"` + CreationTime string `json:"CreationTime" xml:"CreationTime"` + IOPSRead int `json:"IOPSRead" xml:"IOPSRead"` + SourceSnapshotId string `json:"SourceSnapshotId" xml:"SourceSnapshotId"` + StorageSetPartitionNumber int `json:"StorageSetPartitionNumber" xml:"StorageSetPartitionNumber"` + Portable bool `json:"Portable" xml:"Portable"` + KMSKeyId string `json:"KMSKeyId" xml:"KMSKeyId"` + ProductCode string `json:"ProductCode" xml:"ProductCode"` + Encrypted bool `json:"Encrypted" xml:"Encrypted"` + EnableAutoSnapshot bool `json:"EnableAutoSnapshot" xml:"EnableAutoSnapshot"` + DetachedTime string `json:"DetachedTime" xml:"DetachedTime"` + DeleteWithInstance bool `json:"DeleteWithInstance" xml:"DeleteWithInstance"` + DiskChargeType string `json:"DiskChargeType" xml:"DiskChargeType"` + ZoneId string `json:"ZoneId" xml:"ZoneId"` + PerformanceLevel string `json:"PerformanceLevel" xml:"PerformanceLevel"` + Status string `json:"Status" xml:"Status"` + DiskName string `json:"DiskName" xml:"DiskName"` + IOPSWrite int `json:"IOPSWrite" xml:"IOPSWrite"` + AttachedTime string `json:"AttachedTime" xml:"AttachedTime"` + Attachments Attachments `json:"Attachments" xml:"Attachments"` + Tags TagsInDescribeDisks `json:"Tags" xml:"Tags"` + MountInstances MountInstances `json:"MountInstances" xml:"MountInstances"` + OperationLocks OperationLocksInDescribeDisks `json:"OperationLocks" xml:"OperationLocks"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_extended_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_extended_attribute.go index fafb9173f20..49b58e17712 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_extended_attribute.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_extended_attribute.go @@ -17,6 +17,8 @@ package ecs // ExtendedAttribute is a nested struct in ecs response type ExtendedAttribute struct { + HostType string `json:"HostType" xml:"HostType"` + HostId string `json:"HostId" xml:"HostId"` Device string `json:"Device" xml:"Device"` DiskId string `json:"DiskId" xml:"DiskId"` InactiveDisks InactiveDisksInDescribeInstanceHistoryEvents `json:"InactiveDisks" xml:"InactiveDisks"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_image.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_image.go index 428315e6740..595205d724f 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_image.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_image.go @@ -17,29 +17,31 @@ package ecs // Image is a nested struct in ecs response type Image struct { - ImageId string `json:"ImageId" xml:"ImageId"` - ImageOwnerAlias string `json:"ImageOwnerAlias" xml:"ImageOwnerAlias"` - OSName string `json:"OSName" xml:"OSName"` - OSNameEn string `json:"OSNameEn" xml:"OSNameEn"` - ImageFamily string `json:"ImageFamily" xml:"ImageFamily"` - Architecture string `json:"Architecture" xml:"Architecture"` - Size int `json:"Size" xml:"Size"` - IsSupportIoOptimized bool `json:"IsSupportIoOptimized" xml:"IsSupportIoOptimized"` - ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` - Description string `json:"Description" xml:"Description"` - Usage string `json:"Usage" xml:"Usage"` - IsCopied bool `json:"IsCopied" xml:"IsCopied"` - ImageVersion string `json:"ImageVersion" xml:"ImageVersion"` - OSType string `json:"OSType" xml:"OSType"` - IsSubscribed bool `json:"IsSubscribed" xml:"IsSubscribed"` - IsSupportCloudinit bool `json:"IsSupportCloudinit" xml:"IsSupportCloudinit"` - CreationTime string `json:"CreationTime" xml:"CreationTime"` - ProductCode string `json:"ProductCode" xml:"ProductCode"` - Progress string `json:"Progress" xml:"Progress"` - Platform string `json:"Platform" xml:"Platform"` - IsSelfShared string `json:"IsSelfShared" xml:"IsSelfShared"` - ImageName string `json:"ImageName" xml:"ImageName"` - Status string `json:"Status" xml:"Status"` - Tags TagsInDescribeImageFromFamily `json:"Tags" xml:"Tags"` - DiskDeviceMappings DiskDeviceMappingsInDescribeImages `json:"DiskDeviceMappings" xml:"DiskDeviceMappings"` + ImageId string `json:"ImageId" xml:"ImageId"` + ImageOwnerAlias string `json:"ImageOwnerAlias" xml:"ImageOwnerAlias"` + OSName string `json:"OSName" xml:"OSName"` + OSNameEn string `json:"OSNameEn" xml:"OSNameEn"` + ImageFamily string `json:"ImageFamily" xml:"ImageFamily"` + Architecture string `json:"Architecture" xml:"Architecture"` + Size int `json:"Size" xml:"Size"` + IsSupportIoOptimized bool `json:"IsSupportIoOptimized" xml:"IsSupportIoOptimized"` + ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` + Description string `json:"Description" xml:"Description"` + Usage string `json:"Usage" xml:"Usage"` + IsCopied bool `json:"IsCopied" xml:"IsCopied"` + ImageVersion string `json:"ImageVersion" xml:"ImageVersion"` + OSType string `json:"OSType" xml:"OSType"` + IsSubscribed bool `json:"IsSubscribed" xml:"IsSubscribed"` + IsSupportCloudinit bool `json:"IsSupportCloudinit" xml:"IsSupportCloudinit"` + CreationTime string `json:"CreationTime" xml:"CreationTime"` + ProductCode string `json:"ProductCode" xml:"ProductCode"` + Progress string `json:"Progress" xml:"Progress"` + Platform string `json:"Platform" xml:"Platform"` + IsSelfShared string `json:"IsSelfShared" xml:"IsSelfShared"` + ImageName string `json:"ImageName" xml:"ImageName"` + Status string `json:"Status" xml:"Status"` + ImageOwnerId int64 `json:"ImageOwnerId" xml:"ImageOwnerId"` + IsPublic bool `json:"IsPublic" xml:"IsPublic"` + Tags TagsInDescribeImages `json:"Tags" xml:"Tags"` + DiskDeviceMappings DiskDeviceMappingsInDescribeImageFromFamily `json:"DiskDeviceMappings" xml:"DiskDeviceMappings"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_image_component_set.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_image_component_set.go index 756f793516e..fdf4e17707f 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_image_component_set.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_image_component_set.go @@ -18,12 +18,13 @@ package ecs // ImageComponentSet is a nested struct in ecs response type ImageComponentSet struct { CreationTime string `json:"CreationTime" xml:"CreationTime"` - ImageComponentId string `json:"ImageComponentId" xml:"ImageComponentId"` - Name string `json:"Name" xml:"Name"` Description string `json:"Description" xml:"Description"` SystemType string `json:"SystemType" xml:"SystemType"` + ImageComponentId string `json:"ImageComponentId" xml:"ImageComponentId"` ComponentType string `json:"ComponentType" xml:"ComponentType"` - Content string `json:"Content" xml:"Content"` ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` + Name string `json:"Name" xml:"Name"` + Content string `json:"Content" xml:"Content"` + Owner string `json:"Owner" xml:"Owner"` Tags TagsInDescribeImageComponents `json:"Tags" xml:"Tags"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_image_pipeline_execution_set.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_image_pipeline_execution_set.go index bc3e171f014..09d39218414 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_image_pipeline_execution_set.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_image_pipeline_execution_set.go @@ -18,12 +18,12 @@ package ecs // ImagePipelineExecutionSet is a nested struct in ecs response type ImagePipelineExecutionSet struct { CreationTime string `json:"CreationTime" xml:"CreationTime"` - ModifiedTime string `json:"ModifiedTime" xml:"ModifiedTime"` - ImageId string `json:"ImageId" xml:"ImageId"` ImagePipelineId string `json:"ImagePipelineId" xml:"ImagePipelineId"` - ExecutionId string `json:"ExecutionId" xml:"ExecutionId"` Status string `json:"Status" xml:"Status"` - Message string `json:"Message" xml:"Message"` + ModifiedTime string `json:"ModifiedTime" xml:"ModifiedTime"` ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` + Message string `json:"Message" xml:"Message"` + ImageId string `json:"ImageId" xml:"ImageId"` + ExecutionId string `json:"ExecutionId" xml:"ExecutionId"` Tags TagsInDescribeImagePipelineExecutions `json:"Tags" xml:"Tags"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_image_pipeline_set.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_image_pipeline_set.go index 8ec40c89764..324dd701ec7 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_image_pipeline_set.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_image_pipeline_set.go @@ -18,20 +18,20 @@ package ecs // ImagePipelineSet is a nested struct in ecs response type ImagePipelineSet struct { CreationTime string `json:"CreationTime" xml:"CreationTime"` + DeleteInstanceOnFailure bool `json:"DeleteInstanceOnFailure" xml:"DeleteInstanceOnFailure"` + InstanceType string `json:"InstanceType" xml:"InstanceType"` + InternetMaxBandwidthOut int `json:"InternetMaxBandwidthOut" xml:"InternetMaxBandwidthOut"` ImagePipelineId string `json:"ImagePipelineId" xml:"ImagePipelineId"` - Name string `json:"Name" xml:"Name"` + VSwitchId string `json:"VSwitchId" xml:"VSwitchId"` + SystemDiskSize int `json:"SystemDiskSize" xml:"SystemDiskSize"` Description string `json:"Description" xml:"Description"` - BaseImageType string `json:"BaseImageType" xml:"BaseImageType"` BaseImage string `json:"BaseImage" xml:"BaseImage"` + ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` ImageName string `json:"ImageName" xml:"ImageName"` - VSwitchId string `json:"VSwitchId" xml:"VSwitchId"` - InstanceType string `json:"InstanceType" xml:"InstanceType"` - InternetMaxBandwidthOut int `json:"InternetMaxBandwidthOut" xml:"InternetMaxBandwidthOut"` - SystemDiskSize int `json:"SystemDiskSize" xml:"SystemDiskSize"` - DeleteInstanceOnFailure bool `json:"DeleteInstanceOnFailure" xml:"DeleteInstanceOnFailure"` + BaseImageType string `json:"BaseImageType" xml:"BaseImageType"` + Name string `json:"Name" xml:"Name"` BuildContent string `json:"BuildContent" xml:"BuildContent"` - ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` - AddAccounts AddAccounts `json:"AddAccounts" xml:"AddAccounts"` ToRegionIds ToRegionIds `json:"ToRegionIds" xml:"ToRegionIds"` + AddAccounts AddAccounts `json:"AddAccounts" xml:"AddAccounts"` Tags TagsInDescribeImagePipelines `json:"Tags" xml:"Tags"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_inactive_disk.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_inactive_disk.go index 231355e5c23..727f5edc414 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_inactive_disk.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_inactive_disk.go @@ -20,6 +20,6 @@ type InactiveDisk struct { DeviceCategory string `json:"DeviceCategory" xml:"DeviceCategory"` ReleaseTime string `json:"ReleaseTime" xml:"ReleaseTime"` CreationTime string `json:"CreationTime" xml:"CreationTime"` - DeviceType string `json:"DeviceType" xml:"DeviceType"` DeviceSize string `json:"DeviceSize" xml:"DeviceSize"` + DeviceType string `json:"DeviceType" xml:"DeviceType"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_instance_cloud_assistant_status.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_instance_cloud_assistant_status.go index b63271ede86..10f232f937d 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_instance_cloud_assistant_status.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_instance_cloud_assistant_status.go @@ -17,12 +17,13 @@ package ecs // InstanceCloudAssistantStatus is a nested struct in ecs response type InstanceCloudAssistantStatus struct { - InstanceId string `json:"InstanceId" xml:"InstanceId"` - OSType string `json:"OSType" xml:"OSType"` CloudAssistantStatus string `json:"CloudAssistantStatus" xml:"CloudAssistantStatus"` + LastInvokedTime string `json:"LastInvokedTime" xml:"LastInvokedTime"` CloudAssistantVersion string `json:"CloudAssistantVersion" xml:"CloudAssistantVersion"` - InvocationCount int64 `json:"InvocationCount" xml:"InvocationCount"` ActiveTaskCount int64 `json:"ActiveTaskCount" xml:"ActiveTaskCount"` - LastInvokedTime string `json:"LastInvokedTime" xml:"LastInvokedTime"` + InvocationCount int64 `json:"InvocationCount" xml:"InvocationCount"` + InstanceId string `json:"InstanceId" xml:"InstanceId"` LastHeartbeatTime string `json:"LastHeartbeatTime" xml:"LastHeartbeatTime"` + OSType string `json:"OSType" xml:"OSType"` + SupportSessionManager bool `json:"SupportSessionManager" xml:"SupportSessionManager"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_instance_system_event_type.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_instance_system_event_type.go index 7f59a872a45..d2d388681a1 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_instance_system_event_type.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_instance_system_event_type.go @@ -17,14 +17,14 @@ package ecs // InstanceSystemEventType is a nested struct in ecs response type InstanceSystemEventType struct { - InstanceId string `json:"InstanceId" xml:"InstanceId"` EventId string `json:"EventId" xml:"EventId"` EventPublishTime string `json:"EventPublishTime" xml:"EventPublishTime"` - NotBefore string `json:"NotBefore" xml:"NotBefore"` EventFinishTime string `json:"EventFinishTime" xml:"EventFinishTime"` - Reason string `json:"Reason" xml:"Reason"` - ImpactLevel string `json:"ImpactLevel" xml:"ImpactLevel"` ResourceType string `json:"ResourceType" xml:"ResourceType"` + ImpactLevel string `json:"ImpactLevel" xml:"ImpactLevel"` + NotBefore string `json:"NotBefore" xml:"NotBefore"` + InstanceId string `json:"InstanceId" xml:"InstanceId"` + Reason string `json:"Reason" xml:"Reason"` EventType EventType `json:"EventType" xml:"EventType"` EventCycleStatus EventCycleStatus `json:"EventCycleStatus" xml:"EventCycleStatus"` ExtendedAttribute ExtendedAttribute `json:"ExtendedAttribute" xml:"ExtendedAttribute"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_instance_type.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_instance_type.go index 16468e44137..b89c14e60ad 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_instance_type.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_instance_type.go @@ -18,24 +18,24 @@ package ecs // InstanceType is a nested struct in ecs response type InstanceType struct { MemorySize float64 `json:"MemorySize" xml:"MemorySize"` - EniPrivateIpAddressQuantity int `json:"EniPrivateIpAddressQuantity" xml:"EniPrivateIpAddressQuantity"` InstancePpsRx int64 `json:"InstancePpsRx" xml:"InstancePpsRx"` EriQuantity int `json:"EriQuantity" xml:"EriQuantity"` + EniPrivateIpAddressQuantity int `json:"EniPrivateIpAddressQuantity" xml:"EniPrivateIpAddressQuantity"` CpuCoreCount int `json:"CpuCoreCount" xml:"CpuCoreCount"` EniTotalQuantity int `json:"EniTotalQuantity" xml:"EniTotalQuantity"` Cores int `json:"Cores" xml:"Cores"` InstanceTypeId string `json:"InstanceTypeId" xml:"InstanceTypeId"` InstanceBandwidthRx int `json:"InstanceBandwidthRx" xml:"InstanceBandwidthRx"` InstanceType string `json:"InstanceType" xml:"InstanceType"` - EniQuantity int `json:"EniQuantity" xml:"EniQuantity"` QueuePairNumber int `json:"QueuePairNumber" xml:"QueuePairNumber"` + EniQuantity int `json:"EniQuantity" xml:"EniQuantity"` Generation string `json:"Generation" xml:"Generation"` SupportIoOptimized string `json:"SupportIoOptimized" xml:"SupportIoOptimized"` InstanceTypeFamily string `json:"InstanceTypeFamily" xml:"InstanceTypeFamily"` InitialCredit int `json:"InitialCredit" xml:"InitialCredit"` InstancePpsTx int64 `json:"InstancePpsTx" xml:"InstancePpsTx"` - LocalStorageAmount int `json:"LocalStorageAmount" xml:"LocalStorageAmount"` InstanceFamilyLevel string `json:"InstanceFamilyLevel" xml:"InstanceFamilyLevel"` + LocalStorageAmount int `json:"LocalStorageAmount" xml:"LocalStorageAmount"` TotalEniQueueQuantity int `json:"TotalEniQueueQuantity" xml:"TotalEniQueueQuantity"` GPUSpec string `json:"GPUSpec" xml:"GPUSpec"` SecondaryEniQueueNumber int `json:"SecondaryEniQueueNumber" xml:"SecondaryEniQueueNumber"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_ipv6_sets_in_assign_ipv6_addresses.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_ipv6_sets_in_assign_ipv6_addresses.go new file mode 100644 index 00000000000..53c0ca21428 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_ipv6_sets_in_assign_ipv6_addresses.go @@ -0,0 +1,21 @@ +package ecs + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Ipv6SetsInAssignIpv6Addresses is a nested struct in ecs response +type Ipv6SetsInAssignIpv6Addresses struct { + Ipv6Address []string `json:"Ipv6Address" xml:"Ipv6Address"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_ipv6_sets_in_create_network_interface.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_ipv6_sets_in_create_network_interface.go new file mode 100644 index 00000000000..f3c5362f5ba --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_ipv6_sets_in_create_network_interface.go @@ -0,0 +1,21 @@ +package ecs + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Ipv6SetsInCreateNetworkInterface is a nested struct in ecs response +type Ipv6SetsInCreateNetworkInterface struct { + Ipv6Set []Ipv6Set `json:"Ipv6Set" xml:"Ipv6Set"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_network_attributes.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_network_attributes.go index 98389dac178..1643d8a1544 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_network_attributes.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_network_attributes.go @@ -17,6 +17,6 @@ package ecs // NetworkAttributes is a nested struct in ecs response type NetworkAttributes struct { - SlbUdpTimeout int `json:"SlbUdpTimeout" xml:"SlbUdpTimeout"` UdpTimeout int `json:"UdpTimeout" xml:"UdpTimeout"` + SlbUdpTimeout int `json:"SlbUdpTimeout" xml:"SlbUdpTimeout"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_price_info.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_price_info.go index fb7ae9eda2f..3e02bfcbe74 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_price_info.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_price_info.go @@ -17,6 +17,6 @@ package ecs // PriceInfo is a nested struct in ecs response type PriceInfo struct { - Price Price `json:"Price" xml:"Price"` - Rules RulesInDescribeInstanceModificationPrice `json:"Rules" xml:"Rules"` + Price Price `json:"Price" xml:"Price"` + Rules RulesInDescribeRenewalPrice `json:"Rules" xml:"Rules"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_resources_info.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_resources_info.go index e2b75116f73..7f17df6dd7d 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_resources_info.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_resources_info.go @@ -19,9 +19,9 @@ package ecs type ResourcesInfo struct { IoOptimized bool `json:"IoOptimized" xml:"IoOptimized"` SystemDiskCategories SystemDiskCategories `json:"SystemDiskCategories" xml:"SystemDiskCategories"` + InstanceGenerations InstanceGenerations `json:"InstanceGenerations" xml:"InstanceGenerations"` DataDiskCategories DataDiskCategories `json:"DataDiskCategories" xml:"DataDiskCategories"` - NetworkTypes NetworkTypesInDescribeZones `json:"NetworkTypes" xml:"NetworkTypes"` InstanceTypes InstanceTypesInDescribeZones `json:"InstanceTypes" xml:"InstanceTypes"` InstanceTypeFamilies InstanceTypeFamiliesInDescribeZones `json:"InstanceTypeFamilies" xml:"InstanceTypeFamilies"` - InstanceGenerations InstanceGenerations `json:"InstanceGenerations" xml:"InstanceGenerations"` + NetworkTypes NetworkTypesInDescribeZones `json:"NetworkTypes" xml:"NetworkTypes"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_security_group.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_security_group.go index 7255d22e9cf..6f5cdec2ce8 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_security_group.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_security_group.go @@ -17,16 +17,16 @@ package ecs // SecurityGroup is a nested struct in ecs response type SecurityGroup struct { - SecurityGroupId string `json:"SecurityGroupId" xml:"SecurityGroupId"` + CreationTime string `json:"CreationTime" xml:"CreationTime"` + VpcId string `json:"VpcId" xml:"VpcId"` + ServiceManaged bool `json:"ServiceManaged" xml:"ServiceManaged"` Description string `json:"Description" xml:"Description"` + SecurityGroupId string `json:"SecurityGroupId" xml:"SecurityGroupId"` + ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` SecurityGroupName string `json:"SecurityGroupName" xml:"SecurityGroupName"` - VpcId string `json:"VpcId" xml:"VpcId"` - CreationTime string `json:"CreationTime" xml:"CreationTime"` - SecurityGroupType string `json:"SecurityGroupType" xml:"SecurityGroupType"` - AvailableInstanceAmount int `json:"AvailableInstanceAmount" xml:"AvailableInstanceAmount"` EcsCount int `json:"EcsCount" xml:"EcsCount"` - ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` ServiceID int64 `json:"ServiceID" xml:"ServiceID"` - ServiceManaged bool `json:"ServiceManaged" xml:"ServiceManaged"` + SecurityGroupType string `json:"SecurityGroupType" xml:"SecurityGroupType"` + AvailableInstanceAmount int `json:"AvailableInstanceAmount" xml:"AvailableInstanceAmount"` Tags TagsInDescribeSecurityGroups `json:"Tags" xml:"Tags"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_snapshot.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_snapshot.go index 66220f0d8de..ffe7924fba2 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_snapshot.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_snapshot.go @@ -18,27 +18,29 @@ package ecs // Snapshot is a nested struct in ecs response type Snapshot struct { Category string `json:"Category" xml:"Category"` + LastModifiedTime string `json:"LastModifiedTime" xml:"LastModifiedTime"` + ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` + SnapshotSN string `json:"SnapshotSN" xml:"SnapshotSN"` + InstantAccess bool `json:"InstantAccess" xml:"InstantAccess"` + SnapshotType string `json:"SnapshotType" xml:"SnapshotType"` + Description string `json:"Description" xml:"Description"` + SourceDiskType string `json:"SourceDiskType" xml:"SourceDiskType"` + SnapshotName string `json:"SnapshotName" xml:"SnapshotName"` Usage string `json:"Usage" xml:"Usage"` SourceDiskSize string `json:"SourceDiskSize" xml:"SourceDiskSize"` CreationTime string `json:"CreationTime" xml:"CreationTime"` SourceStorageType string `json:"SourceStorageType" xml:"SourceStorageType"` - ProductCode string `json:"ProductCode" xml:"ProductCode"` + SourceSnapshotId string `json:"SourceSnapshotId" xml:"SourceSnapshotId"` KMSKeyId string `json:"KMSKeyId" xml:"KMSKeyId"` + ProductCode string `json:"ProductCode" xml:"ProductCode"` Encrypted bool `json:"Encrypted" xml:"Encrypted"` Progress string `json:"Progress" xml:"Progress"` - LastModifiedTime string `json:"LastModifiedTime" xml:"LastModifiedTime"` RetentionDays int `json:"RetentionDays" xml:"RetentionDays"` SourceDiskId string `json:"SourceDiskId" xml:"SourceDiskId"` - ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` RemainTime int `json:"RemainTime" xml:"RemainTime"` SnapshotId string `json:"SnapshotId" xml:"SnapshotId"` - SnapshotSN string `json:"SnapshotSN" xml:"SnapshotSN"` - InstantAccess bool `json:"InstantAccess" xml:"InstantAccess"` InstantAccessRetentionDays int `json:"InstantAccessRetentionDays" xml:"InstantAccessRetentionDays"` + SourceRegionId string `json:"SourceRegionId" xml:"SourceRegionId"` Status string `json:"Status" xml:"Status"` - SnapshotType string `json:"SnapshotType" xml:"SnapshotType"` - Description string `json:"Description" xml:"Description"` - SourceDiskType string `json:"SourceDiskType" xml:"SourceDiskType"` - SnapshotName string `json:"SnapshotName" xml:"SnapshotName"` Tags TagsInDescribeSnapshots `json:"Tags" xml:"Tags"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_snapshot_group.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_snapshot_group.go index c50fcb2fc34..3e723391730 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_snapshot_group.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_snapshot_group.go @@ -17,12 +17,14 @@ package ecs // SnapshotGroup is a nested struct in ecs response type SnapshotGroup struct { - InstanceId string `json:"InstanceId" xml:"InstanceId"` - SnapshotGroupId string `json:"SnapshotGroupId" xml:"SnapshotGroupId"` Status string `json:"Status" xml:"Status"` - Name string `json:"Name" xml:"Name"` - Description string `json:"Description" xml:"Description"` CreationTime string `json:"CreationTime" xml:"CreationTime"` + Description string `json:"Description" xml:"Description"` ProgressStatus string `json:"ProgressStatus" xml:"ProgressStatus"` + SnapshotGroupId string `json:"SnapshotGroupId" xml:"SnapshotGroupId"` + InstanceId string `json:"InstanceId" xml:"InstanceId"` + Name string `json:"Name" xml:"Name"` + ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` + Tags TagsInDescribeSnapshotGroups `json:"Tags" xml:"Tags"` Snapshots SnapshotsInDescribeSnapshotGroups `json:"Snapshots" xml:"Snapshots"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_snapshot_link.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_snapshot_link.go index 566eb43b5c5..1f52f7d52c1 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_snapshot_link.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_snapshot_link.go @@ -17,16 +17,16 @@ package ecs // SnapshotLink is a nested struct in ecs response type SnapshotLink struct { - SnapshotLinkId string `json:"SnapshotLinkId" xml:"SnapshotLinkId"` - RegionId string `json:"RegionId" xml:"RegionId"` - InstanceId string `json:"InstanceId" xml:"InstanceId"` - InstanceName string `json:"InstanceName" xml:"InstanceName"` - SourceDiskId string `json:"SourceDiskId" xml:"SourceDiskId"` + InstantAccess bool `json:"InstantAccess" xml:"InstantAccess"` + TotalSize int64 `json:"TotalSize" xml:"TotalSize"` SourceDiskName string `json:"SourceDiskName" xml:"SourceDiskName"` SourceDiskSize int `json:"SourceDiskSize" xml:"SourceDiskSize"` SourceDiskType string `json:"SourceDiskType" xml:"SourceDiskType"` - Category string `json:"Category" xml:"Category"` - InstantAccess bool `json:"InstantAccess" xml:"InstantAccess"` - TotalSize int64 `json:"TotalSize" xml:"TotalSize"` + InstanceId string `json:"InstanceId" xml:"InstanceId"` + SnapshotLinkId string `json:"SnapshotLinkId" xml:"SnapshotLinkId"` TotalCount int `json:"TotalCount" xml:"TotalCount"` + RegionId string `json:"RegionId" xml:"RegionId"` + SourceDiskId string `json:"SourceDiskId" xml:"SourceDiskId"` + InstanceName string `json:"InstanceName" xml:"InstanceName"` + Category string `json:"Category" xml:"Category"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_storage_capacity_unit.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_storage_capacity_unit.go index fad3d309c02..f80654ea897 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_storage_capacity_unit.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_storage_capacity_unit.go @@ -17,14 +17,15 @@ package ecs // StorageCapacityUnit is a nested struct in ecs response type StorageCapacityUnit struct { - RegionId string `json:"RegionId" xml:"RegionId"` - StorageCapacityUnitId string `json:"StorageCapacityUnitId" xml:"StorageCapacityUnitId"` - Name string `json:"Name" xml:"Name"` - Capacity int `json:"Capacity" xml:"Capacity"` - Status string `json:"Status" xml:"Status"` - CreationTime string `json:"CreationTime" xml:"CreationTime"` - ExpiredTime string `json:"ExpiredTime" xml:"ExpiredTime"` - StartTime string `json:"StartTime" xml:"StartTime"` - Description string `json:"Description" xml:"Description"` - AllocationStatus string `json:"AllocationStatus" xml:"AllocationStatus"` + CreationTime string `json:"CreationTime" xml:"CreationTime"` + Status string `json:"Status" xml:"Status"` + StartTime string `json:"StartTime" xml:"StartTime"` + Capacity int `json:"Capacity" xml:"Capacity"` + Description string `json:"Description" xml:"Description"` + AllocationStatus string `json:"AllocationStatus" xml:"AllocationStatus"` + ExpiredTime string `json:"ExpiredTime" xml:"ExpiredTime"` + StorageCapacityUnitId string `json:"StorageCapacityUnitId" xml:"StorageCapacityUnitId"` + Name string `json:"Name" xml:"Name"` + RegionId string `json:"RegionId" xml:"RegionId"` + Tags TagsInDescribeStorageCapacityUnits `json:"Tags" xml:"Tags"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_tag.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_tag.go index 00d617b3c95..5f11826680a 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_tag.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_tag.go @@ -17,6 +17,8 @@ package ecs // Tag is a nested struct in ecs response type Tag struct { + Key string `json:"Key" xml:"Key"` + Value string `json:"Value" xml:"Value"` TagValue string `json:"TagValue" xml:"TagValue"` TagKey string `json:"TagKey" xml:"TagKey"` ResourceTypeCount ResourceTypeCount `json:"ResourceTypeCount" xml:"ResourceTypeCount"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_tag_resource.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_tag_resource.go index c2a94e91578..7a1d3dbe57b 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_tag_resource.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_tag_resource.go @@ -17,8 +17,8 @@ package ecs // TagResource is a nested struct in ecs response type TagResource struct { + TagValue string `json:"TagValue" xml:"TagValue"` ResourceType string `json:"ResourceType" xml:"ResourceType"` ResourceId string `json:"ResourceId" xml:"ResourceId"` TagKey string `json:"TagKey" xml:"TagKey"` - TagValue string `json:"TagValue" xml:"TagValue"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_tags_in_describe_snapshot_groups.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_tags_in_describe_snapshot_groups.go new file mode 100644 index 00000000000..2aa4ed09971 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_tags_in_describe_snapshot_groups.go @@ -0,0 +1,21 @@ +package ecs + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// TagsInDescribeSnapshotGroups is a nested struct in ecs response +type TagsInDescribeSnapshotGroups struct { + Tag []Tag `json:"Tag" xml:"Tag"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_tags_in_describe_storage_capacity_units.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_tags_in_describe_storage_capacity_units.go new file mode 100644 index 00000000000..0b646fc2384 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_tags_in_describe_storage_capacity_units.go @@ -0,0 +1,21 @@ +package ecs + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// TagsInDescribeStorageCapacityUnits is a nested struct in ecs response +type TagsInDescribeStorageCapacityUnits struct { + Tag []Tag `json:"Tag" xml:"Tag"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_zone.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_zone.go index 122868b8504..fd37d103d7b 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_zone.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_zone.go @@ -20,12 +20,13 @@ type Zone struct { ZoneNo string `json:"ZoneNo" xml:"ZoneNo"` ZoneId string `json:"ZoneId" xml:"ZoneId"` LocalName string `json:"LocalName" xml:"LocalName"` + ZoneType string `json:"ZoneType" xml:"ZoneType"` AvailableResourceCreation AvailableResourceCreation `json:"AvailableResourceCreation" xml:"AvailableResourceCreation"` AvailableVolumeCategories AvailableVolumeCategories `json:"AvailableVolumeCategories" xml:"AvailableVolumeCategories"` AvailableInstanceTypes AvailableInstanceTypesInDescribeZones `json:"AvailableInstanceTypes" xml:"AvailableInstanceTypes"` AvailableDedicatedHostTypes AvailableDedicatedHostTypes `json:"AvailableDedicatedHostTypes" xml:"AvailableDedicatedHostTypes"` NetworkTypes NetworkTypesInDescribeRecommendInstanceType `json:"NetworkTypes" xml:"NetworkTypes"` - AvailableDiskCategories AvailableDiskCategories `json:"AvailableDiskCategories" xml:"AvailableDiskCategories"` DedicatedHostGenerations DedicatedHostGenerations `json:"DedicatedHostGenerations" xml:"DedicatedHostGenerations"` + AvailableDiskCategories AvailableDiskCategories `json:"AvailableDiskCategories" xml:"AvailableDiskCategories"` AvailableResources AvailableResourcesInDescribeZones `json:"AvailableResources" xml:"AvailableResources"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/deploy_k8s_application.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/deploy_k8s_application.go index 446787911e1..3561fbc2b08 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/deploy_k8s_application.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/deploy_k8s_application.go @@ -109,6 +109,7 @@ type DeployK8sApplicationRequest struct { AppId string `position:"Query" name:"AppId"` BatchTimeout requests.Integer `position:"Query" name:"BatchTimeout"` PvcMountDescs string `position:"Query" name:"PvcMountDescs"` + EmptyDirs string `position:"Query" name:"EmptyDirs"` McpuRequest requests.Integer `position:"Query" name:"McpuRequest"` McpuLimit requests.Integer `position:"Query" name:"McpuLimit"` VolumesStr string `position:"Query" name:"VolumesStr"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/get_java_start_up_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/get_java_start_up_config.go new file mode 100644 index 00000000000..8a53a60dfce --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/get_java_start_up_config.go @@ -0,0 +1,102 @@ +package edas + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// GetJavaStartUpConfig invokes the edas.GetJavaStartUpConfig API synchronously +func (client *Client) GetJavaStartUpConfig(request *GetJavaStartUpConfigRequest) (response *GetJavaStartUpConfigResponse, err error) { + response = CreateGetJavaStartUpConfigResponse() + err = client.DoAction(request, response) + return +} + +// GetJavaStartUpConfigWithChan invokes the edas.GetJavaStartUpConfig API asynchronously +func (client *Client) GetJavaStartUpConfigWithChan(request *GetJavaStartUpConfigRequest) (<-chan *GetJavaStartUpConfigResponse, <-chan error) { + responseChan := make(chan *GetJavaStartUpConfigResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.GetJavaStartUpConfig(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// GetJavaStartUpConfigWithCallback invokes the edas.GetJavaStartUpConfig API asynchronously +func (client *Client) GetJavaStartUpConfigWithCallback(request *GetJavaStartUpConfigRequest, callback func(response *GetJavaStartUpConfigResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *GetJavaStartUpConfigResponse + var err error + defer close(result) + response, err = client.GetJavaStartUpConfig(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// GetJavaStartUpConfigRequest is the request struct for api GetJavaStartUpConfig +type GetJavaStartUpConfigRequest struct { + *requests.RoaRequest + AppId string `position:"Query" name:"AppId"` +} + +// GetJavaStartUpConfigResponse is the response struct for api GetJavaStartUpConfig +type GetJavaStartUpConfigResponse struct { + *responses.BaseResponse + Code int `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + RequestId string `json:"RequestId" xml:"RequestId"` + JavaStartUpConfig JavaStartUpConfig `json:"JavaStartUpConfig" xml:"JavaStartUpConfig"` +} + +// CreateGetJavaStartUpConfigRequest creates a request to invoke GetJavaStartUpConfig API +func CreateGetJavaStartUpConfigRequest() (request *GetJavaStartUpConfigRequest) { + request = &GetJavaStartUpConfigRequest{ + RoaRequest: &requests.RoaRequest{}, + } + request.InitWithApiInfo("Edas", "2017-08-01", "GetJavaStartUpConfig", "/pop/v5/oam/java_start_up_config", "Edas", "openAPI") + request.Method = requests.GET + return +} + +// CreateGetJavaStartUpConfigResponse creates a response to parse from GetJavaStartUpConfig response +func CreateGetJavaStartUpConfigResponse() (response *GetJavaStartUpConfigResponse) { + response = &GetJavaStartUpConfigResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/get_spring_cloud_test_method.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/get_spring_cloud_test_method.go new file mode 100644 index 00000000000..bbc8543dafb --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/get_spring_cloud_test_method.go @@ -0,0 +1,109 @@ +package edas + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// GetSpringCloudTestMethod invokes the edas.GetSpringCloudTestMethod API synchronously +func (client *Client) GetSpringCloudTestMethod(request *GetSpringCloudTestMethodRequest) (response *GetSpringCloudTestMethodResponse, err error) { + response = CreateGetSpringCloudTestMethodResponse() + err = client.DoAction(request, response) + return +} + +// GetSpringCloudTestMethodWithChan invokes the edas.GetSpringCloudTestMethod API asynchronously +func (client *Client) GetSpringCloudTestMethodWithChan(request *GetSpringCloudTestMethodRequest) (<-chan *GetSpringCloudTestMethodResponse, <-chan error) { + responseChan := make(chan *GetSpringCloudTestMethodResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.GetSpringCloudTestMethod(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// GetSpringCloudTestMethodWithCallback invokes the edas.GetSpringCloudTestMethod API asynchronously +func (client *Client) GetSpringCloudTestMethodWithCallback(request *GetSpringCloudTestMethodRequest, callback func(response *GetSpringCloudTestMethodResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *GetSpringCloudTestMethodResponse + var err error + defer close(result) + response, err = client.GetSpringCloudTestMethod(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// GetSpringCloudTestMethodRequest is the request struct for api GetSpringCloudTestMethod +type GetSpringCloudTestMethodRequest struct { + *requests.RoaRequest + AppId string `position:"Query" name:"appId"` + Namespace string `position:"Query" name:"namespace"` + HttpMethod string `position:"Query" name:"httpMethod"` + MethodSignature string `position:"Query" name:"methodSignature"` + ServiceName string `position:"Query" name:"serviceName"` + Region string `position:"Query" name:"region"` + RequiredPath string `position:"Query" name:"requiredPath"` + MethodController string `position:"Query" name:"methodController"` +} + +// GetSpringCloudTestMethodResponse is the response struct for api GetSpringCloudTestMethod +type GetSpringCloudTestMethodResponse struct { + *responses.BaseResponse + Code int `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Success bool `json:"Success" xml:"Success"` + Data Data `json:"Data" xml:"Data"` +} + +// CreateGetSpringCloudTestMethodRequest creates a request to invoke GetSpringCloudTestMethod API +func CreateGetSpringCloudTestMethodRequest() (request *GetSpringCloudTestMethodRequest) { + request = &GetSpringCloudTestMethodRequest{ + RoaRequest: &requests.RoaRequest{}, + } + request.InitWithApiInfo("Edas", "2017-08-01", "GetSpringCloudTestMethod", "/pop/sp/api/mse/test/springcloud/method", "Edas", "openAPI") + request.Method = requests.POST + return +} + +// CreateGetSpringCloudTestMethodResponse creates a response to parse from GetSpringCloudTestMethod response +func CreateGetSpringCloudTestMethodResponse() (response *GetSpringCloudTestMethodResponse) { + response = &GetSpringCloudTestMethodResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/get_web_container_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/get_web_container_config.go new file mode 100644 index 00000000000..928e36a0534 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/get_web_container_config.go @@ -0,0 +1,102 @@ +package edas + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// GetWebContainerConfig invokes the edas.GetWebContainerConfig API synchronously +func (client *Client) GetWebContainerConfig(request *GetWebContainerConfigRequest) (response *GetWebContainerConfigResponse, err error) { + response = CreateGetWebContainerConfigResponse() + err = client.DoAction(request, response) + return +} + +// GetWebContainerConfigWithChan invokes the edas.GetWebContainerConfig API asynchronously +func (client *Client) GetWebContainerConfigWithChan(request *GetWebContainerConfigRequest) (<-chan *GetWebContainerConfigResponse, <-chan error) { + responseChan := make(chan *GetWebContainerConfigResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.GetWebContainerConfig(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// GetWebContainerConfigWithCallback invokes the edas.GetWebContainerConfig API asynchronously +func (client *Client) GetWebContainerConfigWithCallback(request *GetWebContainerConfigRequest, callback func(response *GetWebContainerConfigResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *GetWebContainerConfigResponse + var err error + defer close(result) + response, err = client.GetWebContainerConfig(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// GetWebContainerConfigRequest is the request struct for api GetWebContainerConfig +type GetWebContainerConfigRequest struct { + *requests.RoaRequest + AppId string `position:"Query" name:"AppId"` +} + +// GetWebContainerConfigResponse is the response struct for api GetWebContainerConfig +type GetWebContainerConfigResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Message string `json:"Message" xml:"Message"` + Code int `json:"Code" xml:"Code"` + WebContainerConfig WebContainerConfig `json:"WebContainerConfig" xml:"WebContainerConfig"` +} + +// CreateGetWebContainerConfigRequest creates a request to invoke GetWebContainerConfig API +func CreateGetWebContainerConfigRequest() (request *GetWebContainerConfigRequest) { + request = &GetWebContainerConfigRequest{ + RoaRequest: &requests.RoaRequest{}, + } + request.InitWithApiInfo("Edas", "2017-08-01", "GetWebContainerConfig", "/pop/v5/oam/web_container_config", "Edas", "openAPI") + request.Method = requests.GET + return +} + +// CreateGetWebContainerConfigResponse creates a response to parse from GetWebContainerConfig response +func CreateGetWebContainerConfigResponse() (response *GetWebContainerConfigResponse) { + response = &GetWebContainerConfigResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/insert_k8s_application.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/insert_k8s_application.go index a5b0dc47e12..57932c7457c 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/insert_k8s_application.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/insert_k8s_application.go @@ -83,8 +83,10 @@ type InsertK8sApplicationRequest struct { IntranetSlbPort requests.Integer `position:"Query" name:"IntranetSlbPort"` DeployAcrossNodes string `position:"Query" name:"DeployAcrossNodes"` PreStop string `position:"Query" name:"PreStop"` + BuildPackId string `position:"Query" name:"BuildPackId"` LocalVolume string `position:"Query" name:"LocalVolume"` UseBodyEncoding requests.Boolean `position:"Query" name:"UseBodyEncoding"` + EmptyDirs string `position:"Query" name:"EmptyDirs"` PackageType string `position:"Query" name:"PackageType"` RuntimeClassName string `position:"Query" name:"RuntimeClassName"` PostStart string `position:"Query" name:"PostStart"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/struct_app.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/struct_app.go index 8852bee9d44..66c02a7a200 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/struct_app.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/struct_app.go @@ -26,11 +26,14 @@ type App struct { EdasContainerVersion string `json:"EdasContainerVersion" xml:"EdasContainerVersion"` RegionId string `json:"RegionId" xml:"RegionId"` SlbPort int `json:"SlbPort" xml:"SlbPort"` + RequestMem int `json:"RequestMem" xml:"RequestMem"` UserId string `json:"UserId" xml:"UserId"` ApplicationType string `json:"ApplicationType" xml:"ApplicationType"` TomcatVersion string `json:"TomcatVersion" xml:"TomcatVersion"` Description string `json:"Description" xml:"Description"` + LimitMem int `json:"LimitMem" xml:"LimitMem"` ClusterId string `json:"ClusterId" xml:"ClusterId"` + LimitCpuM int `json:"LimitCpuM" xml:"LimitCpuM"` Port int `json:"Port" xml:"Port"` ApplicationName string `json:"ApplicationName" xml:"ApplicationName"` ExtSlbIp string `json:"ExtSlbIp" xml:"ExtSlbIp"` @@ -40,6 +43,7 @@ type App struct { ExtSlbId string `json:"ExtSlbId" xml:"ExtSlbId"` Owner string `json:"Owner" xml:"Owner"` AppId string `json:"AppId" xml:"AppId"` + K8sNamespace string `json:"K8sNamespace" xml:"K8sNamespace"` InstanceCount int `json:"InstanceCount" xml:"InstanceCount"` HealthCheckUrl string `json:"HealthCheckUrl" xml:"HealthCheckUrl"` InstancesBeforeScaling int `json:"InstancesBeforeScaling" xml:"InstancesBeforeScaling"` @@ -47,6 +51,7 @@ type App struct { ClusterType int `json:"ClusterType" xml:"ClusterType"` Cpu int `json:"Cpu" xml:"Cpu"` Cmd string `json:"Cmd" xml:"Cmd"` + RequestCpuM int `json:"RequestCpuM" xml:"RequestCpuM"` RunningInstanceCount int `json:"RunningInstanceCount" xml:"RunningInstanceCount"` SlbIp string `json:"SlbIp" xml:"SlbIp"` CmdArgs CmdArgs `json:"CmdArgs" xml:"CmdArgs"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/struct_applcation.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/struct_applcation.go index 15b19e516d4..e9701f6de1c 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/struct_applcation.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/struct_applcation.go @@ -17,36 +17,37 @@ package edas // Applcation is a nested struct in edas response type Applcation struct { - Name string `json:"Name" xml:"Name"` - CreateTime int64 `json:"CreateTime" xml:"CreateTime"` - Dockerize bool `json:"Dockerize" xml:"Dockerize"` - SlbInfo string `json:"SlbInfo" xml:"SlbInfo"` - RegionId string `json:"RegionId" xml:"RegionId"` - SlbPort int `json:"SlbPort" xml:"SlbPort"` - UserId string `json:"UserId" xml:"UserId"` - ApplicationType string `json:"ApplicationType" xml:"ApplicationType"` - Description string `json:"Description" xml:"Description"` - ClusterId string `json:"ClusterId" xml:"ClusterId"` - Port int `json:"Port" xml:"Port"` - ExtSlbIp string `json:"ExtSlbIp" xml:"ExtSlbIp"` - BuildPackageId int64 `json:"BuildPackageId" xml:"BuildPackageId"` - Email string `json:"Email" xml:"Email"` - Memory int `json:"Memory" xml:"Memory"` - NameSpace string `json:"NameSpace" xml:"NameSpace"` - ExtSlbId string `json:"ExtSlbId" xml:"ExtSlbId"` - Owner string `json:"Owner" xml:"Owner"` - ExtSlbName string `json:"ExtSlbName" xml:"ExtSlbName"` - SlbName string `json:"SlbName" xml:"SlbName"` - AppId string `json:"AppId" xml:"AppId"` - InstanceCount int `json:"InstanceCount" xml:"InstanceCount"` - HealthCheckUrl string `json:"HealthCheckUrl" xml:"HealthCheckUrl"` - SlbId string `json:"SlbId" xml:"SlbId"` - ClusterType int `json:"ClusterType" xml:"ClusterType"` - Cpu int `json:"Cpu" xml:"Cpu"` - RunningInstanceCount int `json:"RunningInstanceCount" xml:"RunningInstanceCount"` - SlbIp string `json:"SlbIp" xml:"SlbIp"` - App App `json:"App" xml:"App"` - Conf Conf `json:"Conf" xml:"Conf"` - ImageInfo ImageInfo `json:"ImageInfo" xml:"ImageInfo"` - DeployGroups DeployGroups `json:"DeployGroups" xml:"DeployGroups"` + Name string `json:"Name" xml:"Name"` + CreateTime int64 `json:"CreateTime" xml:"CreateTime"` + Dockerize bool `json:"Dockerize" xml:"Dockerize"` + SlbInfo string `json:"SlbInfo" xml:"SlbInfo"` + RegionId string `json:"RegionId" xml:"RegionId"` + SlbPort int `json:"SlbPort" xml:"SlbPort"` + UserId string `json:"UserId" xml:"UserId"` + ApplicationType string `json:"ApplicationType" xml:"ApplicationType"` + Description string `json:"Description" xml:"Description"` + ClusterId string `json:"ClusterId" xml:"ClusterId"` + Port int `json:"Port" xml:"Port"` + ExtSlbIp string `json:"ExtSlbIp" xml:"ExtSlbIp"` + BuildPackageId int64 `json:"BuildPackageId" xml:"BuildPackageId"` + Email string `json:"Email" xml:"Email"` + Memory int `json:"Memory" xml:"Memory"` + NameSpace string `json:"NameSpace" xml:"NameSpace"` + ExtSlbId string `json:"ExtSlbId" xml:"ExtSlbId"` + Owner string `json:"Owner" xml:"Owner"` + ExtSlbName string `json:"ExtSlbName" xml:"ExtSlbName"` + SlbName string `json:"SlbName" xml:"SlbName"` + AppId string `json:"AppId" xml:"AppId"` + InstanceCount int `json:"InstanceCount" xml:"InstanceCount"` + HealthCheckUrl string `json:"HealthCheckUrl" xml:"HealthCheckUrl"` + SlbId string `json:"SlbId" xml:"SlbId"` + ClusterType int `json:"ClusterType" xml:"ClusterType"` + Cpu int `json:"Cpu" xml:"Cpu"` + RunningInstanceCount int `json:"RunningInstanceCount" xml:"RunningInstanceCount"` + SlbIp string `json:"SlbIp" xml:"SlbIp"` + Conf Conf `json:"Conf" xml:"Conf"` + App App `json:"App" xml:"App"` + LatestVersion LatestVersion `json:"LatestVersion" xml:"LatestVersion"` + ImageInfo ImageInfo `json:"ImageInfo" xml:"ImageInfo"` + DeployGroups DeployGroups `json:"DeployGroups" xml:"DeployGroups"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/struct_components_item.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/struct_components_item.go index 3113dcbddd3..acd735f0fc3 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/struct_components_item.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/struct_components_item.go @@ -19,4 +19,5 @@ package edas type ComponentsItem struct { ComponentId string `json:"ComponentId" xml:"ComponentId"` ComponentKey string `json:"ComponentKey" xml:"ComponentKey"` + Type string `json:"Type" xml:"Type"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/struct_data.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/struct_data.go index 95acfe06af0..967f659079d 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/struct_data.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/struct_data.go @@ -34,6 +34,7 @@ type Data struct { ExtVServerGroupId string `json:"ExtVServerGroupId" xml:"ExtVServerGroupId"` PodName string `json:"PodName" xml:"PodName"` Total int `json:"Total" xml:"Total"` + HttpHeaders map[string]interface{} `json:"HttpHeaders" xml:"HttpHeaders"` AppInfos string `json:"AppInfos" xml:"AppInfos"` Enabled bool `json:"Enabled" xml:"Enabled"` Enable bool `json:"Enable" xml:"Enable"` @@ -65,12 +66,15 @@ type Data struct { TotalElements int `json:"TotalElements" xml:"TotalElements"` EntryRule string `json:"EntryRule" xml:"EntryRule"` SlbName string `json:"SlbName" xml:"SlbName"` + Params map[string]interface{} `json:"Params" xml:"Params"` ScMockItemJson string `json:"ScMockItemJson" xml:"ScMockItemJson"` NamespaceId string `json:"NamespaceId" xml:"NamespaceId"` GroupId int64 `json:"GroupId" xml:"GroupId"` ProviderAppId string `json:"ProviderAppId" xml:"ProviderAppId"` Kind string `json:"Kind" xml:"Kind"` SlbIp string `json:"SlbIp" xml:"SlbIp"` + Urls []string `json:"Urls" xml:"Urls"` + RequestMethods []string `json:"RequestMethods" xml:"RequestMethods"` EntryApplication EntryApplication `json:"EntryApplication" xml:"EntryApplication"` Spec Spec `json:"Spec" xml:"Spec"` Metadata Metadata `json:"Metadata" xml:"Metadata"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/struct_java_start_up_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/struct_java_start_up_config.go new file mode 100644 index 00000000000..c4db759a8fe --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/struct_java_start_up_config.go @@ -0,0 +1,22 @@ +package edas + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// JavaStartUpConfig is a nested struct in edas response +type JavaStartUpConfig struct { + OriginalConfigs string `json:"OriginalConfigs" xml:"OriginalConfigs"` + StartUpArgs string `json:"StartUpArgs" xml:"StartUpArgs"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/struct_latest_version.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/struct_latest_version.go new file mode 100644 index 00000000000..83d7fea56c8 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/struct_latest_version.go @@ -0,0 +1,23 @@ +package edas + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// LatestVersion is a nested struct in edas response +type LatestVersion struct { + PackageVersion string `json:"PackageVersion" xml:"PackageVersion"` + Url string `json:"Url" xml:"Url"` + WarUrl string `json:"WarUrl" xml:"WarUrl"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/struct_request_methods.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/struct_request_methods.go new file mode 100644 index 00000000000..f8be8967684 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/struct_request_methods.go @@ -0,0 +1,21 @@ +package edas + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// RequestMethods is a nested struct in edas response +type RequestMethods struct { + RequestMethod []string `json:"RequestMethod" xml:"RequestMethod"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/struct_urls.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/struct_urls.go new file mode 100644 index 00000000000..e435f182ecc --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/struct_urls.go @@ -0,0 +1,21 @@ +package edas + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Urls is a nested struct in edas response +type Urls struct { + Url []string `json:"Url" xml:"Url"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/struct_web_container_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/struct_web_container_config.go new file mode 100644 index 00000000000..53605efd6f7 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/struct_web_container_config.go @@ -0,0 +1,29 @@ +package edas + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// WebContainerConfig is a nested struct in edas response +type WebContainerConfig struct { + ContextInputType string `json:"ContextInputType" xml:"ContextInputType"` + ContextPath string `json:"ContextPath" xml:"ContextPath"` + HttpPort int `json:"HttpPort" xml:"HttpPort"` + MaxThreads int `json:"MaxThreads" xml:"MaxThreads"` + ServerXml string `json:"ServerXml" xml:"ServerXml"` + UriEncoding string `json:"UriEncoding" xml:"UriEncoding"` + UseAdvancedServerXml bool `json:"UseAdvancedServerXml" xml:"UseAdvancedServerXml"` + UseBodyEncoding bool `json:"UseBodyEncoding" xml:"UseBodyEncoding"` + UseDefaultConfig bool `json:"UseDefaultConfig" xml:"UseDefaultConfig"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/unbind_slb.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/unbind_slb.go index d46b78531ab..14c60c1da01 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/unbind_slb.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/unbind_slb.go @@ -71,9 +71,10 @@ func (client *Client) UnbindSlbWithCallback(request *UnbindSlbRequest, callback // UnbindSlbRequest is the request struct for api UnbindSlb type UnbindSlbRequest struct { *requests.RoaRequest - SlbId string `position:"Query" name:"SlbId"` - AppId string `position:"Query" name:"AppId"` - Type string `position:"Query" name:"Type"` + SlbId string `position:"Query" name:"SlbId"` + AppId string `position:"Query" name:"AppId"` + DeleteListener string `position:"Query" name:"DeleteListener"` + Type string `position:"Query" name:"Type"` } // UnbindSlbResponse is the response struct for api UnbindSlb diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/update_k8s_slb.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/update_k8s_slb.go index bb2c4ea823c..a5a0c720dda 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/update_k8s_slb.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/update_k8s_slb.go @@ -71,16 +71,17 @@ func (client *Client) UpdateK8sSlbWithCallback(request *UpdateK8sSlbRequest, cal // UpdateK8sSlbRequest is the request struct for api UpdateK8sSlb type UpdateK8sSlbRequest struct { *requests.RoaRequest - Scheduler string `position:"Query" name:"Scheduler"` - ServicePortInfos string `position:"Query" name:"ServicePortInfos"` - SlbProtocol string `position:"Query" name:"SlbProtocol"` - SlbName string `position:"Query" name:"SlbName"` - Port string `position:"Query" name:"Port"` - AppId string `position:"Query" name:"AppId"` - Specification string `position:"Query" name:"Specification"` - ClusterId string `position:"Query" name:"ClusterId"` - Type string `position:"Query" name:"Type"` - TargetPort string `position:"Query" name:"TargetPort"` + Scheduler string `position:"Query" name:"Scheduler"` + ServicePortInfos string `position:"Query" name:"ServicePortInfos"` + SlbProtocol string `position:"Query" name:"SlbProtocol"` + SlbName string `position:"Query" name:"SlbName"` + Port string `position:"Query" name:"Port"` + AppId string `position:"Query" name:"AppId"` + DisableForceOverride requests.Boolean `position:"Query" name:"DisableForceOverride"` + Specification string `position:"Query" name:"Specification"` + ClusterId string `position:"Query" name:"ClusterId"` + Type string `position:"Query" name:"Type"` + TargetPort string `position:"Query" name:"TargetPort"` } // UpdateK8sSlbResponse is the response struct for api UpdateK8sSlb diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/validate_k8s_resource.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/validate_k8s_resource.go new file mode 100644 index 00000000000..586fcaf3cc1 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/edas/validate_k8s_resource.go @@ -0,0 +1,105 @@ +package edas + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ValidateK8sResource invokes the edas.ValidateK8sResource API synchronously +func (client *Client) ValidateK8sResource(request *ValidateK8sResourceRequest) (response *ValidateK8sResourceResponse, err error) { + response = CreateValidateK8sResourceResponse() + err = client.DoAction(request, response) + return +} + +// ValidateK8sResourceWithChan invokes the edas.ValidateK8sResource API asynchronously +func (client *Client) ValidateK8sResourceWithChan(request *ValidateK8sResourceRequest) (<-chan *ValidateK8sResourceResponse, <-chan error) { + responseChan := make(chan *ValidateK8sResourceResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ValidateK8sResource(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ValidateK8sResourceWithCallback invokes the edas.ValidateK8sResource API asynchronously +func (client *Client) ValidateK8sResourceWithCallback(request *ValidateK8sResourceRequest, callback func(response *ValidateK8sResourceResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ValidateK8sResourceResponse + var err error + defer close(result) + response, err = client.ValidateK8sResource(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ValidateK8sResourceRequest is the request struct for api ValidateK8sResource +type ValidateK8sResourceRequest struct { + *requests.RoaRequest + Kind string `position:"Body" name:"Kind"` + AppId string `position:"Body" name:"AppId"` + Namespace string `position:"Body" name:"Namespace"` + Format string `position:"Body" name:"Format"` + Content string `position:"Body" name:"Content"` +} + +// ValidateK8sResourceResponse is the response struct for api ValidateK8sResource +type ValidateK8sResourceResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Code int `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` +} + +// CreateValidateK8sResourceRequest creates a request to invoke ValidateK8sResource API +func CreateValidateK8sResourceRequest() (request *ValidateK8sResourceRequest) { + request = &ValidateK8sResourceRequest{ + RoaRequest: &requests.RoaRequest{}, + } + request.InitWithApiInfo("Edas", "2017-08-01", "ValidateK8sResource", "/pop/v5/k8s/acs/validate_k8s_resource", "Edas", "openAPI") + request.Method = requests.POST + return +} + +// CreateValidateK8sResourceResponse creates a response to parse from ValidateK8sResource response +func CreateValidateK8sResourceResponse() (response *ValidateK8sResourceResponse) { + response = &ValidateK8sResourceResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/create_vpc_endpoint.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/create_vpc_endpoint.go new file mode 100644 index 00000000000..66929102090 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/create_vpc_endpoint.go @@ -0,0 +1,102 @@ +package elasticsearch + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// CreateVpcEndpoint invokes the elasticsearch.CreateVpcEndpoint API synchronously +func (client *Client) CreateVpcEndpoint(request *CreateVpcEndpointRequest) (response *CreateVpcEndpointResponse, err error) { + response = CreateCreateVpcEndpointResponse() + err = client.DoAction(request, response) + return +} + +// CreateVpcEndpointWithChan invokes the elasticsearch.CreateVpcEndpoint API asynchronously +func (client *Client) CreateVpcEndpointWithChan(request *CreateVpcEndpointRequest) (<-chan *CreateVpcEndpointResponse, <-chan error) { + responseChan := make(chan *CreateVpcEndpointResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.CreateVpcEndpoint(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// CreateVpcEndpointWithCallback invokes the elasticsearch.CreateVpcEndpoint API asynchronously +func (client *Client) CreateVpcEndpointWithCallback(request *CreateVpcEndpointRequest, callback func(response *CreateVpcEndpointResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *CreateVpcEndpointResponse + var err error + defer close(result) + response, err = client.CreateVpcEndpoint(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// CreateVpcEndpointRequest is the request struct for api CreateVpcEndpoint +type CreateVpcEndpointRequest struct { + *requests.RoaRequest + InstanceId string `position:"Path" name:"InstanceId"` + DryRun requests.Boolean `position:"Query" name:"dryRun"` + ClientToken string `position:"Query" name:"ClientToken"` +} + +// CreateVpcEndpointResponse is the response struct for api CreateVpcEndpoint +type CreateVpcEndpointResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Result Result `json:"Result" xml:"Result"` +} + +// CreateCreateVpcEndpointRequest creates a request to invoke CreateVpcEndpoint API +func CreateCreateVpcEndpointRequest() (request *CreateVpcEndpointRequest) { + request = &CreateVpcEndpointRequest{ + RoaRequest: &requests.RoaRequest{}, + } + request.InitWithApiInfo("elasticsearch", "2017-06-13", "CreateVpcEndpoint", "/openapi/instances/[InstanceId]/vpc-endpoints", "elasticsearch", "openAPI") + request.Method = requests.POST + return +} + +// CreateCreateVpcEndpointResponse creates a response to parse from CreateVpcEndpoint response +func CreateCreateVpcEndpointResponse() (response *CreateVpcEndpointResponse) { + response = &CreateVpcEndpointResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/delete_vpc_endpoint.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/delete_vpc_endpoint.go new file mode 100644 index 00000000000..2cb272b156b --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/delete_vpc_endpoint.go @@ -0,0 +1,102 @@ +package elasticsearch + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DeleteVpcEndpoint invokes the elasticsearch.DeleteVpcEndpoint API synchronously +func (client *Client) DeleteVpcEndpoint(request *DeleteVpcEndpointRequest) (response *DeleteVpcEndpointResponse, err error) { + response = CreateDeleteVpcEndpointResponse() + err = client.DoAction(request, response) + return +} + +// DeleteVpcEndpointWithChan invokes the elasticsearch.DeleteVpcEndpoint API asynchronously +func (client *Client) DeleteVpcEndpointWithChan(request *DeleteVpcEndpointRequest) (<-chan *DeleteVpcEndpointResponse, <-chan error) { + responseChan := make(chan *DeleteVpcEndpointResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DeleteVpcEndpoint(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DeleteVpcEndpointWithCallback invokes the elasticsearch.DeleteVpcEndpoint API asynchronously +func (client *Client) DeleteVpcEndpointWithCallback(request *DeleteVpcEndpointRequest, callback func(response *DeleteVpcEndpointResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DeleteVpcEndpointResponse + var err error + defer close(result) + response, err = client.DeleteVpcEndpoint(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DeleteVpcEndpointRequest is the request struct for api DeleteVpcEndpoint +type DeleteVpcEndpointRequest struct { + *requests.RoaRequest + InstanceId string `position:"Path" name:"InstanceId"` + ClientToken string `position:"Query" name:"ClientToken"` + EndpointId string `position:"Path" name:"EndpointId"` +} + +// DeleteVpcEndpointResponse is the response struct for api DeleteVpcEndpoint +type DeleteVpcEndpointResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Result bool `json:"Result" xml:"Result"` +} + +// CreateDeleteVpcEndpointRequest creates a request to invoke DeleteVpcEndpoint API +func CreateDeleteVpcEndpointRequest() (request *DeleteVpcEndpointRequest) { + request = &DeleteVpcEndpointRequest{ + RoaRequest: &requests.RoaRequest{}, + } + request.InitWithApiInfo("elasticsearch", "2017-06-13", "DeleteVpcEndpoint", "/openapi/instances/[InstanceId]/vpc-endpoints/[EndpointId]", "elasticsearch", "openAPI") + request.Method = requests.DELETE + return +} + +// CreateDeleteVpcEndpointResponse creates a response to parse from DeleteVpcEndpoint response +func CreateDeleteVpcEndpointResponse() (response *DeleteVpcEndpointResponse) { + response = &DeleteVpcEndpointResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/list_dicts.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/list_dicts.go new file mode 100644 index 00000000000..d43fc974430 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/list_dicts.go @@ -0,0 +1,103 @@ +package elasticsearch + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ListDicts invokes the elasticsearch.ListDicts API synchronously +func (client *Client) ListDicts(request *ListDictsRequest) (response *ListDictsResponse, err error) { + response = CreateListDictsResponse() + err = client.DoAction(request, response) + return +} + +// ListDictsWithChan invokes the elasticsearch.ListDicts API asynchronously +func (client *Client) ListDictsWithChan(request *ListDictsRequest) (<-chan *ListDictsResponse, <-chan error) { + responseChan := make(chan *ListDictsResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ListDicts(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ListDictsWithCallback invokes the elasticsearch.ListDicts API asynchronously +func (client *Client) ListDictsWithCallback(request *ListDictsRequest, callback func(response *ListDictsResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ListDictsResponse + var err error + defer close(result) + response, err = client.ListDicts(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ListDictsRequest is the request struct for api ListDicts +type ListDictsRequest struct { + *requests.RoaRequest + InstanceId string `position:"Path" name:"InstanceId"` + AnalyzerType string `position:"Query" name:"analyzerType"` + Name string `position:"Query" name:"name"` +} + +// ListDictsResponse is the response struct for api ListDicts +type ListDictsResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Headers Headers `json:"Headers" xml:"Headers"` + Result []ResultItem `json:"Result" xml:"Result"` +} + +// CreateListDictsRequest creates a request to invoke ListDicts API +func CreateListDictsRequest() (request *ListDictsRequest) { + request = &ListDictsRequest{ + RoaRequest: &requests.RoaRequest{}, + } + request.InitWithApiInfo("elasticsearch", "2017-06-13", "ListDicts", "/openapi/instances/[InstanceId]/dicts", "elasticsearch", "openAPI") + request.Method = requests.GET + return +} + +// CreateListDictsResponse creates a response to parse from ListDicts response +func CreateListDictsResponse() (response *ListDictsResponse) { + response = &ListDictsResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/list_instance_indices.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/list_instance_indices.go index 86cbd34f348..32a8f60ff32 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/list_instance_indices.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/list_instance_indices.go @@ -71,10 +71,10 @@ func (client *Client) ListInstanceIndicesWithCallback(request *ListInstanceIndic // ListInstanceIndicesRequest is the request struct for api ListInstanceIndices type ListInstanceIndicesRequest struct { *requests.RoaRequest + All requests.Boolean `position:"Query" name:"all"` InstanceId string `position:"Path" name:"InstanceId"` IsManaged requests.Boolean `position:"Query" name:"isManaged"` Name string `position:"Query" name:"name"` - Lang string `position:"Query" name:"lang"` } // ListInstanceIndicesResponse is the response struct for api ListInstanceIndices diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/list_shard_recoveries.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/list_shard_recoveries.go new file mode 100644 index 00000000000..180dccd7ba0 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/list_shard_recoveries.go @@ -0,0 +1,101 @@ +package elasticsearch + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ListShardRecoveries invokes the elasticsearch.ListShardRecoveries API synchronously +func (client *Client) ListShardRecoveries(request *ListShardRecoveriesRequest) (response *ListShardRecoveriesResponse, err error) { + response = CreateListShardRecoveriesResponse() + err = client.DoAction(request, response) + return +} + +// ListShardRecoveriesWithChan invokes the elasticsearch.ListShardRecoveries API asynchronously +func (client *Client) ListShardRecoveriesWithChan(request *ListShardRecoveriesRequest) (<-chan *ListShardRecoveriesResponse, <-chan error) { + responseChan := make(chan *ListShardRecoveriesResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ListShardRecoveries(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ListShardRecoveriesWithCallback invokes the elasticsearch.ListShardRecoveries API asynchronously +func (client *Client) ListShardRecoveriesWithCallback(request *ListShardRecoveriesRequest, callback func(response *ListShardRecoveriesResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ListShardRecoveriesResponse + var err error + defer close(result) + response, err = client.ListShardRecoveries(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ListShardRecoveriesRequest is the request struct for api ListShardRecoveries +type ListShardRecoveriesRequest struct { + *requests.RoaRequest + ActiveOnly requests.Boolean `position:"Query" name:"activeOnly"` + InstanceId string `position:"Path" name:"InstanceId"` +} + +// ListShardRecoveriesResponse is the response struct for api ListShardRecoveries +type ListShardRecoveriesResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Result []ResultItem `json:"Result" xml:"Result"` +} + +// CreateListShardRecoveriesRequest creates a request to invoke ListShardRecoveries API +func CreateListShardRecoveriesRequest() (request *ListShardRecoveriesRequest) { + request = &ListShardRecoveriesRequest{ + RoaRequest: &requests.RoaRequest{}, + } + request.InitWithApiInfo("elasticsearch", "2017-06-13", "ListShardRecoveries", "/openapi/instances/[InstanceId]/cat-recovery", "elasticsearch", "openAPI") + request.Method = requests.GET + return +} + +// CreateListShardRecoveriesResponse creates a response to parse from ListShardRecoveries response +func CreateListShardRecoveriesResponse() (response *ListShardRecoveriesResponse) { + response = &ListShardRecoveriesResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/list_vpc_endpoints.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/list_vpc_endpoints.go new file mode 100644 index 00000000000..19fd5a8f5e2 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/list_vpc_endpoints.go @@ -0,0 +1,102 @@ +package elasticsearch + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ListVpcEndpoints invokes the elasticsearch.ListVpcEndpoints API synchronously +func (client *Client) ListVpcEndpoints(request *ListVpcEndpointsRequest) (response *ListVpcEndpointsResponse, err error) { + response = CreateListVpcEndpointsResponse() + err = client.DoAction(request, response) + return +} + +// ListVpcEndpointsWithChan invokes the elasticsearch.ListVpcEndpoints API asynchronously +func (client *Client) ListVpcEndpointsWithChan(request *ListVpcEndpointsRequest) (<-chan *ListVpcEndpointsResponse, <-chan error) { + responseChan := make(chan *ListVpcEndpointsResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ListVpcEndpoints(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ListVpcEndpointsWithCallback invokes the elasticsearch.ListVpcEndpoints API asynchronously +func (client *Client) ListVpcEndpointsWithCallback(request *ListVpcEndpointsRequest, callback func(response *ListVpcEndpointsResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ListVpcEndpointsResponse + var err error + defer close(result) + response, err = client.ListVpcEndpoints(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ListVpcEndpointsRequest is the request struct for api ListVpcEndpoints +type ListVpcEndpointsRequest struct { + *requests.RoaRequest + InstanceId string `position:"Path" name:"InstanceId"` + Size requests.Integer `position:"Query" name:"size"` + Page requests.Integer `position:"Query" name:"page"` +} + +// ListVpcEndpointsResponse is the response struct for api ListVpcEndpoints +type ListVpcEndpointsResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Result []ResultItem `json:"Result" xml:"Result"` +} + +// CreateListVpcEndpointsRequest creates a request to invoke ListVpcEndpoints API +func CreateListVpcEndpointsRequest() (request *ListVpcEndpointsRequest) { + request = &ListVpcEndpointsRequest{ + RoaRequest: &requests.RoaRequest{}, + } + request.InitWithApiInfo("elasticsearch", "2017-06-13", "ListVpcEndpoints", "/openapi/instances/[InstanceId]/vpc-endpoints", "elasticsearch", "openAPI") + request.Method = requests.GET + return +} + +// CreateListVpcEndpointsResponse creates a response to parse from ListVpcEndpoints response +func CreateListVpcEndpointsResponse() (response *ListVpcEndpointsResponse) { + response = &ListVpcEndpointsResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/modify_white_ips.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/modify_white_ips.go index 44b09805345..584ee23f91d 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/modify_white_ips.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/modify_white_ips.go @@ -71,6 +71,7 @@ func (client *Client) ModifyWhiteIpsWithCallback(request *ModifyWhiteIpsRequest, // ModifyWhiteIpsRequest is the request struct for api ModifyWhiteIps type ModifyWhiteIpsRequest struct { *requests.RoaRequest + ModifyMode string `position:"Body" name:"modifyMode"` InstanceId string `position:"Path" name:"InstanceId"` NodeType string `position:"Body" name:"nodeType"` ClientToken string `position:"Query" name:"clientToken"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_instance.go index 24006bc1974..80a360ccec0 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_instance.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_instance.go @@ -18,12 +18,14 @@ package elasticsearch // Instance is a nested struct in elasticsearch response type Instance struct { DedicateMaster bool `json:"dedicateMaster" xml:"dedicateMaster"` + ServiceVpc bool `json:"serviceVpc" xml:"serviceVpc"` UpdatedAt string `json:"updatedAt" xml:"updatedAt"` NodeAmount int `json:"nodeAmount" xml:"nodeAmount"` InstanceId string `json:"instanceId" xml:"instanceId"` Status string `json:"status" xml:"status"` Description string `json:"description" xml:"description"` AdvancedDedicateMaster bool `json:"advancedDedicateMaster" xml:"advancedDedicateMaster"` + IsNewDeployment string `json:"isNewDeployment" xml:"isNewDeployment"` EsVersion string `json:"esVersion" xml:"esVersion"` PostpaidServiceStatus string `json:"postpaidServiceStatus" xml:"postpaidServiceStatus"` PaymentType string `json:"paymentType" xml:"paymentType"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_ips.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_ips.go new file mode 100644 index 00000000000..25531c02991 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_ips.go @@ -0,0 +1,21 @@ +package elasticsearch + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Ips is a nested struct in elasticsearch response +type Ips struct { + Ips []string `json:"ips" xml:"ips"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_kibana_private_ip_whitelist.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_kibana_private_ip_whitelist.go deleted file mode 100644 index b3bb2db4fe9..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_kibana_private_ip_whitelist.go +++ /dev/null @@ -1,21 +0,0 @@ -package elasticsearch - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// KibanaPrivateIPWhitelist is a nested struct in elasticsearch response -type KibanaPrivateIPWhitelist struct { - WhiteIP []string `json:"WhiteIP" xml:"WhiteIP"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_kibana_private_ip_whitelist_in_describe_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_kibana_private_ip_whitelist_in_describe_instance.go new file mode 100644 index 00000000000..0d3c6f5c138 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_kibana_private_ip_whitelist_in_describe_instance.go @@ -0,0 +1,21 @@ +package elasticsearch + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// KibanaPrivateIPWhitelistInDescribeInstance is a nested struct in elasticsearch response +type KibanaPrivateIPWhitelistInDescribeInstance struct { + WhiteIP []string `json:"WhiteIP" xml:"WhiteIP"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_kibana_private_ip_whitelist_in_update_kibana_white_ips.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_kibana_private_ip_whitelist_in_update_kibana_white_ips.go new file mode 100644 index 00000000000..2ea73fa9b0c --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_kibana_private_ip_whitelist_in_update_kibana_white_ips.go @@ -0,0 +1,21 @@ +package elasticsearch + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// KibanaPrivateIPWhitelistInUpdateKibanaWhiteIps is a nested struct in elasticsearch response +type KibanaPrivateIPWhitelistInUpdateKibanaWhiteIps struct { + KibanaPrivateIPWhitelist []string `json:"kibanaPrivateIPWhitelist" xml:"kibanaPrivateIPWhitelist"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_network_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_network_config.go index 1e6e10a96ea..460f60902fc 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_network_config.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_network_config.go @@ -17,8 +17,9 @@ package elasticsearch // NetworkConfig is a nested struct in elasticsearch response type NetworkConfig struct { - Type string `json:"type" xml:"type"` - VsArea string `json:"vsArea" xml:"vsArea"` - VswitchId string `json:"vswitchId" xml:"vswitchId"` - VpcId string `json:"vpcId" xml:"vpcId"` + Type string `json:"type" xml:"type"` + VsArea string `json:"vsArea" xml:"vsArea"` + VswitchId string `json:"vswitchId" xml:"vswitchId"` + VpcId string `json:"vpcId" xml:"vpcId"` + WhiteIpGroupList []WhiteIpGroupListItem `json:"whiteIpGroupList" xml:"whiteIpGroupList"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_result.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_result.go index 751762bc557..4b087fdf45d 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_result.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_result.go @@ -22,6 +22,7 @@ type Result struct { Endpoints string `json:"endpoints" xml:"endpoints"` IlmPolicy string `json:"ilmPolicy" xml:"ilmPolicy"` Priority int `json:"priority" xml:"priority"` + EndpointName string `json:"endpointName" xml:"endpointName"` Tags map[string]interface{} `json:"tags" xml:"tags"` Domain string `json:"domain" xml:"domain"` GmtUpdateTime string `json:"gmtUpdateTime" xml:"gmtUpdateTime"` @@ -29,6 +30,7 @@ type Result struct { ResVersion string `json:"resVersion" xml:"resVersion"` PipelineId string `json:"pipelineId" xml:"pipelineId"` RegionId string `json:"regionId" xml:"regionId"` + EndpointDomain string `json:"endpointDomain" xml:"endpointDomain"` Env string `json:"env" xml:"env"` VpcId string `json:"vpcId" xml:"vpcId"` Connectable bool `json:"connectable" xml:"connectable"` @@ -49,6 +51,7 @@ type Result struct { NodeAmount int `json:"nodeAmount" xml:"nodeAmount"` DataStream bool `json:"dataStream" xml:"dataStream"` InstanceId string `json:"instanceId" xml:"instanceId"` + ServiceId string `json:"serviceId" xml:"serviceId"` Description string `json:"description" xml:"description"` Trigger string `json:"trigger" xml:"trigger"` EsInstanceId string `json:"esInstanceId" xml:"esInstanceId"` @@ -67,6 +70,7 @@ type Result struct { Name string `json:"name" xml:"name"` MessageWatermark int64 `json:"messageWatermark" xml:"messageWatermark"` QuartzRegex string `json:"QuartzRegex" xml:"QuartzRegex"` + EndpointId string `json:"endpointId" xml:"endpointId"` ResType string `json:"resType" xml:"resType"` Integrity float64 `json:"integrity" xml:"integrity"` EnablePublic bool `json:"enablePublic" xml:"enablePublic"` @@ -91,12 +95,13 @@ type Result struct { EsVersions []string `json:"esVersions" xml:"esVersions"` EsIPWhitelist []string `json:"esIPWhitelist" xml:"esIPWhitelist"` PublicIpWhitelist []string `json:"publicIpWhitelist" xml:"publicIpWhitelist"` + KibanaPrivateIPWhitelist []string `json:"kibanaPrivateIPWhitelist" xml:"kibanaPrivateIPWhitelist"` Zones []string `json:"zones" xml:"zones"` + KibanaIPWhitelist []string `json:"kibanaIPWhitelist" xml:"kibanaIPWhitelist"` EsIPBlacklist []string `json:"esIPBlacklist" xml:"esIPBlacklist"` IndexPatterns []string `json:"indexPatterns" xml:"indexPatterns"` ClientNodeSpec []string `json:"clientNodeSpec" xml:"clientNodeSpec"` InstanceSupportNodes []string `json:"instanceSupportNodes" xml:"instanceSupportNodes"` - KibanaIPWhitelist []string `json:"kibanaIPWhitelist" xml:"kibanaIPWhitelist"` PipelineIds []string `json:"pipelineIds" xml:"pipelineIds"` Node Node `json:"node" xml:"node"` ElasticExpansionTask ElasticExpansionTask `json:"elasticExpansionTask" xml:"elasticExpansionTask"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_result_in_describe_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_result_in_describe_instance.go index d26d9d6d1c8..103869a2692 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_result_in_describe_instance.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_result_in_describe_instance.go @@ -44,6 +44,9 @@ type ResultInDescribeInstance struct { HaveKibana bool `json:"haveKibana" xml:"haveKibana"` ResourceGroupId string `json:"resourceGroupId" xml:"resourceGroupId"` EnableKibanaPrivateNetwork bool `json:"enableKibanaPrivateNetwork" xml:"enableKibanaPrivateNetwork"` + IsNewDeployment bool `json:"isNewDeployment" xml:"isNewDeployment"` + PostpaidServiceStatus string `json:"postpaidServiceStatus" xml:"postpaidServiceStatus"` + ServiceVpc bool `json:"serviceVpc" xml:"serviceVpc"` EsIPWhitelist []string `json:"esIPWhitelist" xml:"esIPWhitelist"` EsIPBlacklist []string `json:"esIPBlacklist" xml:"esIPBlacklist"` KibanaIPWhitelist []string `json:"kibanaIPWhitelist" xml:"kibanaIPWhitelist"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_result_in_list_dicts.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_result_in_list_dicts.go new file mode 100644 index 00000000000..c8050c469e4 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_result_in_list_dicts.go @@ -0,0 +1,21 @@ +package elasticsearch + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ResultInListDicts is a nested struct in elasticsearch response +type ResultInListDicts struct { + ResultItem []ResultItem `json:"Result" xml:"Result"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_result_in_list_shard_recoveries.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_result_in_list_shard_recoveries.go new file mode 100644 index 00000000000..a5ee6f150ed --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_result_in_list_shard_recoveries.go @@ -0,0 +1,21 @@ +package elasticsearch + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ResultInListShardRecoveries is a nested struct in elasticsearch response +type ResultInListShardRecoveries struct { + ResultItem []ResultItem `json:"Result" xml:"Result"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_result_in_list_vpc_endpoints.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_result_in_list_vpc_endpoints.go new file mode 100644 index 00000000000..23c1f5de918 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_result_in_list_vpc_endpoints.go @@ -0,0 +1,21 @@ +package elasticsearch + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ResultInListVpcEndpoints is a nested struct in elasticsearch response +type ResultInListVpcEndpoints struct { + ResultItem []ResultItem `json:"Result" xml:"Result"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_result_item.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_result_item.go index 4cef2f950cb..ce51f888a5d 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_result_item.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_result_item.go @@ -17,79 +17,101 @@ package elasticsearch // ResultItem is a nested struct in elasticsearch response type ResultItem struct { - IlmPolicyName string `json:"ilmPolicyName" xml:"ilmPolicyName"` - Timestamp int64 `json:"timestamp" xml:"timestamp"` - Health string `json:"health" xml:"health"` - TaskId string `json:"taskId" xml:"taskId"` - IsManaged string `json:"isManaged" xml:"isManaged"` - ResId string `json:"resId" xml:"resId"` - FileName string `json:"fileName" xml:"fileName"` - IlmPolicy string `json:"ilmPolicy" xml:"ilmPolicy"` - ContentCollection map[string]interface{} `json:"contentCollection" xml:"contentCollection"` - EcsInstanceName string `json:"ecsInstanceName" xml:"ecsInstanceName"` - Priority int `json:"priority" xml:"priority"` - Namespace string `json:"namespace" xml:"namespace"` - HeapPercent string `json:"heapPercent" xml:"heapPercent"` - GmtUpdateTime string `json:"gmtUpdateTime" xml:"gmtUpdateTime"` - SourceType string `json:"sourceType" xml:"sourceType"` - Source string `json:"source" xml:"source"` - Name string `json:"name" xml:"name"` - ResVersion string `json:"resVersion" xml:"resVersion"` - OsType string `json:"osType" xml:"osType"` - CreateTime string `json:"createTime" xml:"createTime"` - TagKey string `json:"TagKey" xml:"TagKey"` - TemplateName string `json:"templateName" xml:"templateName"` - Content string `json:"content" xml:"content"` - Endpoint string `json:"endpoint" xml:"endpoint"` - PipelineId string `json:"pipelineId" xml:"pipelineId"` - Code string `json:"code" xml:"code"` - Port int `json:"port" xml:"port"` - Tags string `json:"tags" xml:"tags"` - ResType string `json:"resType" xml:"resType"` - Host string `json:"host" xml:"host"` - VpcId string `json:"vpcId" xml:"vpcId"` - Message string `json:"message" xml:"message"` - FilePath string `json:"filePath" xml:"filePath"` - Instances string `json:"instances" xml:"instances"` - NetworkType string `json:"networkType" xml:"networkType"` - Phases map[string]interface{} `json:"phases" xml:"phases"` - Level string `json:"level" xml:"level"` - LoadOneM string `json:"loadOneM" xml:"loadOneM"` - TotalStorageSize int64 `json:"totalStorageSize" xml:"totalStorageSize"` - FileSize int64 `json:"fileSize" xml:"fileSize"` - State string `json:"state" xml:"state"` - Size int64 `json:"size" xml:"size"` - EcsInstanceId string `json:"ecsInstanceId" xml:"ecsInstanceId"` - ManagedStatus string `json:"managedStatus" xml:"managedStatus"` - KibanaEndpoint string `json:"kibanaEndpoint" xml:"kibanaEndpoint"` - CpuPercent string `json:"cpuPercent" xml:"cpuPercent"` - IndexTemplate string `json:"indexTemplate" xml:"indexTemplate"` - TagValue string `json:"TagValue" xml:"TagValue"` - DiskUsedPercent string `json:"diskUsedPercent" xml:"diskUsedPercent"` - DryRun bool `json:"dryRun" xml:"dryRun"` - OwnerId string `json:"ownerId" xml:"ownerId"` - IndexTemplateName string `json:"indexTemplateName" xml:"indexTemplateName"` - ManagedStorageSize int64 `json:"managedStorageSize" xml:"managedStorageSize"` - PipelineStatus string `json:"pipelineStatus" xml:"pipelineStatus"` - DataStream bool `json:"dataStream" xml:"dataStream"` - Status string `json:"status" xml:"status"` - NodeType string `json:"nodeType" xml:"nodeType"` - InstanceId string `json:"instanceId" xml:"instanceId"` - ZoneId string `json:"zoneId" xml:"zoneId"` - Description string `json:"description" xml:"description"` - Available bool `json:"available" xml:"available"` - CloudAssistantStatus string `json:"cloudAssistantStatus" xml:"cloudAssistantStatus"` - EsInstanceId string `json:"esInstanceId" xml:"esInstanceId"` - SpecificationUrl string `json:"specificationUrl" xml:"specificationUrl"` - GmtCreatedTime string `json:"gmtCreatedTime" xml:"gmtCreatedTime"` - IndexPatterns []string `json:"indexPatterns" xml:"indexPatterns"` - CollectorPaths []string `json:"collectorPaths" xml:"collectorPaths"` - SourceCluster SourceCluster `json:"sourceCluster" xml:"sourceCluster"` - SinkCluster SinkCluster `json:"sinkCluster" xml:"sinkCluster"` - Template Template `json:"template" xml:"template"` - Configs []ConfigsItem `json:"configs" xml:"configs"` - Indices []IndicesItem `json:"indices" xml:"indices"` - ExtendConfigs []ExtendConfigsItem `json:"extendConfigs" xml:"extendConfigs"` - IpAddress []IpAddressItem `json:"ipAddress" xml:"ipAddress"` - Collectors []CollectorsItem `json:"collectors" xml:"collectors"` + IlmPolicyName string `json:"ilmPolicyName" xml:"ilmPolicyName"` + Timestamp int64 `json:"timestamp" xml:"timestamp"` + TaskId string `json:"taskId" xml:"taskId"` + FileName string `json:"fileName" xml:"fileName"` + IlmPolicy string `json:"ilmPolicy" xml:"ilmPolicy"` + ContentCollection map[string]interface{} `json:"contentCollection" xml:"contentCollection"` + BytesTotal int64 `json:"bytesTotal" xml:"bytesTotal"` + EcsInstanceName string `json:"ecsInstanceName" xml:"ecsInstanceName"` + Priority int `json:"priority" xml:"priority"` + EndpointName string `json:"endpointName" xml:"endpointName"` + GmtUpdateTime string `json:"gmtUpdateTime" xml:"gmtUpdateTime"` + Source string `json:"source" xml:"source"` + ResVersion string `json:"resVersion" xml:"resVersion"` + CreateTime string `json:"createTime" xml:"createTime"` + TagKey string `json:"TagKey" xml:"TagKey"` + TemplateName string `json:"templateName" xml:"templateName"` + Content string `json:"content" xml:"content"` + PipelineId string `json:"pipelineId" xml:"pipelineId"` + Port int `json:"port" xml:"port"` + SourceHost string `json:"sourceHost" xml:"sourceHost"` + EndpointDomain string `json:"endpointDomain" xml:"endpointDomain"` + Host string `json:"host" xml:"host"` + VpcId string `json:"vpcId" xml:"vpcId"` + Message string `json:"message" xml:"message"` + FilePath string `json:"filePath" xml:"filePath"` + Instances string `json:"instances" xml:"instances"` + Phases map[string]interface{} `json:"phases" xml:"phases"` + Level string `json:"level" xml:"level"` + LoadOneM string `json:"loadOneM" xml:"loadOneM"` + State string `json:"state" xml:"state"` + Size int64 `json:"size" xml:"size"` + EcsInstanceId string `json:"ecsInstanceId" xml:"ecsInstanceId"` + ManagedStatus string `json:"managedStatus" xml:"managedStatus"` + KibanaEndpoint string `json:"kibanaEndpoint" xml:"kibanaEndpoint"` + FilesPercent string `json:"filesPercent" xml:"filesPercent"` + CpuPercent string `json:"cpuPercent" xml:"cpuPercent"` + DryRun bool `json:"dryRun" xml:"dryRun"` + Type string `json:"type" xml:"type"` + IndexTemplateName string `json:"indexTemplateName" xml:"indexTemplateName"` + PipelineStatus string `json:"pipelineStatus" xml:"pipelineStatus"` + DataStream bool `json:"dataStream" xml:"dataStream"` + ConnectionStatus string `json:"connectionStatus" xml:"connectionStatus"` + NodeType string `json:"nodeType" xml:"nodeType"` + InstanceId string `json:"instanceId" xml:"instanceId"` + Description string `json:"description" xml:"description"` + ServiceId string `json:"serviceId" xml:"serviceId"` + Available bool `json:"available" xml:"available"` + ServiceName string `json:"serviceName" xml:"serviceName"` + EsInstanceId string `json:"esInstanceId" xml:"esInstanceId"` + SpecificationUrl string `json:"specificationUrl" xml:"specificationUrl"` + GmtCreatedTime string `json:"gmtCreatedTime" xml:"gmtCreatedTime"` + Health string `json:"health" xml:"health"` + TargetNode string `json:"targetNode" xml:"targetNode"` + IsManaged string `json:"isManaged" xml:"isManaged"` + ResId string `json:"resId" xml:"resId"` + TranslogOpsPercent string `json:"translogOpsPercent" xml:"translogOpsPercent"` + Namespace string `json:"namespace" xml:"namespace"` + HeapPercent string `json:"heapPercent" xml:"heapPercent"` + SourceType string `json:"sourceType" xml:"sourceType"` + Stage string `json:"stage" xml:"stage"` + Name string `json:"name" xml:"name"` + OsType string `json:"osType" xml:"osType"` + EndpointId string `json:"endpointId" xml:"endpointId"` + Endpoint string `json:"endpoint" xml:"endpoint"` + Code string `json:"code" xml:"code"` + Tags string `json:"tags" xml:"tags"` + ResType string `json:"resType" xml:"resType"` + NetworkType string `json:"networkType" xml:"networkType"` + TotalStorageSize int64 `json:"totalStorageSize" xml:"totalStorageSize"` + FileSize int64 `json:"fileSize" xml:"fileSize"` + IndexTemplate string `json:"indexTemplate" xml:"indexTemplate"` + TagValue string `json:"TagValue" xml:"TagValue"` + SourceNode string `json:"sourceNode" xml:"sourceNode"` + BytesPercent string `json:"bytesPercent" xml:"bytesPercent"` + DiskUsedPercent string `json:"diskUsedPercent" xml:"diskUsedPercent"` + OwnerId string `json:"ownerId" xml:"ownerId"` + ManagedStorageSize int64 `json:"managedStorageSize" xml:"managedStorageSize"` + Status string `json:"status" xml:"status"` + FilesTotal int64 `json:"filesTotal" xml:"filesTotal"` + TargetHost string `json:"targetHost" xml:"targetHost"` + ZoneId string `json:"zoneId" xml:"zoneId"` + DownloadUrl string `json:"downloadUrl" xml:"downloadUrl"` + Index string `json:"index" xml:"index"` + CloudAssistantStatus string `json:"cloudAssistantStatus" xml:"cloudAssistantStatus"` + EndpointBusinessStatus string `json:"endpointBusinessStatus" xml:"endpointBusinessStatus"` + TranslogOps int64 `json:"translogOps" xml:"translogOps"` + EndpointStatus string `json:"endpointStatus" xml:"endpointStatus"` + IndexPatterns []string `json:"indexPatterns" xml:"indexPatterns"` + CollectorPaths []string `json:"collectorPaths" xml:"collectorPaths"` + SinkCluster SinkCluster `json:"sinkCluster" xml:"sinkCluster"` + SourceCluster SourceCluster `json:"sourceCluster" xml:"sourceCluster"` + Template Template `json:"template" xml:"template"` + Configs []ConfigsItem `json:"configs" xml:"configs"` + Indices []IndicesItem `json:"indices" xml:"indices"` + ExtendConfigs []ExtendConfigsItem `json:"extendConfigs" xml:"extendConfigs"` + Collectors []CollectorsItem `json:"collectors" xml:"collectors"` + IpAddress []IpAddressItem `json:"ipAddress" xml:"ipAddress"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_white_ip_group_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_white_ip_group_list.go new file mode 100644 index 00000000000..2346d8377f1 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_white_ip_group_list.go @@ -0,0 +1,21 @@ +package elasticsearch + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// WhiteIpGroupList is a nested struct in elasticsearch response +type WhiteIpGroupList struct { + WhiteIpGroupListItem []WhiteIpGroupListItem `json:"whiteIpGroupList" xml:"whiteIpGroupList"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_white_ip_group_list_item.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_white_ip_group_list_item.go new file mode 100644 index 00000000000..511964bbf9e --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/struct_white_ip_group_list_item.go @@ -0,0 +1,23 @@ +package elasticsearch + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// WhiteIpGroupListItem is a nested struct in elasticsearch response +type WhiteIpGroupListItem struct { + GroupName string `json:"groupName" xml:"groupName"` + WhiteIpType string `json:"whiteIpType" xml:"whiteIpType"` + Ips []string `json:"ips" xml:"ips"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/update_kibana_white_ips.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/update_kibana_white_ips.go index ec25802c834..4924b0c46a4 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/update_kibana_white_ips.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/update_kibana_white_ips.go @@ -71,6 +71,7 @@ func (client *Client) UpdateKibanaWhiteIpsWithCallback(request *UpdateKibanaWhit // UpdateKibanaWhiteIpsRequest is the request struct for api UpdateKibanaWhiteIps type UpdateKibanaWhiteIpsRequest struct { *requests.RoaRequest + ModifyMode string `position:"Query" name:"modifyMode"` InstanceId string `position:"Path" name:"InstanceId"` ClientToken string `position:"Query" name:"clientToken"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/update_private_network_white_ips.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/update_private_network_white_ips.go index d84dc1843c8..b0e4f815c33 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/update_private_network_white_ips.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/update_private_network_white_ips.go @@ -71,6 +71,7 @@ func (client *Client) UpdatePrivateNetworkWhiteIpsWithCallback(request *UpdatePr // UpdatePrivateNetworkWhiteIpsRequest is the request struct for api UpdatePrivateNetworkWhiteIps type UpdatePrivateNetworkWhiteIpsRequest struct { *requests.RoaRequest + ModifyMode string `position:"Query" name:"modifyMode"` InstanceId string `position:"Path" name:"InstanceId"` ClientToken string `position:"Query" name:"clientToken"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/update_public_white_ips.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/update_public_white_ips.go index e3753c4fa6b..dbe757e32bb 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/update_public_white_ips.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/update_public_white_ips.go @@ -71,6 +71,7 @@ func (client *Client) UpdatePublicWhiteIpsWithCallback(request *UpdatePublicWhit // UpdatePublicWhiteIpsRequest is the request struct for api UpdatePublicWhiteIps type UpdatePublicWhiteIpsRequest struct { *requests.RoaRequest + ModifyMode string `position:"Query" name:"modifyMode"` InstanceId string `position:"Path" name:"InstanceId"` ClientToken string `position:"Query" name:"clientToken"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/update_white_ips.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/update_white_ips.go index e8c08047f65..9a8daf48f28 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/update_white_ips.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch/update_white_ips.go @@ -71,6 +71,7 @@ func (client *Client) UpdateWhiteIpsWithCallback(request *UpdateWhiteIpsRequest, // UpdateWhiteIpsRequest is the request struct for api UpdateWhiteIps type UpdateWhiteIpsRequest struct { *requests.RoaRequest + ModifyMode string `position:"Query" name:"modifyMode"` InstanceId string `position:"Path" name:"InstanceId"` ClientToken string `position:"Query" name:"clientToken"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/attach_alb_server_groups.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/attach_alb_server_groups.go new file mode 100644 index 00000000000..90f6b08e56f --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/attach_alb_server_groups.go @@ -0,0 +1,112 @@ +package ess + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// AttachAlbServerGroups invokes the ess.AttachAlbServerGroups API synchronously +func (client *Client) AttachAlbServerGroups(request *AttachAlbServerGroupsRequest) (response *AttachAlbServerGroupsResponse, err error) { + response = CreateAttachAlbServerGroupsResponse() + err = client.DoAction(request, response) + return +} + +// AttachAlbServerGroupsWithChan invokes the ess.AttachAlbServerGroups API asynchronously +func (client *Client) AttachAlbServerGroupsWithChan(request *AttachAlbServerGroupsRequest) (<-chan *AttachAlbServerGroupsResponse, <-chan error) { + responseChan := make(chan *AttachAlbServerGroupsResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.AttachAlbServerGroups(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// AttachAlbServerGroupsWithCallback invokes the ess.AttachAlbServerGroups API asynchronously +func (client *Client) AttachAlbServerGroupsWithCallback(request *AttachAlbServerGroupsRequest, callback func(response *AttachAlbServerGroupsResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *AttachAlbServerGroupsResponse + var err error + defer close(result) + response, err = client.AttachAlbServerGroups(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// AttachAlbServerGroupsRequest is the request struct for api AttachAlbServerGroups +type AttachAlbServerGroupsRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + ScalingGroupId string `position:"Query" name:"ScalingGroupId"` + ForceAttach requests.Boolean `position:"Query" name:"ForceAttach"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + AlbServerGroup *[]AttachAlbServerGroupsAlbServerGroup `position:"Query" name:"AlbServerGroup" type:"Repeated"` +} + +// AttachAlbServerGroupsAlbServerGroup is a repeated param struct in AttachAlbServerGroupsRequest +type AttachAlbServerGroupsAlbServerGroup struct { + AlbServerGroupId string `name:"AlbServerGroupId"` + Port string `name:"Port"` + Weight string `name:"Weight"` +} + +// AttachAlbServerGroupsResponse is the response struct for api AttachAlbServerGroups +type AttachAlbServerGroupsResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + ScalingActivityId string `json:"ScalingActivityId" xml:"ScalingActivityId"` +} + +// CreateAttachAlbServerGroupsRequest creates a request to invoke AttachAlbServerGroups API +func CreateAttachAlbServerGroupsRequest() (request *AttachAlbServerGroupsRequest) { + request = &AttachAlbServerGroupsRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Ess", "2014-08-28", "AttachAlbServerGroups", "ess", "openAPI") + request.Method = requests.POST + return +} + +// CreateAttachAlbServerGroupsResponse creates a response to parse from AttachAlbServerGroups response +func CreateAttachAlbServerGroupsResponse() (response *AttachAlbServerGroupsResponse) { + response = &AttachAlbServerGroupsResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/attach_load_balancers.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/attach_load_balancers.go index 162d83df188..221f7420b76 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/attach_load_balancers.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/attach_load_balancers.go @@ -77,12 +77,14 @@ type AttachLoadBalancersRequest struct { LoadBalancer *[]string `position:"Query" name:"LoadBalancer" type:"Repeated"` ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` OwnerId requests.Integer `position:"Query" name:"OwnerId"` + Async requests.Boolean `position:"Query" name:"Async"` } // AttachLoadBalancersResponse is the response struct for api AttachLoadBalancers type AttachLoadBalancersResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` + RequestId string `json:"RequestId" xml:"RequestId"` + ScalingActivityId string `json:"ScalingActivityId" xml:"ScalingActivityId"` } // CreateAttachLoadBalancersRequest creates a request to invoke AttachLoadBalancers API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/create_scaling_configuration.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/create_scaling_configuration.go index b4bc41bfc39..6406d4634fa 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/create_scaling_configuration.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/create_scaling_configuration.go @@ -92,6 +92,7 @@ type CreateScalingConfigurationRequest struct { InternetChargeType string `position:"Query" name:"InternetChargeType"` ZoneId string `position:"Query" name:"ZoneId"` InternetMaxBandwidthIn requests.Integer `position:"Query" name:"InternetMaxBandwidthIn"` + InstancePatternInfo *[]CreateScalingConfigurationInstancePatternInfo `position:"Query" name:"InstancePatternInfo" type:"Repeated"` Affinity string `position:"Query" name:"Affinity"` ImageId string `position:"Query" name:"ImageId"` Memory requests.Integer `position:"Query" name:"Memory"` @@ -133,6 +134,14 @@ type CreateScalingConfigurationSpotPriceLimit struct { PriceLimit string `name:"PriceLimit"` } +// CreateScalingConfigurationInstancePatternInfo is a repeated param struct in CreateScalingConfigurationRequest +type CreateScalingConfigurationInstancePatternInfo struct { + Cores string `name:"Cores"` + Memory string `name:"Memory"` + InstanceFamilyLevel string `name:"InstanceFamilyLevel"` + MaxPrice string `name:"MaxPrice"` +} + // CreateScalingConfigurationDataDisk is a repeated param struct in CreateScalingConfigurationRequest type CreateScalingConfigurationDataDisk struct { DiskName string `name:"DiskName"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/create_scaling_group.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/create_scaling_group.go index 01afb138642..cf9ec8e0c84 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/create_scaling_group.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/create_scaling_group.go @@ -84,6 +84,7 @@ type CreateScalingGroupRequest struct { CompensateWithOnDemand requests.Boolean `position:"Query" name:"CompensateWithOnDemand"` MinSize requests.Integer `position:"Query" name:"MinSize"` OwnerId requests.Integer `position:"Query" name:"OwnerId"` + AlbServerGroup *[]CreateScalingGroupAlbServerGroup `position:"Query" name:"AlbServerGroup" type:"Repeated"` VSwitchId string `position:"Query" name:"VSwitchId"` InstanceId string `position:"Query" name:"InstanceId"` MaxSize requests.Integer `position:"Query" name:"MaxSize"` @@ -117,6 +118,13 @@ type CreateScalingGroupLaunchTemplateOverride struct { InstanceType string `name:"InstanceType"` } +// CreateScalingGroupAlbServerGroup is a repeated param struct in CreateScalingGroupRequest +type CreateScalingGroupAlbServerGroup struct { + AlbServerGroupId string `name:"AlbServerGroupId"` + Port string `name:"Port"` + Weight string `name:"Weight"` +} + // CreateScalingGroupLifecycleHook is a repeated param struct in CreateScalingGroupRequest type CreateScalingGroupLifecycleHook struct { DefaultResult string `name:"DefaultResult"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/describe_limitation.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/describe_limitation.go index 0ce322b1bd6..bd3d5ce9c90 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/describe_limitation.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/describe_limitation.go @@ -78,18 +78,20 @@ type DescribeLimitationRequest struct { // DescribeLimitationResponse is the response struct for api DescribeLimitation type DescribeLimitationResponse struct { *responses.BaseResponse - MaxNumberOfScalingGroups int `json:"MaxNumberOfScalingGroups" xml:"MaxNumberOfScalingGroups"` - MaxNumberOfScalingConfigurations int `json:"MaxNumberOfScalingConfigurations" xml:"MaxNumberOfScalingConfigurations"` - MaxNumberOfScalingRules int `json:"MaxNumberOfScalingRules" xml:"MaxNumberOfScalingRules"` - MaxNumberOfScheduledTasks int `json:"MaxNumberOfScheduledTasks" xml:"MaxNumberOfScheduledTasks"` - MaxNumberOfScalingInstances int `json:"MaxNumberOfScalingInstances" xml:"MaxNumberOfScalingInstances"` - MaxNumberOfDBInstances int `json:"MaxNumberOfDBInstances" xml:"MaxNumberOfDBInstances"` - MaxNumberOfLoadBalancers int `json:"MaxNumberOfLoadBalancers" xml:"MaxNumberOfLoadBalancers"` - MaxNumberOfMinSize int `json:"MaxNumberOfMinSize" xml:"MaxNumberOfMinSize"` - MaxNumberOfMaxSize int `json:"MaxNumberOfMaxSize" xml:"MaxNumberOfMaxSize"` - MaxNumberOfVServerGroups int `json:"MaxNumberOfVServerGroups" xml:"MaxNumberOfVServerGroups"` - MaxNumberOfLifecycleHooks int `json:"MaxNumberOfLifecycleHooks" xml:"MaxNumberOfLifecycleHooks"` - MaxNumberOfNotificationConfigurations int `json:"MaxNumberOfNotificationConfigurations" xml:"MaxNumberOfNotificationConfigurations"` + MaxNumberOfScalingGroups int `json:"MaxNumberOfScalingGroups" xml:"MaxNumberOfScalingGroups"` + MaxNumberOfScalingConfigurations int `json:"MaxNumberOfScalingConfigurations" xml:"MaxNumberOfScalingConfigurations"` + MaxNumberOfScalingRules int `json:"MaxNumberOfScalingRules" xml:"MaxNumberOfScalingRules"` + MaxNumberOfScheduledTasks int `json:"MaxNumberOfScheduledTasks" xml:"MaxNumberOfScheduledTasks"` + MaxNumberOfScalingInstances int `json:"MaxNumberOfScalingInstances" xml:"MaxNumberOfScalingInstances"` + MaxNumberOfDBInstances int `json:"MaxNumberOfDBInstances" xml:"MaxNumberOfDBInstances"` + MaxNumberOfLoadBalancers int `json:"MaxNumberOfLoadBalancers" xml:"MaxNumberOfLoadBalancers"` + MaxNumberOfMinSize int `json:"MaxNumberOfMinSize" xml:"MaxNumberOfMinSize"` + MaxNumberOfMaxSize int `json:"MaxNumberOfMaxSize" xml:"MaxNumberOfMaxSize"` + MaxNumberOfVServerGroups int `json:"MaxNumberOfVServerGroups" xml:"MaxNumberOfVServerGroups"` + MaxNumberOfLifecycleHooks int `json:"MaxNumberOfLifecycleHooks" xml:"MaxNumberOfLifecycleHooks"` + MaxNumberOfNotificationConfigurations int `json:"MaxNumberOfNotificationConfigurations" xml:"MaxNumberOfNotificationConfigurations"` + MaxNumberOfAlbServerGroup int `json:"MaxNumberOfAlbServerGroup" xml:"MaxNumberOfAlbServerGroup"` + RequestId string `json:"RequestId" xml:"RequestId"` } // CreateDescribeLimitationRequest creates a request to invoke DescribeLimitation API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/describe_scaling_instances.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/describe_scaling_instances.go index 69041abfa48..aff26c359c1 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/describe_scaling_instances.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/describe_scaling_instances.go @@ -80,6 +80,7 @@ type DescribeScalingInstancesRequest struct { ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` OwnerAccount string `position:"Query" name:"OwnerAccount"` OwnerId requests.Integer `position:"Query" name:"OwnerId"` + ScalingActivityId string `position:"Query" name:"ScalingActivityId"` ScalingConfigurationId string `position:"Query" name:"ScalingConfigurationId"` InstanceId *[]string `position:"Query" name:"InstanceId" type:"Repeated"` HealthStatus string `position:"Query" name:"HealthStatus"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/detach_alb_server_groups.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/detach_alb_server_groups.go new file mode 100644 index 00000000000..e3704a87120 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/detach_alb_server_groups.go @@ -0,0 +1,111 @@ +package ess + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DetachAlbServerGroups invokes the ess.DetachAlbServerGroups API synchronously +func (client *Client) DetachAlbServerGroups(request *DetachAlbServerGroupsRequest) (response *DetachAlbServerGroupsResponse, err error) { + response = CreateDetachAlbServerGroupsResponse() + err = client.DoAction(request, response) + return +} + +// DetachAlbServerGroupsWithChan invokes the ess.DetachAlbServerGroups API asynchronously +func (client *Client) DetachAlbServerGroupsWithChan(request *DetachAlbServerGroupsRequest) (<-chan *DetachAlbServerGroupsResponse, <-chan error) { + responseChan := make(chan *DetachAlbServerGroupsResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DetachAlbServerGroups(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DetachAlbServerGroupsWithCallback invokes the ess.DetachAlbServerGroups API asynchronously +func (client *Client) DetachAlbServerGroupsWithCallback(request *DetachAlbServerGroupsRequest, callback func(response *DetachAlbServerGroupsResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DetachAlbServerGroupsResponse + var err error + defer close(result) + response, err = client.DetachAlbServerGroups(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DetachAlbServerGroupsRequest is the request struct for api DetachAlbServerGroups +type DetachAlbServerGroupsRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + ScalingGroupId string `position:"Query" name:"ScalingGroupId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + AlbServerGroup *[]DetachAlbServerGroupsAlbServerGroup `position:"Query" name:"AlbServerGroup" type:"Repeated"` + ForceDetach requests.Boolean `position:"Query" name:"ForceDetach"` +} + +// DetachAlbServerGroupsAlbServerGroup is a repeated param struct in DetachAlbServerGroupsRequest +type DetachAlbServerGroupsAlbServerGroup struct { + AlbServerGroupId string `name:"AlbServerGroupId"` + Port string `name:"Port"` +} + +// DetachAlbServerGroupsResponse is the response struct for api DetachAlbServerGroups +type DetachAlbServerGroupsResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + ScalingActivityId string `json:"ScalingActivityId" xml:"ScalingActivityId"` +} + +// CreateDetachAlbServerGroupsRequest creates a request to invoke DetachAlbServerGroups API +func CreateDetachAlbServerGroupsRequest() (request *DetachAlbServerGroupsRequest) { + request = &DetachAlbServerGroupsRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Ess", "2014-08-28", "DetachAlbServerGroups", "ess", "openAPI") + request.Method = requests.POST + return +} + +// CreateDetachAlbServerGroupsResponse creates a response to parse from DetachAlbServerGroups response +func CreateDetachAlbServerGroupsResponse() (response *DetachAlbServerGroupsResponse) { + response = &DetachAlbServerGroupsResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/detach_load_balancers.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/detach_load_balancers.go index 081ad7b3626..48b670701a3 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/detach_load_balancers.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/detach_load_balancers.go @@ -76,13 +76,15 @@ type DetachLoadBalancersRequest struct { LoadBalancer *[]string `position:"Query" name:"LoadBalancer" type:"Repeated"` ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` OwnerId requests.Integer `position:"Query" name:"OwnerId"` + Async requests.Boolean `position:"Query" name:"Async"` ForceDetach requests.Boolean `position:"Query" name:"ForceDetach"` } // DetachLoadBalancersResponse is the response struct for api DetachLoadBalancers type DetachLoadBalancersResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` + RequestId string `json:"RequestId" xml:"RequestId"` + ScalingActivityId string `json:"ScalingActivityId" xml:"ScalingActivityId"` } // CreateDetachLoadBalancersRequest creates a request to invoke DetachLoadBalancers API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/modify_scaling_configuration.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/modify_scaling_configuration.go index dd057628465..87b5477f8f3 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/modify_scaling_configuration.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/modify_scaling_configuration.go @@ -90,6 +90,7 @@ type ModifyScalingConfigurationRequest struct { InstanceName string `position:"Query" name:"InstanceName"` InternetChargeType string `position:"Query" name:"InternetChargeType"` ZoneId string `position:"Query" name:"ZoneId"` + InstancePatternInfo *[]ModifyScalingConfigurationInstancePatternInfo `position:"Query" name:"InstancePatternInfo" type:"Repeated"` Affinity string `position:"Query" name:"Affinity"` ImageId string `position:"Query" name:"ImageId"` Memory requests.Integer `position:"Query" name:"Memory"` @@ -129,6 +130,14 @@ type ModifyScalingConfigurationSpotPriceLimit struct { PriceLimit string `name:"PriceLimit"` } +// ModifyScalingConfigurationInstancePatternInfo is a repeated param struct in ModifyScalingConfigurationRequest +type ModifyScalingConfigurationInstancePatternInfo struct { + Cores string `name:"Cores"` + Memory string `name:"Memory"` + InstanceFamilyLevel string `name:"InstanceFamilyLevel"` + MaxPrice string `name:"MaxPrice"` +} + // ModifyScalingConfigurationDataDisk is a repeated param struct in ModifyScalingConfigurationRequest type ModifyScalingConfigurationDataDisk struct { DiskName string `name:"DiskName"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/modify_scaling_group.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/modify_scaling_group.go index 221d85ddf6b..391dfef23f6 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/modify_scaling_group.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/modify_scaling_group.go @@ -82,6 +82,7 @@ type ModifyScalingGroupRequest struct { DefaultCooldown requests.Integer `position:"Query" name:"DefaultCooldown"` RemovalPolicy1 string `position:"Query" name:"RemovalPolicy.1"` RemovalPolicy2 string `position:"Query" name:"RemovalPolicy.2"` + MultiAZPolicy string `position:"Query" name:"MultiAZPolicy"` HealthCheckType string `position:"Query" name:"HealthCheckType"` LaunchTemplateId string `position:"Query" name:"LaunchTemplateId"` DesiredCapacity requests.Integer `position:"Query" name:"DesiredCapacity"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/struct_alb_server_group.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/struct_alb_server_group.go new file mode 100644 index 00000000000..d696962f42c --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/struct_alb_server_group.go @@ -0,0 +1,23 @@ +package ess + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// AlbServerGroup is a nested struct in ess response +type AlbServerGroup struct { + AlbServerGroupId string `json:"AlbServerGroupId" xml:"AlbServerGroupId"` + Port int `json:"Port" xml:"Port"` + Weight int `json:"Weight" xml:"Weight"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/struct_alb_server_groups.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/struct_alb_server_groups.go new file mode 100644 index 00000000000..a4f1d5279bf --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/struct_alb_server_groups.go @@ -0,0 +1,21 @@ +package ess + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// AlbServerGroups is a nested struct in ess response +type AlbServerGroups struct { + AlbServerGroup []AlbServerGroup `json:"AlbServerGroup" xml:"AlbServerGroup"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/struct_instance_pattern_info.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/struct_instance_pattern_info.go new file mode 100644 index 00000000000..72dd6c97f63 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/struct_instance_pattern_info.go @@ -0,0 +1,24 @@ +package ess + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// InstancePatternInfo is a nested struct in ess response +type InstancePatternInfo struct { + Cores int `json:"Cores" xml:"Cores"` + Memory float64 `json:"Memory" xml:"Memory"` + MaxPrice float64 `json:"MaxPrice" xml:"MaxPrice"` + InstanceFamilyLevel string `json:"InstanceFamilyLevel" xml:"InstanceFamilyLevel"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/struct_instance_pattern_infos.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/struct_instance_pattern_infos.go new file mode 100644 index 00000000000..270bea1fa54 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/struct_instance_pattern_infos.go @@ -0,0 +1,21 @@ +package ess + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// InstancePatternInfos is a nested struct in ess response +type InstancePatternInfos struct { + InstancePatternInfo []InstancePatternInfo `json:"InstancePatternInfo" xml:"InstancePatternInfo"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/struct_scaling_configuration.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/struct_scaling_configuration.go index 70a92c26119..8b37e069dda 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/struct_scaling_configuration.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/struct_scaling_configuration.go @@ -17,57 +17,58 @@ package ess // ScalingConfiguration is a nested struct in ess response type ScalingConfiguration struct { - ScalingConfigurationId string `json:"ScalingConfigurationId" xml:"ScalingConfigurationId"` - ScalingConfigurationName string `json:"ScalingConfigurationName" xml:"ScalingConfigurationName"` - ScalingGroupId string `json:"ScalingGroupId" xml:"ScalingGroupId"` - InstanceName string `json:"InstanceName" xml:"InstanceName"` - ImageId string `json:"ImageId" xml:"ImageId"` - ImageName string `json:"ImageName" xml:"ImageName"` - HostName string `json:"HostName" xml:"HostName"` - InstanceType string `json:"InstanceType" xml:"InstanceType"` - Cpu int `json:"Cpu" xml:"Cpu"` - Memory int `json:"Memory" xml:"Memory"` - InstanceGeneration string `json:"InstanceGeneration" xml:"InstanceGeneration"` - SecurityGroupId string `json:"SecurityGroupId" xml:"SecurityGroupId"` - IoOptimized string `json:"IoOptimized" xml:"IoOptimized"` - InternetChargeType string `json:"InternetChargeType" xml:"InternetChargeType"` - InternetMaxBandwidthIn int `json:"InternetMaxBandwidthIn" xml:"InternetMaxBandwidthIn"` - InternetMaxBandwidthOut int `json:"InternetMaxBandwidthOut" xml:"InternetMaxBandwidthOut"` - SystemDiskCategory string `json:"SystemDiskCategory" xml:"SystemDiskCategory"` - SystemDiskSize int `json:"SystemDiskSize" xml:"SystemDiskSize"` - SystemDiskName string `json:"SystemDiskName" xml:"SystemDiskName"` - SystemDiskDescription string `json:"SystemDiskDescription" xml:"SystemDiskDescription"` - SystemDiskAutoSnapshotPolicyId string `json:"SystemDiskAutoSnapshotPolicyId" xml:"SystemDiskAutoSnapshotPolicyId"` - SystemDiskPerformanceLevel string `json:"SystemDiskPerformanceLevel" xml:"SystemDiskPerformanceLevel"` - LifecycleState string `json:"LifecycleState" xml:"LifecycleState"` - CreationTime string `json:"CreationTime" xml:"CreationTime"` - LoadBalancerWeight int `json:"LoadBalancerWeight" xml:"LoadBalancerWeight"` - UserData string `json:"UserData" xml:"UserData"` - KeyPairName string `json:"KeyPairName" xml:"KeyPairName"` - RamRoleName string `json:"RamRoleName" xml:"RamRoleName"` - DeploymentSetId string `json:"DeploymentSetId" xml:"DeploymentSetId"` - SecurityEnhancementStrategy string `json:"SecurityEnhancementStrategy" xml:"SecurityEnhancementStrategy"` - SpotStrategy string `json:"SpotStrategy" xml:"SpotStrategy"` - PasswordInherit bool `json:"PasswordInherit" xml:"PasswordInherit"` - ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` - HpcClusterId string `json:"HpcClusterId" xml:"HpcClusterId"` - InstanceDescription string `json:"InstanceDescription" xml:"InstanceDescription"` - CreditSpecification string `json:"CreditSpecification" xml:"CreditSpecification"` - ImageFamily string `json:"ImageFamily" xml:"ImageFamily"` - ZoneId string `json:"ZoneId" xml:"ZoneId"` - DedicatedHostId string `json:"DedicatedHostId" xml:"DedicatedHostId"` - Affinity string `json:"Affinity" xml:"Affinity"` - Tenancy string `json:"Tenancy" xml:"Tenancy"` - PrivatePoolOptionsMatchCriteria string `json:"PrivatePoolOptions.MatchCriteria" xml:"PrivatePoolOptions.MatchCriteria"` - PrivatePoolOptionsId string `json:"PrivatePoolOptions.Id" xml:"PrivatePoolOptions.Id"` - SpotInterruptionBehavior string `json:"SpotInterruptionBehavior" xml:"SpotInterruptionBehavior"` - SpotDuration int `json:"SpotDuration" xml:"SpotDuration"` - Ipv6AddressCount int `json:"Ipv6AddressCount" xml:"Ipv6AddressCount"` - InstanceTypes InstanceTypes `json:"InstanceTypes" xml:"InstanceTypes"` - WeightedCapacities WeightedCapacities `json:"WeightedCapacities" xml:"WeightedCapacities"` - SecurityGroupIds SecurityGroupIds `json:"SecurityGroupIds" xml:"SecurityGroupIds"` - SchedulerOptions SchedulerOptions `json:"SchedulerOptions" xml:"SchedulerOptions"` - DataDisks DataDisks `json:"DataDisks" xml:"DataDisks"` - Tags Tags `json:"Tags" xml:"Tags"` - SpotPriceLimit SpotPriceLimit `json:"SpotPriceLimit" xml:"SpotPriceLimit"` + ScalingConfigurationId string `json:"ScalingConfigurationId" xml:"ScalingConfigurationId"` + ScalingConfigurationName string `json:"ScalingConfigurationName" xml:"ScalingConfigurationName"` + ScalingGroupId string `json:"ScalingGroupId" xml:"ScalingGroupId"` + InstanceName string `json:"InstanceName" xml:"InstanceName"` + ImageId string `json:"ImageId" xml:"ImageId"` + ImageName string `json:"ImageName" xml:"ImageName"` + HostName string `json:"HostName" xml:"HostName"` + InstanceType string `json:"InstanceType" xml:"InstanceType"` + Cpu int `json:"Cpu" xml:"Cpu"` + Memory int `json:"Memory" xml:"Memory"` + InstanceGeneration string `json:"InstanceGeneration" xml:"InstanceGeneration"` + SecurityGroupId string `json:"SecurityGroupId" xml:"SecurityGroupId"` + IoOptimized string `json:"IoOptimized" xml:"IoOptimized"` + InternetChargeType string `json:"InternetChargeType" xml:"InternetChargeType"` + InternetMaxBandwidthIn int `json:"InternetMaxBandwidthIn" xml:"InternetMaxBandwidthIn"` + InternetMaxBandwidthOut int `json:"InternetMaxBandwidthOut" xml:"InternetMaxBandwidthOut"` + SystemDiskCategory string `json:"SystemDiskCategory" xml:"SystemDiskCategory"` + SystemDiskSize int `json:"SystemDiskSize" xml:"SystemDiskSize"` + SystemDiskName string `json:"SystemDiskName" xml:"SystemDiskName"` + SystemDiskDescription string `json:"SystemDiskDescription" xml:"SystemDiskDescription"` + SystemDiskAutoSnapshotPolicyId string `json:"SystemDiskAutoSnapshotPolicyId" xml:"SystemDiskAutoSnapshotPolicyId"` + SystemDiskPerformanceLevel string `json:"SystemDiskPerformanceLevel" xml:"SystemDiskPerformanceLevel"` + LifecycleState string `json:"LifecycleState" xml:"LifecycleState"` + CreationTime string `json:"CreationTime" xml:"CreationTime"` + LoadBalancerWeight int `json:"LoadBalancerWeight" xml:"LoadBalancerWeight"` + UserData string `json:"UserData" xml:"UserData"` + KeyPairName string `json:"KeyPairName" xml:"KeyPairName"` + RamRoleName string `json:"RamRoleName" xml:"RamRoleName"` + DeploymentSetId string `json:"DeploymentSetId" xml:"DeploymentSetId"` + SecurityEnhancementStrategy string `json:"SecurityEnhancementStrategy" xml:"SecurityEnhancementStrategy"` + SpotStrategy string `json:"SpotStrategy" xml:"SpotStrategy"` + PasswordInherit bool `json:"PasswordInherit" xml:"PasswordInherit"` + ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` + HpcClusterId string `json:"HpcClusterId" xml:"HpcClusterId"` + InstanceDescription string `json:"InstanceDescription" xml:"InstanceDescription"` + CreditSpecification string `json:"CreditSpecification" xml:"CreditSpecification"` + ImageFamily string `json:"ImageFamily" xml:"ImageFamily"` + ZoneId string `json:"ZoneId" xml:"ZoneId"` + DedicatedHostId string `json:"DedicatedHostId" xml:"DedicatedHostId"` + Affinity string `json:"Affinity" xml:"Affinity"` + Tenancy string `json:"Tenancy" xml:"Tenancy"` + PrivatePoolOptionsMatchCriteria string `json:"PrivatePoolOptions.MatchCriteria" xml:"PrivatePoolOptions.MatchCriteria"` + PrivatePoolOptionsId string `json:"PrivatePoolOptions.Id" xml:"PrivatePoolOptions.Id"` + SpotInterruptionBehavior string `json:"SpotInterruptionBehavior" xml:"SpotInterruptionBehavior"` + SpotDuration int `json:"SpotDuration" xml:"SpotDuration"` + Ipv6AddressCount int `json:"Ipv6AddressCount" xml:"Ipv6AddressCount"` + InstanceTypes InstanceTypes `json:"InstanceTypes" xml:"InstanceTypes"` + WeightedCapacities WeightedCapacities `json:"WeightedCapacities" xml:"WeightedCapacities"` + SecurityGroupIds SecurityGroupIds `json:"SecurityGroupIds" xml:"SecurityGroupIds"` + SchedulerOptions SchedulerOptions `json:"SchedulerOptions" xml:"SchedulerOptions"` + DataDisks DataDisks `json:"DataDisks" xml:"DataDisks"` + Tags Tags `json:"Tags" xml:"Tags"` + SpotPriceLimit SpotPriceLimit `json:"SpotPriceLimit" xml:"SpotPriceLimit"` + InstancePatternInfos InstancePatternInfos `json:"InstancePatternInfos" xml:"InstancePatternInfos"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/struct_scaling_group.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/struct_scaling_group.go index 23451579cd1..9fb30ad8de3 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/struct_scaling_group.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/struct_scaling_group.go @@ -61,4 +61,5 @@ type ScalingGroup struct { SuspendedProcesses SuspendedProcesses `json:"SuspendedProcesses" xml:"SuspendedProcesses"` VServerGroups VServerGroups `json:"VServerGroups" xml:"VServerGroups"` LaunchTemplateOverrides LaunchTemplateOverrides `json:"LaunchTemplateOverrides" xml:"LaunchTemplateOverrides"` + AlbServerGroups AlbServerGroups `json:"AlbServerGroups" xml:"AlbServerGroups"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/struct_scaling_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/struct_scaling_instance.go index 010e5048042..6e8f79089a1 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/struct_scaling_instance.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ess/struct_scaling_instance.go @@ -32,4 +32,6 @@ type ScalingInstance struct { WeightedCapacity int `json:"WeightedCapacity" xml:"WeightedCapacity"` CreatedTime string `json:"CreatedTime" xml:"CreatedTime"` SpotStrategy string `json:"SpotStrategy" xml:"SpotStrategy"` + ZoneId string `json:"ZoneId" xml:"ZoneId"` + ScalingActivityId string `json:"ScalingActivityId" xml:"ScalingActivityId"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/hbase/describe_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/hbase/describe_instance.go index d5905b63925..afe2126f24b 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/hbase/describe_instance.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/hbase/describe_instance.go @@ -121,7 +121,7 @@ type DescribeInstanceResponse struct { Duration int `json:"Duration" xml:"Duration"` ColdStorageSize int `json:"ColdStorageSize" xml:"ColdStorageSize"` ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` - EncryptionType bool `json:"EncryptionType" xml:"EncryptionType"` + EncryptionType string `json:"EncryptionType" xml:"EncryptionType"` EncryptionKey string `json:"EncryptionKey" xml:"EncryptionKey"` Tags TagsInDescribeInstance `json:"Tags" xml:"Tags"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/hbase/describe_multi_zone_cluster.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/hbase/describe_multi_zone_cluster.go index a2372c3c3f6..0bc35ebb0cc 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/hbase/describe_multi_zone_cluster.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/hbase/describe_multi_zone_cluster.go @@ -123,7 +123,7 @@ type DescribeMultiZoneClusterResponse struct { ArbiterVSwitchIds string `json:"ArbiterVSwitchIds" xml:"ArbiterVSwitchIds"` VpcId string `json:"VpcId" xml:"VpcId"` ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` - EncryptionType bool `json:"EncryptionType" xml:"EncryptionType"` + EncryptionType string `json:"EncryptionType" xml:"EncryptionType"` EncryptionKey string `json:"EncryptionKey" xml:"EncryptionKey"` MultiZoneInstanceModels MultiZoneInstanceModels `json:"MultiZoneInstanceModels" xml:"MultiZoneInstanceModels"` Tags TagsInDescribeMultiZoneCluster `json:"Tags" xml:"Tags"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/hbase/describe_user_encryption_key_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/hbase/describe_user_encryption_key_list.go deleted file mode 100644 index ecb0ee0a7a3..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/hbase/describe_user_encryption_key_list.go +++ /dev/null @@ -1,101 +0,0 @@ -package hbase - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeUserEncryptionKeyList invokes the hbase.DescribeUserEncryptionKeyList API synchronously -func (client *Client) DescribeUserEncryptionKeyList(request *DescribeUserEncryptionKeyListRequest) (response *DescribeUserEncryptionKeyListResponse, err error) { - response = CreateDescribeUserEncryptionKeyListResponse() - err = client.DoAction(request, response) - return -} - -// DescribeUserEncryptionKeyListWithChan invokes the hbase.DescribeUserEncryptionKeyList API asynchronously -func (client *Client) DescribeUserEncryptionKeyListWithChan(request *DescribeUserEncryptionKeyListRequest) (<-chan *DescribeUserEncryptionKeyListResponse, <-chan error) { - responseChan := make(chan *DescribeUserEncryptionKeyListResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeUserEncryptionKeyList(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeUserEncryptionKeyListWithCallback invokes the hbase.DescribeUserEncryptionKeyList API asynchronously -func (client *Client) DescribeUserEncryptionKeyListWithCallback(request *DescribeUserEncryptionKeyListRequest, callback func(response *DescribeUserEncryptionKeyListResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeUserEncryptionKeyListResponse - var err error - defer close(result) - response, err = client.DescribeUserEncryptionKeyList(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeUserEncryptionKeyListRequest is the request struct for api DescribeUserEncryptionKeyList -type DescribeUserEncryptionKeyListRequest struct { - *requests.RpcRequest - PageNumber string `position:"Query" name:"PageNumber"` - PageSize string `position:"Query" name:"PageSize"` -} - -// DescribeUserEncryptionKeyListResponse is the response struct for api DescribeUserEncryptionKeyList -type DescribeUserEncryptionKeyListResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - KmsKeys []KmsKeysItem `json:"KmsKeys" xml:"KmsKeys"` -} - -// CreateDescribeUserEncryptionKeyListRequest creates a request to invoke DescribeUserEncryptionKeyList API -func CreateDescribeUserEncryptionKeyListRequest() (request *DescribeUserEncryptionKeyListRequest) { - request = &DescribeUserEncryptionKeyListRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("HBase", "2019-01-01", "DescribeUserEncryptionKeyList", "hbase", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeUserEncryptionKeyListResponse creates a response to parse from DescribeUserEncryptionKeyList response -func CreateDescribeUserEncryptionKeyListResponse() (response *DescribeUserEncryptionKeyListResponse) { - response = &DescribeUserEncryptionKeyListResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/hbase/struct_kms_keys.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/hbase/struct_kms_keys.go deleted file mode 100644 index 7c2a8b7381e..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/hbase/struct_kms_keys.go +++ /dev/null @@ -1,21 +0,0 @@ -package hbase - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// KmsKeys is a nested struct in hbase response -type KmsKeys struct { - KmsKeysItem []KmsKeysItem `json:"KmsKeys" xml:"KmsKeys"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/hbase/struct_kms_keys_item.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/hbase/struct_kms_keys_item.go deleted file mode 100644 index 42b29f8ce3b..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/hbase/struct_kms_keys_item.go +++ /dev/null @@ -1,21 +0,0 @@ -package hbase - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// KmsKeysItem is a nested struct in hbase response -type KmsKeysItem struct { - KeyId string `json:"KeyId" xml:"KeyId"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/create_global_database_network.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/create_global_database_network.go new file mode 100644 index 00000000000..031491d9ce0 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/create_global_database_network.go @@ -0,0 +1,106 @@ +package polardb + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// CreateGlobalDatabaseNetwork invokes the polardb.CreateGlobalDatabaseNetwork API synchronously +func (client *Client) CreateGlobalDatabaseNetwork(request *CreateGlobalDatabaseNetworkRequest) (response *CreateGlobalDatabaseNetworkResponse, err error) { + response = CreateCreateGlobalDatabaseNetworkResponse() + err = client.DoAction(request, response) + return +} + +// CreateGlobalDatabaseNetworkWithChan invokes the polardb.CreateGlobalDatabaseNetwork API asynchronously +func (client *Client) CreateGlobalDatabaseNetworkWithChan(request *CreateGlobalDatabaseNetworkRequest) (<-chan *CreateGlobalDatabaseNetworkResponse, <-chan error) { + responseChan := make(chan *CreateGlobalDatabaseNetworkResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.CreateGlobalDatabaseNetwork(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// CreateGlobalDatabaseNetworkWithCallback invokes the polardb.CreateGlobalDatabaseNetwork API asynchronously +func (client *Client) CreateGlobalDatabaseNetworkWithCallback(request *CreateGlobalDatabaseNetworkRequest, callback func(response *CreateGlobalDatabaseNetworkResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *CreateGlobalDatabaseNetworkResponse + var err error + defer close(result) + response, err = client.CreateGlobalDatabaseNetwork(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// CreateGlobalDatabaseNetworkRequest is the request struct for api CreateGlobalDatabaseNetwork +type CreateGlobalDatabaseNetworkRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + SecurityToken string `position:"Query" name:"SecurityToken"` + GDNDescription string `position:"Query" name:"GDNDescription"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + DBClusterId string `position:"Query" name:"DBClusterId"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` +} + +// CreateGlobalDatabaseNetworkResponse is the response struct for api CreateGlobalDatabaseNetwork +type CreateGlobalDatabaseNetworkResponse struct { + *responses.BaseResponse + GDNId string `json:"GDNId" xml:"GDNId"` + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateCreateGlobalDatabaseNetworkRequest creates a request to invoke CreateGlobalDatabaseNetwork API +func CreateCreateGlobalDatabaseNetworkRequest() (request *CreateGlobalDatabaseNetworkRequest) { + request = &CreateGlobalDatabaseNetworkRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("polardb", "2017-08-01", "CreateGlobalDatabaseNetwork", "polardb", "openAPI") + request.Method = requests.POST + return +} + +// CreateCreateGlobalDatabaseNetworkResponse creates a response to parse from CreateGlobalDatabaseNetwork response +func CreateCreateGlobalDatabaseNetworkResponse() (response *CreateGlobalDatabaseNetworkResponse) { + response = &CreateGlobalDatabaseNetworkResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/create_parameter_group.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/create_parameter_group.go index 21d39481de9..9fa772cecab 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/create_parameter_group.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/create_parameter_group.go @@ -85,7 +85,8 @@ type CreateParameterGroupRequest struct { // CreateParameterGroupResponse is the response struct for api CreateParameterGroup type CreateParameterGroupResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` + RequestId string `json:"RequestId" xml:"RequestId"` + ParameterGroupId string `json:"ParameterGroupId" xml:"ParameterGroupId"` } // CreateCreateParameterGroupRequest creates a request to invoke CreateParameterGroup API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/delete_global_database_network.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/delete_global_database_network.go new file mode 100644 index 00000000000..2f8904a98aa --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/delete_global_database_network.go @@ -0,0 +1,104 @@ +package polardb + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DeleteGlobalDatabaseNetwork invokes the polardb.DeleteGlobalDatabaseNetwork API synchronously +func (client *Client) DeleteGlobalDatabaseNetwork(request *DeleteGlobalDatabaseNetworkRequest) (response *DeleteGlobalDatabaseNetworkResponse, err error) { + response = CreateDeleteGlobalDatabaseNetworkResponse() + err = client.DoAction(request, response) + return +} + +// DeleteGlobalDatabaseNetworkWithChan invokes the polardb.DeleteGlobalDatabaseNetwork API asynchronously +func (client *Client) DeleteGlobalDatabaseNetworkWithChan(request *DeleteGlobalDatabaseNetworkRequest) (<-chan *DeleteGlobalDatabaseNetworkResponse, <-chan error) { + responseChan := make(chan *DeleteGlobalDatabaseNetworkResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DeleteGlobalDatabaseNetwork(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DeleteGlobalDatabaseNetworkWithCallback invokes the polardb.DeleteGlobalDatabaseNetwork API asynchronously +func (client *Client) DeleteGlobalDatabaseNetworkWithCallback(request *DeleteGlobalDatabaseNetworkRequest, callback func(response *DeleteGlobalDatabaseNetworkResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DeleteGlobalDatabaseNetworkResponse + var err error + defer close(result) + response, err = client.DeleteGlobalDatabaseNetwork(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DeleteGlobalDatabaseNetworkRequest is the request struct for api DeleteGlobalDatabaseNetwork +type DeleteGlobalDatabaseNetworkRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + SecurityToken string `position:"Query" name:"SecurityToken"` + GDNId string `position:"Query" name:"GDNId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` +} + +// DeleteGlobalDatabaseNetworkResponse is the response struct for api DeleteGlobalDatabaseNetwork +type DeleteGlobalDatabaseNetworkResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateDeleteGlobalDatabaseNetworkRequest creates a request to invoke DeleteGlobalDatabaseNetwork API +func CreateDeleteGlobalDatabaseNetworkRequest() (request *DeleteGlobalDatabaseNetworkRequest) { + request = &DeleteGlobalDatabaseNetworkRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("polardb", "2017-08-01", "DeleteGlobalDatabaseNetwork", "polardb", "openAPI") + request.Method = requests.POST + return +} + +// CreateDeleteGlobalDatabaseNetworkResponse creates a response to parse from DeleteGlobalDatabaseNetwork response +func CreateDeleteGlobalDatabaseNetworkResponse() (response *DeleteGlobalDatabaseNetworkResponse) { + response = &DeleteGlobalDatabaseNetworkResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/delete_masking_rules.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/delete_masking_rules.go new file mode 100644 index 00000000000..b644005ef4a --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/delete_masking_rules.go @@ -0,0 +1,102 @@ +package polardb + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DeleteMaskingRules invokes the polardb.DeleteMaskingRules API synchronously +func (client *Client) DeleteMaskingRules(request *DeleteMaskingRulesRequest) (response *DeleteMaskingRulesResponse, err error) { + response = CreateDeleteMaskingRulesResponse() + err = client.DoAction(request, response) + return +} + +// DeleteMaskingRulesWithChan invokes the polardb.DeleteMaskingRules API asynchronously +func (client *Client) DeleteMaskingRulesWithChan(request *DeleteMaskingRulesRequest) (<-chan *DeleteMaskingRulesResponse, <-chan error) { + responseChan := make(chan *DeleteMaskingRulesResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DeleteMaskingRules(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DeleteMaskingRulesWithCallback invokes the polardb.DeleteMaskingRules API asynchronously +func (client *Client) DeleteMaskingRulesWithCallback(request *DeleteMaskingRulesRequest, callback func(response *DeleteMaskingRulesResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DeleteMaskingRulesResponse + var err error + defer close(result) + response, err = client.DeleteMaskingRules(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DeleteMaskingRulesRequest is the request struct for api DeleteMaskingRules +type DeleteMaskingRulesRequest struct { + *requests.RpcRequest + DBClusterId string `position:"Query" name:"DBClusterId"` + RuleNameList string `position:"Query" name:"RuleNameList"` +} + +// DeleteMaskingRulesResponse is the response struct for api DeleteMaskingRules +type DeleteMaskingRulesResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Message string `json:"Message" xml:"Message"` + Success bool `json:"Success" xml:"Success"` +} + +// CreateDeleteMaskingRulesRequest creates a request to invoke DeleteMaskingRules API +func CreateDeleteMaskingRulesRequest() (request *DeleteMaskingRulesRequest) { + request = &DeleteMaskingRulesRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("polardb", "2017-08-01", "DeleteMaskingRules", "polardb", "openAPI") + request.Method = requests.POST + return +} + +// CreateDeleteMaskingRulesResponse creates a response to parse from DeleteMaskingRules response +func CreateDeleteMaskingRulesResponse() (response *DeleteMaskingRulesResponse) { + response = &DeleteMaskingRulesResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/describe_db_node_performance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/describe_db_node_performance.go index 4e39ceddbb7..4cb99bc987a 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/describe_db_node_performance.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/describe_db_node_performance.go @@ -86,13 +86,13 @@ type DescribeDBNodePerformanceRequest struct { // DescribeDBNodePerformanceResponse is the response struct for api DescribeDBNodePerformance type DescribeDBNodePerformanceResponse struct { *responses.BaseResponse + DBVersion string `json:"DBVersion" xml:"DBVersion"` + EndTime string `json:"EndTime" xml:"EndTime"` RequestId string `json:"RequestId" xml:"RequestId"` + StartTime string `json:"StartTime" xml:"StartTime"` + DBType string `json:"DBType" xml:"DBType"` DBNodeId string `json:"DBNodeId" xml:"DBNodeId"` Engine string `json:"Engine" xml:"Engine"` - DBType string `json:"DBType" xml:"DBType"` - DBVersion string `json:"DBVersion" xml:"DBVersion"` - StartTime string `json:"StartTime" xml:"StartTime"` - EndTime string `json:"EndTime" xml:"EndTime"` PerformanceKeys PerformanceKeysInDescribeDBNodePerformance `json:"PerformanceKeys" xml:"PerformanceKeys"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/describe_global_database_network.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/describe_global_database_network.go new file mode 100644 index 00000000000..31a7016582d --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/describe_global_database_network.go @@ -0,0 +1,112 @@ +package polardb + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeGlobalDatabaseNetwork invokes the polardb.DescribeGlobalDatabaseNetwork API synchronously +func (client *Client) DescribeGlobalDatabaseNetwork(request *DescribeGlobalDatabaseNetworkRequest) (response *DescribeGlobalDatabaseNetworkResponse, err error) { + response = CreateDescribeGlobalDatabaseNetworkResponse() + err = client.DoAction(request, response) + return +} + +// DescribeGlobalDatabaseNetworkWithChan invokes the polardb.DescribeGlobalDatabaseNetwork API asynchronously +func (client *Client) DescribeGlobalDatabaseNetworkWithChan(request *DescribeGlobalDatabaseNetworkRequest) (<-chan *DescribeGlobalDatabaseNetworkResponse, <-chan error) { + responseChan := make(chan *DescribeGlobalDatabaseNetworkResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeGlobalDatabaseNetwork(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeGlobalDatabaseNetworkWithCallback invokes the polardb.DescribeGlobalDatabaseNetwork API asynchronously +func (client *Client) DescribeGlobalDatabaseNetworkWithCallback(request *DescribeGlobalDatabaseNetworkRequest, callback func(response *DescribeGlobalDatabaseNetworkResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeGlobalDatabaseNetworkResponse + var err error + defer close(result) + response, err = client.DescribeGlobalDatabaseNetwork(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeGlobalDatabaseNetworkRequest is the request struct for api DescribeGlobalDatabaseNetwork +type DescribeGlobalDatabaseNetworkRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + SecurityToken string `position:"Query" name:"SecurityToken"` + GDNId string `position:"Query" name:"GDNId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` +} + +// DescribeGlobalDatabaseNetworkResponse is the response struct for api DescribeGlobalDatabaseNetwork +type DescribeGlobalDatabaseNetworkResponse struct { + *responses.BaseResponse + GDNStatus string `json:"GDNStatus" xml:"GDNStatus"` + DBVersion string `json:"DBVersion" xml:"DBVersion"` + RequestId string `json:"RequestId" xml:"RequestId"` + GDNId string `json:"GDNId" xml:"GDNId"` + CreateTime string `json:"CreateTime" xml:"CreateTime"` + DBType string `json:"DBType" xml:"DBType"` + GDNDescription string `json:"GDNDescription" xml:"GDNDescription"` + Connections []Connection `json:"Connections" xml:"Connections"` + DBClusters []DBClusterInDescribeGlobalDatabaseNetwork `json:"DBClusters" xml:"DBClusters"` +} + +// CreateDescribeGlobalDatabaseNetworkRequest creates a request to invoke DescribeGlobalDatabaseNetwork API +func CreateDescribeGlobalDatabaseNetworkRequest() (request *DescribeGlobalDatabaseNetworkRequest) { + request = &DescribeGlobalDatabaseNetworkRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("polardb", "2017-08-01", "DescribeGlobalDatabaseNetwork", "polardb", "openAPI") + request.Method = requests.POST + return +} + +// CreateDescribeGlobalDatabaseNetworkResponse creates a response to parse from DescribeGlobalDatabaseNetwork response +func CreateDescribeGlobalDatabaseNetworkResponse() (response *DescribeGlobalDatabaseNetworkResponse) { + response = &DescribeGlobalDatabaseNetworkResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/describe_global_database_networks.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/describe_global_database_networks.go index 1f6b1406dba..9f698d6814a 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/describe_global_database_networks.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/describe_global_database_networks.go @@ -72,7 +72,9 @@ func (client *Client) DescribeGlobalDatabaseNetworksWithCallback(request *Descri type DescribeGlobalDatabaseNetworksRequest struct { *requests.RpcRequest ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` SecurityToken string `position:"Query" name:"SecurityToken"` + PageSize requests.Integer `position:"Query" name:"PageSize"` ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` DBClusterId string `position:"Query" name:"DBClusterId"` OwnerAccount string `position:"Query" name:"OwnerAccount"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/describe_masking_rules.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/describe_masking_rules.go new file mode 100644 index 00000000000..27fd53441e0 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/describe_masking_rules.go @@ -0,0 +1,103 @@ +package polardb + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeMaskingRules invokes the polardb.DescribeMaskingRules API synchronously +func (client *Client) DescribeMaskingRules(request *DescribeMaskingRulesRequest) (response *DescribeMaskingRulesResponse, err error) { + response = CreateDescribeMaskingRulesResponse() + err = client.DoAction(request, response) + return +} + +// DescribeMaskingRulesWithChan invokes the polardb.DescribeMaskingRules API asynchronously +func (client *Client) DescribeMaskingRulesWithChan(request *DescribeMaskingRulesRequest) (<-chan *DescribeMaskingRulesResponse, <-chan error) { + responseChan := make(chan *DescribeMaskingRulesResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeMaskingRules(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeMaskingRulesWithCallback invokes the polardb.DescribeMaskingRules API asynchronously +func (client *Client) DescribeMaskingRulesWithCallback(request *DescribeMaskingRulesRequest, callback func(response *DescribeMaskingRulesResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeMaskingRulesResponse + var err error + defer close(result) + response, err = client.DescribeMaskingRules(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeMaskingRulesRequest is the request struct for api DescribeMaskingRules +type DescribeMaskingRulesRequest struct { + *requests.RpcRequest + DBClusterId string `position:"Query" name:"DBClusterId"` + RuleNameList string `position:"Query" name:"RuleNameList"` +} + +// DescribeMaskingRulesResponse is the response struct for api DescribeMaskingRules +type DescribeMaskingRulesResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Message string `json:"Message" xml:"Message"` + Success bool `json:"Success" xml:"Success"` + Data Data `json:"Data" xml:"Data"` +} + +// CreateDescribeMaskingRulesRequest creates a request to invoke DescribeMaskingRules API +func CreateDescribeMaskingRulesRequest() (request *DescribeMaskingRulesRequest) { + request = &DescribeMaskingRulesRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("polardb", "2017-08-01", "DescribeMaskingRules", "polardb", "openAPI") + request.Method = requests.POST + return +} + +// CreateDescribeMaskingRulesResponse creates a response to parse from DescribeMaskingRules response +func CreateDescribeMaskingRulesResponse() (response *DescribeMaskingRulesResponse) { + response = &DescribeMaskingRulesResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/describe_pending_maintenance_action.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/describe_pending_maintenance_action.go index 9f6e2b6147f..a53a5b453ec 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/describe_pending_maintenance_action.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/describe_pending_maintenance_action.go @@ -86,8 +86,8 @@ type DescribePendingMaintenanceActionRequest struct { // DescribePendingMaintenanceActionResponse is the response struct for api DescribePendingMaintenanceAction type DescribePendingMaintenanceActionResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` TotalRecordCount int `json:"TotalRecordCount" xml:"TotalRecordCount"` + RequestId string `json:"RequestId" xml:"RequestId"` PageSize int `json:"PageSize" xml:"PageSize"` PageNumber int `json:"PageNumber" xml:"PageNumber"` Items []ItemsItem `json:"Items" xml:"Items"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/modify_global_database_network.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/modify_global_database_network.go new file mode 100644 index 00000000000..acb9ab17983 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/modify_global_database_network.go @@ -0,0 +1,105 @@ +package polardb + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ModifyGlobalDatabaseNetwork invokes the polardb.ModifyGlobalDatabaseNetwork API synchronously +func (client *Client) ModifyGlobalDatabaseNetwork(request *ModifyGlobalDatabaseNetworkRequest) (response *ModifyGlobalDatabaseNetworkResponse, err error) { + response = CreateModifyGlobalDatabaseNetworkResponse() + err = client.DoAction(request, response) + return +} + +// ModifyGlobalDatabaseNetworkWithChan invokes the polardb.ModifyGlobalDatabaseNetwork API asynchronously +func (client *Client) ModifyGlobalDatabaseNetworkWithChan(request *ModifyGlobalDatabaseNetworkRequest) (<-chan *ModifyGlobalDatabaseNetworkResponse, <-chan error) { + responseChan := make(chan *ModifyGlobalDatabaseNetworkResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ModifyGlobalDatabaseNetwork(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ModifyGlobalDatabaseNetworkWithCallback invokes the polardb.ModifyGlobalDatabaseNetwork API asynchronously +func (client *Client) ModifyGlobalDatabaseNetworkWithCallback(request *ModifyGlobalDatabaseNetworkRequest, callback func(response *ModifyGlobalDatabaseNetworkResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ModifyGlobalDatabaseNetworkResponse + var err error + defer close(result) + response, err = client.ModifyGlobalDatabaseNetwork(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ModifyGlobalDatabaseNetworkRequest is the request struct for api ModifyGlobalDatabaseNetwork +type ModifyGlobalDatabaseNetworkRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + SecurityToken string `position:"Query" name:"SecurityToken"` + GDNId string `position:"Query" name:"GDNId"` + GDNDescription string `position:"Query" name:"GDNDescription"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` +} + +// ModifyGlobalDatabaseNetworkResponse is the response struct for api ModifyGlobalDatabaseNetwork +type ModifyGlobalDatabaseNetworkResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateModifyGlobalDatabaseNetworkRequest creates a request to invoke ModifyGlobalDatabaseNetwork API +func CreateModifyGlobalDatabaseNetworkRequest() (request *ModifyGlobalDatabaseNetworkRequest) { + request = &ModifyGlobalDatabaseNetworkRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("polardb", "2017-08-01", "ModifyGlobalDatabaseNetwork", "polardb", "openAPI") + request.Method = requests.POST + return +} + +// CreateModifyGlobalDatabaseNetworkResponse creates a response to parse from ModifyGlobalDatabaseNetwork response +func CreateModifyGlobalDatabaseNetworkResponse() (response *ModifyGlobalDatabaseNetworkResponse) { + response = &ModifyGlobalDatabaseNetworkResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/modify_masking_rules.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/modify_masking_rules.go new file mode 100644 index 00000000000..6be07f7ac5f --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/modify_masking_rules.go @@ -0,0 +1,105 @@ +package polardb + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ModifyMaskingRules invokes the polardb.ModifyMaskingRules API synchronously +func (client *Client) ModifyMaskingRules(request *ModifyMaskingRulesRequest) (response *ModifyMaskingRulesResponse, err error) { + response = CreateModifyMaskingRulesResponse() + err = client.DoAction(request, response) + return +} + +// ModifyMaskingRulesWithChan invokes the polardb.ModifyMaskingRules API asynchronously +func (client *Client) ModifyMaskingRulesWithChan(request *ModifyMaskingRulesRequest) (<-chan *ModifyMaskingRulesResponse, <-chan error) { + responseChan := make(chan *ModifyMaskingRulesResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ModifyMaskingRules(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ModifyMaskingRulesWithCallback invokes the polardb.ModifyMaskingRules API asynchronously +func (client *Client) ModifyMaskingRulesWithCallback(request *ModifyMaskingRulesRequest, callback func(response *ModifyMaskingRulesResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ModifyMaskingRulesResponse + var err error + defer close(result) + response, err = client.ModifyMaskingRules(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ModifyMaskingRulesRequest is the request struct for api ModifyMaskingRules +type ModifyMaskingRulesRequest struct { + *requests.RpcRequest + DBClusterId string `position:"Query" name:"DBClusterId"` + RuleName string `position:"Query" name:"RuleName"` + RuleConfig string `position:"Query" name:"RuleConfig"` + Enable string `position:"Query" name:"Enable"` + RuleNameList string `position:"Query" name:"RuleNameList"` +} + +// ModifyMaskingRulesResponse is the response struct for api ModifyMaskingRules +type ModifyMaskingRulesResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Message string `json:"Message" xml:"Message"` + Success bool `json:"Success" xml:"Success"` +} + +// CreateModifyMaskingRulesRequest creates a request to invoke ModifyMaskingRules API +func CreateModifyMaskingRulesRequest() (request *ModifyMaskingRulesRequest) { + request = &ModifyMaskingRulesRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("polardb", "2017-08-01", "ModifyMaskingRules", "polardb", "openAPI") + request.Method = requests.POST + return +} + +// CreateModifyMaskingRulesResponse creates a response to parse from ModifyMaskingRules response +func CreateModifyMaskingRulesResponse() (response *ModifyMaskingRulesResponse) { + response = &ModifyMaskingRulesResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/remove_db_cluster_from_gdn.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/remove_db_cluster_from_gdn.go new file mode 100644 index 00000000000..c04c7a0f680 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/remove_db_cluster_from_gdn.go @@ -0,0 +1,105 @@ +package polardb + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// RemoveDBClusterFromGDN invokes the polardb.RemoveDBClusterFromGDN API synchronously +func (client *Client) RemoveDBClusterFromGDN(request *RemoveDBClusterFromGDNRequest) (response *RemoveDBClusterFromGDNResponse, err error) { + response = CreateRemoveDBClusterFromGDNResponse() + err = client.DoAction(request, response) + return +} + +// RemoveDBClusterFromGDNWithChan invokes the polardb.RemoveDBClusterFromGDN API asynchronously +func (client *Client) RemoveDBClusterFromGDNWithChan(request *RemoveDBClusterFromGDNRequest) (<-chan *RemoveDBClusterFromGDNResponse, <-chan error) { + responseChan := make(chan *RemoveDBClusterFromGDNResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.RemoveDBClusterFromGDN(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// RemoveDBClusterFromGDNWithCallback invokes the polardb.RemoveDBClusterFromGDN API asynchronously +func (client *Client) RemoveDBClusterFromGDNWithCallback(request *RemoveDBClusterFromGDNRequest, callback func(response *RemoveDBClusterFromGDNResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *RemoveDBClusterFromGDNResponse + var err error + defer close(result) + response, err = client.RemoveDBClusterFromGDN(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// RemoveDBClusterFromGDNRequest is the request struct for api RemoveDBClusterFromGDN +type RemoveDBClusterFromGDNRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + SecurityToken string `position:"Query" name:"SecurityToken"` + GDNId string `position:"Query" name:"GDNId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + DBClusterId string `position:"Query" name:"DBClusterId"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` +} + +// RemoveDBClusterFromGDNResponse is the response struct for api RemoveDBClusterFromGDN +type RemoveDBClusterFromGDNResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateRemoveDBClusterFromGDNRequest creates a request to invoke RemoveDBClusterFromGDN API +func CreateRemoveDBClusterFromGDNRequest() (request *RemoveDBClusterFromGDNRequest) { + request = &RemoveDBClusterFromGDNRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("polardb", "2017-08-01", "RemoveDBClusterFromGDN", "polardb", "openAPI") + request.Method = requests.POST + return +} + +// CreateRemoveDBClusterFromGDNResponse creates a response to parse from RemoveDBClusterFromGDN response +func CreateRemoveDBClusterFromGDNResponse() (response *RemoveDBClusterFromGDNResponse) { + response = &RemoveDBClusterFromGDNResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_available_zone.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_available_zone.go index a9d62437978..66808ef11cc 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_available_zone.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_available_zone.go @@ -17,7 +17,7 @@ package polardb // AvailableZone is a nested struct in polardb response type AvailableZone struct { - RegionId string `json:"RegionId" xml:"RegionId"` ZoneId string `json:"ZoneId" xml:"ZoneId"` + RegionId string `json:"RegionId" xml:"RegionId"` SupportedEngines []SupportedEngine `json:"SupportedEngines" xml:"SupportedEngines"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_connection.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_connection.go new file mode 100644 index 00000000000..2ec2d41af08 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_connection.go @@ -0,0 +1,23 @@ +package polardb + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Connection is a nested struct in polardb response +type Connection struct { + ConnectionString string `json:"ConnectionString" xml:"ConnectionString"` + NetType string `json:"NetType" xml:"NetType"` + Port string `json:"Port" xml:"Port"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_connections.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_connections.go new file mode 100644 index 00000000000..d4e9c26392a --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_connections.go @@ -0,0 +1,21 @@ +package polardb + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Connections is a nested struct in polardb response +type Connections struct { + Connection []Connection `json:"Connection" xml:"Connection"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_data.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_data.go index f40a4c3efb7..6abd5cda263 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_data.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_data.go @@ -17,8 +17,9 @@ package polardb // Data is a nested struct in polardb response type Data struct { - TotalRecordCount int `json:"TotalRecordCount" xml:"TotalRecordCount"` - PageSize int `json:"PageSize" xml:"PageSize"` PageNumber int `json:"PageNumber" xml:"PageNumber"` + PageSize int `json:"PageSize" xml:"PageSize"` + TotalRecordCount int `json:"TotalRecordCount" xml:"TotalRecordCount"` + RuleList []string `json:"RuleList" xml:"RuleList"` TimerInfos []TimerInfos `json:"TimerInfos" xml:"TimerInfos"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_db_cluster_in_describe_global_database_network.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_db_cluster_in_describe_global_database_network.go new file mode 100644 index 00000000000..556e5474c25 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_db_cluster_in_describe_global_database_network.go @@ -0,0 +1,33 @@ +package polardb + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DBClusterInDescribeGlobalDatabaseNetwork is a nested struct in polardb response +type DBClusterInDescribeGlobalDatabaseNetwork struct { + ReplicaLag string `json:"ReplicaLag" xml:"ReplicaLag"` + ExpireTime string `json:"ExpireTime" xml:"ExpireTime"` + Expired string `json:"Expired" xml:"Expired"` + DBNodeClass string `json:"DBNodeClass" xml:"DBNodeClass"` + PayType string `json:"PayType" xml:"PayType"` + DBType string `json:"DBType" xml:"DBType"` + RegionId string `json:"RegionId" xml:"RegionId"` + DBVersion string `json:"DBVersion" xml:"DBVersion"` + DBClusterId string `json:"DBClusterId" xml:"DBClusterId"` + DBClusterStatus string `json:"DBClusterStatus" xml:"DBClusterStatus"` + StorageUsed string `json:"StorageUsed" xml:"StorageUsed"` + DBClusterDescription string `json:"DBClusterDescription" xml:"DBClusterDescription"` + Role string `json:"Role" xml:"Role"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_db_clusters.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_db_clusters.go deleted file mode 100644 index 0c82b6f35c9..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_db_clusters.go +++ /dev/null @@ -1,21 +0,0 @@ -package polardb - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DBClusters is a nested struct in polardb response -type DBClusters struct { - DBCluster []DBCluster `json:"DBCluster" xml:"DBCluster"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_db_clusters_in_describe_global_database_network.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_db_clusters_in_describe_global_database_network.go new file mode 100644 index 00000000000..c44cd2d04d4 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_db_clusters_in_describe_global_database_network.go @@ -0,0 +1,21 @@ +package polardb + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DBClustersInDescribeGlobalDatabaseNetwork is a nested struct in polardb response +type DBClustersInDescribeGlobalDatabaseNetwork struct { + DBCluster []DBClusterInDescribeGlobalDatabaseNetwork `json:"DBCluster" xml:"DBCluster"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_db_clusters_in_describe_global_database_networks.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_db_clusters_in_describe_global_database_networks.go new file mode 100644 index 00000000000..b3b815d3ab1 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_db_clusters_in_describe_global_database_networks.go @@ -0,0 +1,21 @@ +package polardb + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DBClustersInDescribeGlobalDatabaseNetworks is a nested struct in polardb response +type DBClustersInDescribeGlobalDatabaseNetworks struct { + DBCluster []DBCluster `json:"DBCluster" xml:"DBCluster"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_global_database_network.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_global_database_network.go index 1373e3268d0..603d6ca160e 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_global_database_network.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_global_database_network.go @@ -17,11 +17,11 @@ package polardb // GlobalDatabaseNetwork is a nested struct in polardb response type GlobalDatabaseNetwork struct { - GDNStatus string `json:"GDNStatus" xml:"GDNStatus"` DBVersion string `json:"DBVersion" xml:"DBVersion"` GDNId string `json:"GDNId" xml:"GDNId"` CreateTime string `json:"CreateTime" xml:"CreateTime"` - GDNDescription string `json:"GDNDescription" xml:"GDNDescription"` + GDNStatus string `json:"GDNStatus" xml:"GDNStatus"` DBType string `json:"DBType" xml:"DBType"` + GDNDescription string `json:"GDNDescription" xml:"GDNDescription"` DBClusters []DBCluster `json:"DBClusters" xml:"DBClusters"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_items_item.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_items_item.go index 81189e1bf22..14c9534e38c 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_items_item.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_items_item.go @@ -17,18 +17,18 @@ package polardb // ItemsItem is a nested struct in polardb response type ItemsItem struct { - Id int `json:"Id" xml:"Id"` - DBClusterId string `json:"DBClusterId" xml:"DBClusterId"` - DBType string `json:"DBType" xml:"DBType"` - StartTime string `json:"StartTime" xml:"StartTime"` - SwitchTime string `json:"SwitchTime" xml:"SwitchTime"` - Deadline string `json:"Deadline" xml:"Deadline"` Status int `json:"Status" xml:"Status"` - CreatedTime string `json:"CreatedTime" xml:"CreatedTime"` - ModifiedTime string `json:"ModifiedTime" xml:"ModifiedTime"` - ResultInfo string `json:"ResultInfo" xml:"ResultInfo"` PrepareInterval string `json:"PrepareInterval" xml:"PrepareInterval"` + Deadline string `json:"Deadline" xml:"Deadline"` + DBType string `json:"DBType" xml:"DBType"` TaskType string `json:"TaskType" xml:"TaskType"` + StartTime string `json:"StartTime" xml:"StartTime"` DBVersion string `json:"DBVersion" xml:"DBVersion"` + ModifiedTime string `json:"ModifiedTime" xml:"ModifiedTime"` + DBClusterId string `json:"DBClusterId" xml:"DBClusterId"` Region string `json:"Region" xml:"Region"` + ResultInfo string `json:"ResultInfo" xml:"ResultInfo"` + CreatedTime string `json:"CreatedTime" xml:"CreatedTime"` + Id int `json:"Id" xml:"Id"` + SwitchTime string `json:"SwitchTime" xml:"SwitchTime"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_parameter_groups_item.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_parameter_groups_item.go index ada221860ef..1ee8b5ae0d4 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_parameter_groups_item.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_parameter_groups_item.go @@ -17,13 +17,13 @@ package polardb // ParameterGroupsItem is a nested struct in polardb response type ParameterGroupsItem struct { + DBType string `json:"DBType" xml:"DBType"` DBVersion string `json:"DBVersion" xml:"DBVersion"` - ParameterGroupId string `json:"ParameterGroupId" xml:"ParameterGroupId"` - ForceRestart string `json:"ForceRestart" xml:"ForceRestart"` ParameterGroupName string `json:"ParameterGroupName" xml:"ParameterGroupName"` - CreateTime string `json:"CreateTime" xml:"CreateTime"` - ParameterGroupDesc string `json:"ParameterGroupDesc" xml:"ParameterGroupDesc"` + ForceRestart string `json:"ForceRestart" xml:"ForceRestart"` ParameterGroupType string `json:"ParameterGroupType" xml:"ParameterGroupType"` ParameterCounts int64 `json:"ParameterCounts" xml:"ParameterCounts"` - DBType string `json:"DBType" xml:"DBType"` + ParameterGroupDesc string `json:"ParameterGroupDesc" xml:"ParameterGroupDesc"` + CreateTime string `json:"CreateTime" xml:"CreateTime"` + ParameterGroupId string `json:"ParameterGroupId" xml:"ParameterGroupId"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_rule_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_rule_list.go new file mode 100644 index 00000000000..7bf979ce809 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/polardb/struct_rule_list.go @@ -0,0 +1,21 @@ +package polardb + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// RuleList is a nested struct in polardb response +type RuleList struct { + RuleList []string `json:"RuleList" xml:"RuleList"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/create_tair_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/create_tair_instance.go index acf40a97e62..132ce9812f6 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/create_tair_instance.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/create_tair_instance.go @@ -72,6 +72,7 @@ func (client *Client) CreateTairInstanceWithCallback(request *CreateTairInstance type CreateTairInstanceRequest struct { *requests.RpcRequest ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + SecondaryZoneId string `position:"Query" name:"SecondaryZoneId"` CouponNo string `position:"Query" name:"CouponNo"` EngineVersion string `position:"Query" name:"EngineVersion"` StorageType string `position:"Query" name:"StorageType"` @@ -99,6 +100,7 @@ type CreateTairInstanceRequest struct { ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` SrcDBInstanceId string `position:"Query" name:"SrcDBInstanceId"` OwnerAccount string `position:"Query" name:"OwnerAccount"` + GlobalInstanceId string `position:"Query" name:"GlobalInstanceId"` VpcId string `position:"Query" name:"VpcId"` ChargeType string `position:"Query" name:"ChargeType"` } @@ -106,20 +108,20 @@ type CreateTairInstanceRequest struct { // CreateTairInstanceResponse is the response struct for api CreateTairInstance type CreateTairInstanceResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` + Bandwidth int64 `json:"Bandwidth" xml:"Bandwidth"` + ChargeType string `json:"ChargeType" xml:"ChargeType"` + Config string `json:"Config" xml:"Config"` + ConnectionDomain string `json:"ConnectionDomain" xml:"ConnectionDomain"` + Connections int64 `json:"Connections" xml:"Connections"` InstanceId string `json:"InstanceId" xml:"InstanceId"` InstanceName string `json:"InstanceName" xml:"InstanceName"` - ConnectionDomain string `json:"ConnectionDomain" xml:"ConnectionDomain"` - Port int `json:"Port" xml:"Port"` InstanceStatus string `json:"InstanceStatus" xml:"InstanceStatus"` - RegionId string `json:"RegionId" xml:"RegionId"` + Port int `json:"Port" xml:"Port"` QPS int64 `json:"QPS" xml:"QPS"` - Bandwidth int64 `json:"Bandwidth" xml:"Bandwidth"` - Connections int64 `json:"Connections" xml:"Connections"` - ZoneId string `json:"ZoneId" xml:"ZoneId"` - Config string `json:"Config" xml:"Config"` - ChargeType string `json:"ChargeType" xml:"ChargeType"` + RegionId string `json:"RegionId" xml:"RegionId"` + RequestId string `json:"RequestId" xml:"RequestId"` TaskId string `json:"TaskId" xml:"TaskId"` + ZoneId string `json:"ZoneId" xml:"ZoneId"` } // CreateCreateTairInstanceRequest creates a request to invoke CreateTairInstance API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/describe_audit_log_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/describe_audit_log_config.go new file mode 100644 index 00000000000..fe1f4f768f4 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/describe_audit_log_config.go @@ -0,0 +1,106 @@ +package r_kvstore + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeAuditLogConfig invokes the r_kvstore.DescribeAuditLogConfig API synchronously +func (client *Client) DescribeAuditLogConfig(request *DescribeAuditLogConfigRequest) (response *DescribeAuditLogConfigResponse, err error) { + response = CreateDescribeAuditLogConfigResponse() + err = client.DoAction(request, response) + return +} + +// DescribeAuditLogConfigWithChan invokes the r_kvstore.DescribeAuditLogConfig API asynchronously +func (client *Client) DescribeAuditLogConfigWithChan(request *DescribeAuditLogConfigRequest) (<-chan *DescribeAuditLogConfigResponse, <-chan error) { + responseChan := make(chan *DescribeAuditLogConfigResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeAuditLogConfig(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeAuditLogConfigWithCallback invokes the r_kvstore.DescribeAuditLogConfig API asynchronously +func (client *Client) DescribeAuditLogConfigWithCallback(request *DescribeAuditLogConfigRequest, callback func(response *DescribeAuditLogConfigResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeAuditLogConfigResponse + var err error + defer close(result) + response, err = client.DescribeAuditLogConfig(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeAuditLogConfigRequest is the request struct for api DescribeAuditLogConfig +type DescribeAuditLogConfigRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + SecurityToken string `position:"Query" name:"SecurityToken"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + InstanceId string `position:"Query" name:"InstanceId"` +} + +// DescribeAuditLogConfigResponse is the response struct for api DescribeAuditLogConfig +type DescribeAuditLogConfigResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + DbAudit string `json:"DbAudit" xml:"DbAudit"` + Retention string `json:"Retention" xml:"Retention"` +} + +// CreateDescribeAuditLogConfigRequest creates a request to invoke DescribeAuditLogConfig API +func CreateDescribeAuditLogConfigRequest() (request *DescribeAuditLogConfigRequest) { + request = &DescribeAuditLogConfigRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("R-kvstore", "2015-01-01", "DescribeAuditLogConfig", "redisa", "openAPI") + request.Method = requests.POST + return +} + +// CreateDescribeAuditLogConfigResponse creates a response to parse from DescribeAuditLogConfig response +func CreateDescribeAuditLogConfigResponse() (response *DescribeAuditLogConfigResponse) { + response = &DescribeAuditLogConfigResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/describe_available_resource.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/describe_available_resource.go index 52792608ff4..f56ec17edcd 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/describe_available_resource.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/describe_available_resource.go @@ -77,6 +77,7 @@ type DescribeAvailableResourceRequest struct { SecurityToken string `position:"Query" name:"SecurityToken"` Engine string `position:"Query" name:"Engine"` InstanceChargeType string `position:"Query" name:"InstanceChargeType"` + NodeId string `position:"Query" name:"NodeId"` ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` Level string `position:"Query" name:"Level"` OwnerAccount string `position:"Query" name:"OwnerAccount"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/describe_dedicated_cluster_instance_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/describe_dedicated_cluster_instance_list.go index 2f7465437b1..97c08f4ced2 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/describe_dedicated_cluster_instance_list.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/describe_dedicated_cluster_instance_list.go @@ -85,6 +85,7 @@ type DescribeDedicatedClusterInstanceListRequest struct { ClusterId string `position:"Query" name:"ClusterId"` OwnerId requests.Integer `position:"Query" name:"OwnerId"` InstanceId string `position:"Query" name:"InstanceId"` + Region string `position:"Query" name:"Region"` } // DescribeDedicatedClusterInstanceListResponse is the response struct for api DescribeDedicatedClusterInstanceList diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/describe_engine_version.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/describe_engine_version.go index 93b15b97754..d4dcd17da5f 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/describe_engine_version.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/describe_engine_version.go @@ -90,6 +90,9 @@ type DescribeEngineVersionResponse struct { EnableUpgradeMinorVersion bool `json:"EnableUpgradeMinorVersion" xml:"EnableUpgradeMinorVersion"` MajorVersion string `json:"MajorVersion" xml:"MajorVersion"` EnableUpgradeMajorVersion bool `json:"EnableUpgradeMajorVersion" xml:"EnableUpgradeMajorVersion"` + ProxyMinorVersion string `json:"ProxyMinorVersion" xml:"ProxyMinorVersion"` + DBVersionRelease string `json:"DBVersionRelease" xml:"DBVersionRelease"` + ProxyVersionRelease string `json:"ProxyVersionRelease" xml:"ProxyVersionRelease"` } // CreateDescribeEngineVersionRequest creates a request to invoke DescribeEngineVersion API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/describe_intranet_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/describe_intranet_attribute.go index 610e9ecd640..fdda1afd480 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/describe_intranet_attribute.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/describe_intranet_attribute.go @@ -87,6 +87,7 @@ type DescribeIntranetAttributeResponse struct { IntranetBandwidth int `json:"IntranetBandwidth" xml:"IntranetBandwidth"` ExpireTime string `json:"ExpireTime" xml:"ExpireTime"` BandwidthExpireTime string `json:"BandwidthExpireTime" xml:"BandwidthExpireTime"` + AutoRenewal bool `json:"AutoRenewal" xml:"AutoRenewal"` } // CreateDescribeIntranetAttributeRequest creates a request to invoke DescribeIntranetAttribute API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/describe_parameter_templates.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/describe_parameter_templates.go index 611054afca2..864e581c292 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/describe_parameter_templates.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/describe_parameter_templates.go @@ -79,6 +79,7 @@ type DescribeParameterTemplatesRequest struct { ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` OwnerAccount string `position:"Query" name:"OwnerAccount"` OwnerId requests.Integer `position:"Query" name:"OwnerId"` + InstanceId string `position:"Query" name:"InstanceId"` CharacterType string `position:"Query" name:"CharacterType"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/remove_sub_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/remove_sub_instance.go new file mode 100644 index 00000000000..3d29f001cba --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/remove_sub_instance.go @@ -0,0 +1,105 @@ +package r_kvstore + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// RemoveSubInstance invokes the r_kvstore.RemoveSubInstance API synchronously +func (client *Client) RemoveSubInstance(request *RemoveSubInstanceRequest) (response *RemoveSubInstanceResponse, err error) { + response = CreateRemoveSubInstanceResponse() + err = client.DoAction(request, response) + return +} + +// RemoveSubInstanceWithChan invokes the r_kvstore.RemoveSubInstance API asynchronously +func (client *Client) RemoveSubInstanceWithChan(request *RemoveSubInstanceRequest) (<-chan *RemoveSubInstanceResponse, <-chan error) { + responseChan := make(chan *RemoveSubInstanceResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.RemoveSubInstance(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// RemoveSubInstanceWithCallback invokes the r_kvstore.RemoveSubInstance API asynchronously +func (client *Client) RemoveSubInstanceWithCallback(request *RemoveSubInstanceRequest, callback func(response *RemoveSubInstanceResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *RemoveSubInstanceResponse + var err error + defer close(result) + response, err = client.RemoveSubInstance(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// RemoveSubInstanceRequest is the request struct for api RemoveSubInstance +type RemoveSubInstanceRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ReleaseSubInstance requests.Boolean `position:"Query" name:"ReleaseSubInstance"` + SecurityToken string `position:"Query" name:"SecurityToken"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + InstanceId string `position:"Query" name:"InstanceId"` +} + +// RemoveSubInstanceResponse is the response struct for api RemoveSubInstance +type RemoveSubInstanceResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateRemoveSubInstanceRequest creates a request to invoke RemoveSubInstance API +func CreateRemoveSubInstanceRequest() (request *RemoveSubInstanceRequest) { + request = &RemoveSubInstanceRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("R-kvstore", "2015-01-01", "RemoveSubInstance", "redisa", "openAPI") + request.Method = requests.POST + return +} + +// CreateRemoveSubInstanceResponse creates a response to parse from RemoveSubInstance response +func CreateRemoveSubInstanceResponse() (response *RemoveSubInstanceResponse) { + response = &RemoveSubInstanceResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/restore_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/restore_instance.go index 947e95e54d0..e88e379ffcb 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/restore_instance.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/restore_instance.go @@ -72,6 +72,7 @@ func (client *Client) RestoreInstanceWithCallback(request *RestoreInstanceReques type RestoreInstanceRequest struct { *requests.RpcRequest ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + FilterKey string `position:"Query" name:"FilterKey"` SecurityToken string `position:"Query" name:"SecurityToken"` RestoreTime string `position:"Query" name:"RestoreTime"` ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/struct_available_resource.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/struct_available_resource.go index dee66fbfffb..b8f9046f510 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/struct_available_resource.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/struct_available_resource.go @@ -19,4 +19,5 @@ package r_kvstore type AvailableResource struct { InstanceClass string `json:"InstanceClass" xml:"InstanceClass"` InstanceClassRemark string `json:"InstanceClassRemark" xml:"InstanceClassRemark"` + Capacity int64 `json:"Capacity" xml:"Capacity"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/struct_backup_job.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/struct_backup_job.go index 59de306fed5..b3f81f461dc 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/struct_backup_job.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/struct_backup_job.go @@ -23,4 +23,5 @@ type BackupJob struct { Process string `json:"Process" xml:"Process"` StartTime string `json:"StartTime" xml:"StartTime"` TaskAction string `json:"TaskAction" xml:"TaskAction"` + NodeId string `json:"NodeId" xml:"NodeId"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/struct_db_instance_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/struct_db_instance_attribute.go index a4b4de625fe..d6ad71f49fa 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/struct_db_instance_attribute.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/struct_db_instance_attribute.go @@ -62,5 +62,6 @@ type DBInstanceAttribute struct { GlobalInstanceId string `json:"GlobalInstanceId" xml:"GlobalInstanceId"` SecondaryZoneId string `json:"SecondaryZoneId" xml:"SecondaryZoneId"` ZoneType string `json:"ZoneType" xml:"ZoneType"` + BackupLogStartTime string `json:"BackupLogStartTime" xml:"BackupLogStartTime"` Tags TagsInDescribeInstanceAttribute `json:"Tags" xml:"Tags"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/struct_instances_item.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/struct_instances_item.go index c2db293adbc..785062ddb83 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/struct_instances_item.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/struct_instances_item.go @@ -17,7 +17,7 @@ package r_kvstore // InstancesItem is a nested struct in r_kvstore response type InstancesItem struct { - CharacterType int `json:"CharacterType" xml:"CharacterType"` + CharacterType string `json:"CharacterType" xml:"CharacterType"` ClusterId string `json:"ClusterId" xml:"ClusterId"` ClusterName string `json:"ClusterName" xml:"ClusterName"` EngineVersion string `json:"EngineVersion" xml:"EngineVersion"` @@ -39,5 +39,6 @@ type InstancesItem struct { ShardCount int `json:"ShardCount" xml:"ShardCount"` CurrentBandWidth int64 `json:"CurrentBandWidth" xml:"CurrentBandWidth"` BandWidth int64 `json:"BandWidth" xml:"BandWidth"` + ProxyCount int `json:"ProxyCount" xml:"ProxyCount"` InstanceNodeList []InstanceNodes `json:"InstanceNodeList" xml:"InstanceNodeList"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/struct_kv_store_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/struct_kv_store_instance.go index 335265f57cd..f9719b68c0d 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/struct_kv_store_instance.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/struct_kv_store_instance.go @@ -53,5 +53,7 @@ type KVStoreInstance struct { ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` ShardCount int `json:"ShardCount" xml:"ShardCount"` ProxyCount int `json:"ProxyCount" xml:"ProxyCount"` + SecondaryZoneId string `json:"SecondaryZoneId" xml:"SecondaryZoneId"` + GlobalInstanceId string `json:"GlobalInstanceId" xml:"GlobalInstanceId"` Tags TagsInDescribeInstances `json:"Tags" xml:"Tags"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/switch_instance_proxy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/switch_instance_proxy.go new file mode 100644 index 00000000000..ab200e9002a --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore/switch_instance_proxy.go @@ -0,0 +1,106 @@ +package r_kvstore + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// SwitchInstanceProxy invokes the r_kvstore.SwitchInstanceProxy API synchronously +func (client *Client) SwitchInstanceProxy(request *SwitchInstanceProxyRequest) (response *SwitchInstanceProxyResponse, err error) { + response = CreateSwitchInstanceProxyResponse() + err = client.DoAction(request, response) + return +} + +// SwitchInstanceProxyWithChan invokes the r_kvstore.SwitchInstanceProxy API asynchronously +func (client *Client) SwitchInstanceProxyWithChan(request *SwitchInstanceProxyRequest) (<-chan *SwitchInstanceProxyResponse, <-chan error) { + responseChan := make(chan *SwitchInstanceProxyResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.SwitchInstanceProxy(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// SwitchInstanceProxyWithCallback invokes the r_kvstore.SwitchInstanceProxy API asynchronously +func (client *Client) SwitchInstanceProxyWithCallback(request *SwitchInstanceProxyRequest, callback func(response *SwitchInstanceProxyResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *SwitchInstanceProxyResponse + var err error + defer close(result) + response, err = client.SwitchInstanceProxy(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// SwitchInstanceProxyRequest is the request struct for api SwitchInstanceProxy +type SwitchInstanceProxyRequest struct { + *requests.RpcRequest + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + SecurityToken string `position:"Query" name:"SecurityToken"` + Product string `position:"Query" name:"Product"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + InstanceId string `position:"Query" name:"InstanceId"` + Category string `position:"Query" name:"Category"` +} + +// SwitchInstanceProxyResponse is the response struct for api SwitchInstanceProxy +type SwitchInstanceProxyResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateSwitchInstanceProxyRequest creates a request to invoke SwitchInstanceProxy API +func CreateSwitchInstanceProxyRequest() (request *SwitchInstanceProxyRequest) { + request = &SwitchInstanceProxyRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("R-kvstore", "2015-01-01", "SwitchInstanceProxy", "redisa", "openAPI") + request.Method = requests.POST + return +} + +// CreateSwitchInstanceProxyResponse creates a response to parse from SwitchInstanceProxy response +func CreateSwitchInstanceProxyResponse() (response *SwitchInstanceProxyResponse) { + response = &SwitchInstanceProxyResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/add_tags_to_resource.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/add_tags_to_resource.go deleted file mode 100644 index 889487ca17f..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/add_tags_to_resource.go +++ /dev/null @@ -1,116 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// AddTagsToResource invokes the rds.AddTagsToResource API synchronously -func (client *Client) AddTagsToResource(request *AddTagsToResourceRequest) (response *AddTagsToResourceResponse, err error) { - response = CreateAddTagsToResourceResponse() - err = client.DoAction(request, response) - return -} - -// AddTagsToResourceWithChan invokes the rds.AddTagsToResource API asynchronously -func (client *Client) AddTagsToResourceWithChan(request *AddTagsToResourceRequest) (<-chan *AddTagsToResourceResponse, <-chan error) { - responseChan := make(chan *AddTagsToResourceResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.AddTagsToResource(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// AddTagsToResourceWithCallback invokes the rds.AddTagsToResource API asynchronously -func (client *Client) AddTagsToResourceWithCallback(request *AddTagsToResourceRequest, callback func(response *AddTagsToResourceResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *AddTagsToResourceResponse - var err error - defer close(result) - response, err = client.AddTagsToResource(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// AddTagsToResourceRequest is the request struct for api AddTagsToResource -type AddTagsToResourceRequest struct { - *requests.RpcRequest - Tag4Value string `position:"Query" name:"Tag.4.value"` - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - Tag2Key string `position:"Query" name:"Tag.2.key"` - ClientToken string `position:"Query" name:"ClientToken"` - Tag3Key string `position:"Query" name:"Tag.3.key"` - Tag1Value string `position:"Query" name:"Tag.1.value"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - Tag3Value string `position:"Query" name:"Tag.3.value"` - ProxyId string `position:"Query" name:"proxyId"` - Tag5Key string `position:"Query" name:"Tag.5.key"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - Tag5Value string `position:"Query" name:"Tag.5.value"` - Tags string `position:"Query" name:"Tags"` - Tag1Key string `position:"Query" name:"Tag.1.key"` - Tag2Value string `position:"Query" name:"Tag.2.value"` - Tag4Key string `position:"Query" name:"Tag.4.key"` -} - -// AddTagsToResourceResponse is the response struct for api AddTagsToResource -type AddTagsToResourceResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateAddTagsToResourceRequest creates a request to invoke AddTagsToResource API -func CreateAddTagsToResourceRequest() (request *AddTagsToResourceRequest) { - request = &AddTagsToResourceRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "AddTagsToResource", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateAddTagsToResourceResponse creates a response to parse from AddTagsToResource response -func CreateAddTagsToResourceResponse() (response *AddTagsToResourceResponse) { - response = &AddTagsToResourceResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/allocate_instance_public_connection.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/allocate_instance_public_connection.go deleted file mode 100644 index a609372af37..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/allocate_instance_public_connection.go +++ /dev/null @@ -1,107 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// AllocateInstancePublicConnection invokes the rds.AllocateInstancePublicConnection API synchronously -func (client *Client) AllocateInstancePublicConnection(request *AllocateInstancePublicConnectionRequest) (response *AllocateInstancePublicConnectionResponse, err error) { - response = CreateAllocateInstancePublicConnectionResponse() - err = client.DoAction(request, response) - return -} - -// AllocateInstancePublicConnectionWithChan invokes the rds.AllocateInstancePublicConnection API asynchronously -func (client *Client) AllocateInstancePublicConnectionWithChan(request *AllocateInstancePublicConnectionRequest) (<-chan *AllocateInstancePublicConnectionResponse, <-chan error) { - responseChan := make(chan *AllocateInstancePublicConnectionResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.AllocateInstancePublicConnection(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// AllocateInstancePublicConnectionWithCallback invokes the rds.AllocateInstancePublicConnection API asynchronously -func (client *Client) AllocateInstancePublicConnectionWithCallback(request *AllocateInstancePublicConnectionRequest, callback func(response *AllocateInstancePublicConnectionResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *AllocateInstancePublicConnectionResponse - var err error - defer close(result) - response, err = client.AllocateInstancePublicConnection(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// AllocateInstancePublicConnectionRequest is the request struct for api AllocateInstancePublicConnection -type AllocateInstancePublicConnectionRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ConnectionStringPrefix string `position:"Query" name:"ConnectionStringPrefix"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - Port string `position:"Query" name:"Port"` -} - -// AllocateInstancePublicConnectionResponse is the response struct for api AllocateInstancePublicConnection -type AllocateInstancePublicConnectionResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - ConnectionString string `json:"ConnectionString" xml:"ConnectionString"` - DbInstanceName string `json:"DbInstanceName" xml:"DbInstanceName"` -} - -// CreateAllocateInstancePublicConnectionRequest creates a request to invoke AllocateInstancePublicConnection API -func CreateAllocateInstancePublicConnectionRequest() (request *AllocateInstancePublicConnectionRequest) { - request = &AllocateInstancePublicConnectionRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "AllocateInstancePublicConnection", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateAllocateInstancePublicConnectionResponse creates a response to parse from AllocateInstancePublicConnection response -func CreateAllocateInstancePublicConnectionResponse() (response *AllocateInstancePublicConnectionResponse) { - response = &AllocateInstancePublicConnectionResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/allocate_read_write_splitting_connection.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/allocate_read_write_splitting_connection.go deleted file mode 100644 index 233e8ebcab6..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/allocate_read_write_splitting_connection.go +++ /dev/null @@ -1,109 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// AllocateReadWriteSplittingConnection invokes the rds.AllocateReadWriteSplittingConnection API synchronously -func (client *Client) AllocateReadWriteSplittingConnection(request *AllocateReadWriteSplittingConnectionRequest) (response *AllocateReadWriteSplittingConnectionResponse, err error) { - response = CreateAllocateReadWriteSplittingConnectionResponse() - err = client.DoAction(request, response) - return -} - -// AllocateReadWriteSplittingConnectionWithChan invokes the rds.AllocateReadWriteSplittingConnection API asynchronously -func (client *Client) AllocateReadWriteSplittingConnectionWithChan(request *AllocateReadWriteSplittingConnectionRequest) (<-chan *AllocateReadWriteSplittingConnectionResponse, <-chan error) { - responseChan := make(chan *AllocateReadWriteSplittingConnectionResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.AllocateReadWriteSplittingConnection(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// AllocateReadWriteSplittingConnectionWithCallback invokes the rds.AllocateReadWriteSplittingConnection API asynchronously -func (client *Client) AllocateReadWriteSplittingConnectionWithCallback(request *AllocateReadWriteSplittingConnectionRequest, callback func(response *AllocateReadWriteSplittingConnectionResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *AllocateReadWriteSplittingConnectionResponse - var err error - defer close(result) - response, err = client.AllocateReadWriteSplittingConnection(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// AllocateReadWriteSplittingConnectionRequest is the request struct for api AllocateReadWriteSplittingConnection -type AllocateReadWriteSplittingConnectionRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ConnectionStringPrefix string `position:"Query" name:"ConnectionStringPrefix"` - DistributionType string `position:"Query" name:"DistributionType"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - Weight string `position:"Query" name:"Weight"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - Port string `position:"Query" name:"Port"` - NetType string `position:"Query" name:"NetType"` - MaxDelayTime string `position:"Query" name:"MaxDelayTime"` -} - -// AllocateReadWriteSplittingConnectionResponse is the response struct for api AllocateReadWriteSplittingConnection -type AllocateReadWriteSplittingConnectionResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateAllocateReadWriteSplittingConnectionRequest creates a request to invoke AllocateReadWriteSplittingConnection API -func CreateAllocateReadWriteSplittingConnectionRequest() (request *AllocateReadWriteSplittingConnectionRequest) { - request = &AllocateReadWriteSplittingConnectionRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "AllocateReadWriteSplittingConnection", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateAllocateReadWriteSplittingConnectionResponse creates a response to parse from AllocateReadWriteSplittingConnection response -func CreateAllocateReadWriteSplittingConnectionResponse() (response *AllocateReadWriteSplittingConnectionResponse) { - response = &AllocateReadWriteSplittingConnectionResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/calculate_db_instance_weight.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/calculate_db_instance_weight.go deleted file mode 100644 index 6f84dacf7be..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/calculate_db_instance_weight.go +++ /dev/null @@ -1,104 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// CalculateDBInstanceWeight invokes the rds.CalculateDBInstanceWeight API synchronously -func (client *Client) CalculateDBInstanceWeight(request *CalculateDBInstanceWeightRequest) (response *CalculateDBInstanceWeightResponse, err error) { - response = CreateCalculateDBInstanceWeightResponse() - err = client.DoAction(request, response) - return -} - -// CalculateDBInstanceWeightWithChan invokes the rds.CalculateDBInstanceWeight API asynchronously -func (client *Client) CalculateDBInstanceWeightWithChan(request *CalculateDBInstanceWeightRequest) (<-chan *CalculateDBInstanceWeightResponse, <-chan error) { - responseChan := make(chan *CalculateDBInstanceWeightResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.CalculateDBInstanceWeight(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// CalculateDBInstanceWeightWithCallback invokes the rds.CalculateDBInstanceWeight API asynchronously -func (client *Client) CalculateDBInstanceWeightWithCallback(request *CalculateDBInstanceWeightRequest, callback func(response *CalculateDBInstanceWeightResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *CalculateDBInstanceWeightResponse - var err error - defer close(result) - response, err = client.CalculateDBInstanceWeight(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// CalculateDBInstanceWeightRequest is the request struct for api CalculateDBInstanceWeight -type CalculateDBInstanceWeightRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// CalculateDBInstanceWeightResponse is the response struct for api CalculateDBInstanceWeight -type CalculateDBInstanceWeightResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Items ItemsInCalculateDBInstanceWeight `json:"Items" xml:"Items"` -} - -// CreateCalculateDBInstanceWeightRequest creates a request to invoke CalculateDBInstanceWeight API -func CreateCalculateDBInstanceWeightRequest() (request *CalculateDBInstanceWeightRequest) { - request = &CalculateDBInstanceWeightRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "CalculateDBInstanceWeight", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateCalculateDBInstanceWeightResponse creates a response to parse from CalculateDBInstanceWeight response -func CreateCalculateDBInstanceWeightResponse() (response *CalculateDBInstanceWeightResponse) { - response = &CalculateDBInstanceWeightResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/cancel_import.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/cancel_import.go deleted file mode 100644 index 1e1c0abcbb2..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/cancel_import.go +++ /dev/null @@ -1,104 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// CancelImport invokes the rds.CancelImport API synchronously -func (client *Client) CancelImport(request *CancelImportRequest) (response *CancelImportResponse, err error) { - response = CreateCancelImportResponse() - err = client.DoAction(request, response) - return -} - -// CancelImportWithChan invokes the rds.CancelImport API asynchronously -func (client *Client) CancelImportWithChan(request *CancelImportRequest) (<-chan *CancelImportResponse, <-chan error) { - responseChan := make(chan *CancelImportResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.CancelImport(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// CancelImportWithCallback invokes the rds.CancelImport API asynchronously -func (client *Client) CancelImportWithCallback(request *CancelImportRequest, callback func(response *CancelImportResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *CancelImportResponse - var err error - defer close(result) - response, err = client.CancelImport(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// CancelImportRequest is the request struct for api CancelImport -type CancelImportRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - ImportId requests.Integer `position:"Query" name:"ImportId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// CancelImportResponse is the response struct for api CancelImport -type CancelImportResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateCancelImportRequest creates a request to invoke CancelImport API -func CreateCancelImportRequest() (request *CancelImportRequest) { - request = &CancelImportRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "CancelImport", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateCancelImportResponse creates a response to parse from CancelImport response -func CreateCancelImportResponse() (response *CancelImportResponse) { - response = &CancelImportResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/check_account_name_available.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/check_account_name_available.go deleted file mode 100644 index bffad7f6fd3..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/check_account_name_available.go +++ /dev/null @@ -1,105 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// CheckAccountNameAvailable invokes the rds.CheckAccountNameAvailable API synchronously -func (client *Client) CheckAccountNameAvailable(request *CheckAccountNameAvailableRequest) (response *CheckAccountNameAvailableResponse, err error) { - response = CreateCheckAccountNameAvailableResponse() - err = client.DoAction(request, response) - return -} - -// CheckAccountNameAvailableWithChan invokes the rds.CheckAccountNameAvailable API asynchronously -func (client *Client) CheckAccountNameAvailableWithChan(request *CheckAccountNameAvailableRequest) (<-chan *CheckAccountNameAvailableResponse, <-chan error) { - responseChan := make(chan *CheckAccountNameAvailableResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.CheckAccountNameAvailable(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// CheckAccountNameAvailableWithCallback invokes the rds.CheckAccountNameAvailable API asynchronously -func (client *Client) CheckAccountNameAvailableWithCallback(request *CheckAccountNameAvailableRequest, callback func(response *CheckAccountNameAvailableResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *CheckAccountNameAvailableResponse - var err error - defer close(result) - response, err = client.CheckAccountNameAvailable(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// CheckAccountNameAvailableRequest is the request struct for api CheckAccountNameAvailable -type CheckAccountNameAvailableRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ClientToken string `position:"Query" name:"ClientToken"` - AccountName string `position:"Query" name:"AccountName"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// CheckAccountNameAvailableResponse is the response struct for api CheckAccountNameAvailable -type CheckAccountNameAvailableResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateCheckAccountNameAvailableRequest creates a request to invoke CheckAccountNameAvailable API -func CreateCheckAccountNameAvailableRequest() (request *CheckAccountNameAvailableRequest) { - request = &CheckAccountNameAvailableRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "CheckAccountNameAvailable", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateCheckAccountNameAvailableResponse creates a response to parse from CheckAccountNameAvailable response -func CreateCheckAccountNameAvailableResponse() (response *CheckAccountNameAvailableResponse) { - response = &CheckAccountNameAvailableResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/check_cloud_resource_authorized.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/check_cloud_resource_authorized.go deleted file mode 100644 index c0dea6de4a8..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/check_cloud_resource_authorized.go +++ /dev/null @@ -1,107 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// CheckCloudResourceAuthorized invokes the rds.CheckCloudResourceAuthorized API synchronously -func (client *Client) CheckCloudResourceAuthorized(request *CheckCloudResourceAuthorizedRequest) (response *CheckCloudResourceAuthorizedResponse, err error) { - response = CreateCheckCloudResourceAuthorizedResponse() - err = client.DoAction(request, response) - return -} - -// CheckCloudResourceAuthorizedWithChan invokes the rds.CheckCloudResourceAuthorized API asynchronously -func (client *Client) CheckCloudResourceAuthorizedWithChan(request *CheckCloudResourceAuthorizedRequest) (<-chan *CheckCloudResourceAuthorizedResponse, <-chan error) { - responseChan := make(chan *CheckCloudResourceAuthorizedResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.CheckCloudResourceAuthorized(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// CheckCloudResourceAuthorizedWithCallback invokes the rds.CheckCloudResourceAuthorized API asynchronously -func (client *Client) CheckCloudResourceAuthorizedWithCallback(request *CheckCloudResourceAuthorizedRequest, callback func(response *CheckCloudResourceAuthorizedResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *CheckCloudResourceAuthorizedResponse - var err error - defer close(result) - response, err = client.CheckCloudResourceAuthorized(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// CheckCloudResourceAuthorizedRequest is the request struct for api CheckCloudResourceAuthorized -type CheckCloudResourceAuthorizedRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - SecurityToken string `position:"Query" name:"SecurityToken"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - TargetRegionId string `position:"Query" name:"TargetRegionId"` -} - -// CheckCloudResourceAuthorizedResponse is the response struct for api CheckCloudResourceAuthorized -type CheckCloudResourceAuthorizedResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - AuthorizationState int `json:"AuthorizationState" xml:"AuthorizationState"` - RoleArn string `json:"RoleArn" xml:"RoleArn"` -} - -// CreateCheckCloudResourceAuthorizedRequest creates a request to invoke CheckCloudResourceAuthorized API -func CreateCheckCloudResourceAuthorizedRequest() (request *CheckCloudResourceAuthorizedRequest) { - request = &CheckCloudResourceAuthorizedRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "CheckCloudResourceAuthorized", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateCheckCloudResourceAuthorizedResponse creates a response to parse from CheckCloudResourceAuthorized response -func CreateCheckCloudResourceAuthorizedResponse() (response *CheckCloudResourceAuthorizedResponse) { - response = &CheckCloudResourceAuthorizedResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/check_create_ddr_db_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/check_create_ddr_db_instance.go deleted file mode 100644 index 2d4dc1c95c3..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/check_create_ddr_db_instance.go +++ /dev/null @@ -1,119 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// CheckCreateDdrDBInstance invokes the rds.CheckCreateDdrDBInstance API synchronously -func (client *Client) CheckCreateDdrDBInstance(request *CheckCreateDdrDBInstanceRequest) (response *CheckCreateDdrDBInstanceResponse, err error) { - response = CreateCheckCreateDdrDBInstanceResponse() - err = client.DoAction(request, response) - return -} - -// CheckCreateDdrDBInstanceWithChan invokes the rds.CheckCreateDdrDBInstance API asynchronously -func (client *Client) CheckCreateDdrDBInstanceWithChan(request *CheckCreateDdrDBInstanceRequest) (<-chan *CheckCreateDdrDBInstanceResponse, <-chan error) { - responseChan := make(chan *CheckCreateDdrDBInstanceResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.CheckCreateDdrDBInstance(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// CheckCreateDdrDBInstanceWithCallback invokes the rds.CheckCreateDdrDBInstance API asynchronously -func (client *Client) CheckCreateDdrDBInstanceWithCallback(request *CheckCreateDdrDBInstanceRequest, callback func(response *CheckCreateDdrDBInstanceResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *CheckCreateDdrDBInstanceResponse - var err error - defer close(result) - response, err = client.CheckCreateDdrDBInstance(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// CheckCreateDdrDBInstanceRequest is the request struct for api CheckCreateDdrDBInstance -type CheckCreateDdrDBInstanceRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - DBInstanceStorage requests.Integer `position:"Query" name:"DBInstanceStorage"` - SourceDBInstanceName string `position:"Query" name:"SourceDBInstanceName"` - HostType string `position:"Query" name:"HostType"` - BinlogRole string `position:"Query" name:"BinlogRole"` - EngineVersion string `position:"Query" name:"EngineVersion"` - UserBakSetURL string `position:"Query" name:"UserBakSetURL"` - Engine string `position:"Query" name:"Engine"` - BackupSetRegion string `position:"Query" name:"BackupSetRegion"` - BackupSetType string `position:"Query" name:"BackupSetType"` - RestoreTime string `position:"Query" name:"RestoreTime"` - BakSetName string `position:"Query" name:"BakSetName"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - BackupSetId string `position:"Query" name:"BackupSetId"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - BinlogPosition string `position:"Query" name:"BinlogPosition"` - DBInstanceClass string `position:"Query" name:"DBInstanceClass"` - RestoreType string `position:"Query" name:"RestoreType"` - BinlogName string `position:"Query" name:"BinlogName"` - SourceRegion string `position:"Query" name:"SourceRegion"` -} - -// CheckCreateDdrDBInstanceResponse is the response struct for api CheckCreateDdrDBInstance -type CheckCreateDdrDBInstanceResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - IsValid string `json:"IsValid" xml:"IsValid"` -} - -// CreateCheckCreateDdrDBInstanceRequest creates a request to invoke CheckCreateDdrDBInstance API -func CreateCheckCreateDdrDBInstanceRequest() (request *CheckCreateDdrDBInstanceRequest) { - request = &CheckCreateDdrDBInstanceRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "CheckCreateDdrDBInstance", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateCheckCreateDdrDBInstanceResponse creates a response to parse from CheckCreateDdrDBInstance response -func CreateCheckCreateDdrDBInstanceResponse() (response *CheckCreateDdrDBInstanceResponse) { - response = &CheckCreateDdrDBInstanceResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/check_db_name_available.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/check_db_name_available.go deleted file mode 100644 index fb6fdd693c8..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/check_db_name_available.go +++ /dev/null @@ -1,105 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// CheckDBNameAvailable invokes the rds.CheckDBNameAvailable API synchronously -func (client *Client) CheckDBNameAvailable(request *CheckDBNameAvailableRequest) (response *CheckDBNameAvailableResponse, err error) { - response = CreateCheckDBNameAvailableResponse() - err = client.DoAction(request, response) - return -} - -// CheckDBNameAvailableWithChan invokes the rds.CheckDBNameAvailable API asynchronously -func (client *Client) CheckDBNameAvailableWithChan(request *CheckDBNameAvailableRequest) (<-chan *CheckDBNameAvailableResponse, <-chan error) { - responseChan := make(chan *CheckDBNameAvailableResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.CheckDBNameAvailable(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// CheckDBNameAvailableWithCallback invokes the rds.CheckDBNameAvailable API asynchronously -func (client *Client) CheckDBNameAvailableWithCallback(request *CheckDBNameAvailableRequest, callback func(response *CheckDBNameAvailableResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *CheckDBNameAvailableResponse - var err error - defer close(result) - response, err = client.CheckDBNameAvailable(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// CheckDBNameAvailableRequest is the request struct for api CheckDBNameAvailable -type CheckDBNameAvailableRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ClientToken string `position:"Query" name:"ClientToken"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBName string `position:"Query" name:"DBName"` -} - -// CheckDBNameAvailableResponse is the response struct for api CheckDBNameAvailable -type CheckDBNameAvailableResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateCheckDBNameAvailableRequest creates a request to invoke CheckDBNameAvailable API -func CreateCheckDBNameAvailableRequest() (request *CheckDBNameAvailableRequest) { - request = &CheckDBNameAvailableRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "CheckDBNameAvailable", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateCheckDBNameAvailableResponse creates a response to parse from CheckDBNameAvailable response -func CreateCheckDBNameAvailableResponse() (response *CheckDBNameAvailableResponse) { - response = &CheckDBNameAvailableResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/check_instance_exist.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/check_instance_exist.go deleted file mode 100644 index 6282c174e8a..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/check_instance_exist.go +++ /dev/null @@ -1,103 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// CheckInstanceExist invokes the rds.CheckInstanceExist API synchronously -func (client *Client) CheckInstanceExist(request *CheckInstanceExistRequest) (response *CheckInstanceExistResponse, err error) { - response = CreateCheckInstanceExistResponse() - err = client.DoAction(request, response) - return -} - -// CheckInstanceExistWithChan invokes the rds.CheckInstanceExist API asynchronously -func (client *Client) CheckInstanceExistWithChan(request *CheckInstanceExistRequest) (<-chan *CheckInstanceExistResponse, <-chan error) { - responseChan := make(chan *CheckInstanceExistResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.CheckInstanceExist(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// CheckInstanceExistWithCallback invokes the rds.CheckInstanceExist API asynchronously -func (client *Client) CheckInstanceExistWithCallback(request *CheckInstanceExistRequest, callback func(response *CheckInstanceExistResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *CheckInstanceExistResponse - var err error - defer close(result) - response, err = client.CheckInstanceExist(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// CheckInstanceExistRequest is the request struct for api CheckInstanceExist -type CheckInstanceExistRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// CheckInstanceExistResponse is the response struct for api CheckInstanceExist -type CheckInstanceExistResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - IsExistInstance bool `json:"IsExistInstance" xml:"IsExistInstance"` -} - -// CreateCheckInstanceExistRequest creates a request to invoke CheckInstanceExist API -func CreateCheckInstanceExistRequest() (request *CheckInstanceExistRequest) { - request = &CheckInstanceExistRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "CheckInstanceExist", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateCheckInstanceExistResponse creates a response to parse from CheckInstanceExist response -func CreateCheckInstanceExistResponse() (response *CheckInstanceExistResponse) { - response = &CheckInstanceExistResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/client.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/client.go deleted file mode 100644 index a6bdec8b91b..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/client.go +++ /dev/null @@ -1,129 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "reflect" - - "github.com/aliyun/alibaba-cloud-sdk-go/sdk" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/provider" -) - -// Client is the sdk client struct, each func corresponds to an OpenAPI -type Client struct { - sdk.Client -} - -// SetClientProperty Set Property by Reflect -func SetClientProperty(client *Client, propertyName string, propertyValue interface{}) { - v := reflect.ValueOf(client).Elem() - if v.FieldByName(propertyName).IsValid() && v.FieldByName(propertyName).CanSet() { - v.FieldByName(propertyName).Set(reflect.ValueOf(propertyValue)) - } -} - -// SetEndpointDataToClient Set EndpointMap and ENdpointType -func SetEndpointDataToClient(client *Client) { - SetClientProperty(client, "EndpointMap", GetEndpointMap()) - SetClientProperty(client, "EndpointType", GetEndpointType()) -} - -// NewClient creates a sdk client with environment variables -func NewClient() (client *Client, err error) { - client = &Client{} - err = client.Init() - SetEndpointDataToClient(client) - return -} - -// NewClientWithProvider creates a sdk client with providers -// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md -func NewClientWithProvider(regionId string, providers ...provider.Provider) (client *Client, err error) { - client = &Client{} - var pc provider.Provider - if len(providers) == 0 { - pc = provider.DefaultChain - } else { - pc = provider.NewProviderChain(providers) - } - err = client.InitWithProviderChain(regionId, pc) - SetEndpointDataToClient(client) - return -} - -// NewClientWithOptions creates a sdk client with regionId/sdkConfig/credential -// this is the common api to create a sdk client -func NewClientWithOptions(regionId string, config *sdk.Config, credential auth.Credential) (client *Client, err error) { - client = &Client{} - err = client.InitWithOptions(regionId, config, credential) - SetEndpointDataToClient(client) - return -} - -// NewClientWithAccessKey is a shortcut to create sdk client with accesskey -// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md -func NewClientWithAccessKey(regionId, accessKeyId, accessKeySecret string) (client *Client, err error) { - client = &Client{} - err = client.InitWithAccessKey(regionId, accessKeyId, accessKeySecret) - SetEndpointDataToClient(client) - return -} - -// NewClientWithStsToken is a shortcut to create sdk client with sts token -// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md -func NewClientWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToken string) (client *Client, err error) { - client = &Client{} - err = client.InitWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToken) - SetEndpointDataToClient(client) - return -} - -// NewClientWithRamRoleArn is a shortcut to create sdk client with ram roleArn -// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md -func NewClientWithRamRoleArn(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName string) (client *Client, err error) { - client = &Client{} - err = client.InitWithRamRoleArn(regionId, accessKeyId, accessKeySecret, roleArn, roleSessionName) - SetEndpointDataToClient(client) - return -} - -// NewClientWithRamRoleArn is a shortcut to create sdk client with ram roleArn and policy -// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md -func NewClientWithRamRoleArnAndPolicy(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName, policy string) (client *Client, err error) { - client = &Client{} - err = client.InitWithRamRoleArnAndPolicy(regionId, accessKeyId, accessKeySecret, roleArn, roleSessionName, policy) - SetEndpointDataToClient(client) - return -} - -// NewClientWithEcsRamRole is a shortcut to create sdk client with ecs ram role -// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md -func NewClientWithEcsRamRole(regionId string, roleName string) (client *Client, err error) { - client = &Client{} - err = client.InitWithEcsRamRole(regionId, roleName) - SetEndpointDataToClient(client) - return -} - -// NewClientWithRsaKeyPair is a shortcut to create sdk client with rsa key pair -// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md -func NewClientWithRsaKeyPair(regionId string, publicKeyId, privateKey string, sessionExpiration int) (client *Client, err error) { - client = &Client{} - err = client.InitWithRsaKeyPair(regionId, publicKeyId, privateKey, sessionExpiration) - SetEndpointDataToClient(client) - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/clone_db_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/clone_db_instance.go deleted file mode 100644 index 1e8504035ac..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/clone_db_instance.go +++ /dev/null @@ -1,131 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// CloneDBInstance invokes the rds.CloneDBInstance API synchronously -func (client *Client) CloneDBInstance(request *CloneDBInstanceRequest) (response *CloneDBInstanceResponse, err error) { - response = CreateCloneDBInstanceResponse() - err = client.DoAction(request, response) - return -} - -// CloneDBInstanceWithChan invokes the rds.CloneDBInstance API asynchronously -func (client *Client) CloneDBInstanceWithChan(request *CloneDBInstanceRequest) (<-chan *CloneDBInstanceResponse, <-chan error) { - responseChan := make(chan *CloneDBInstanceResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.CloneDBInstance(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// CloneDBInstanceWithCallback invokes the rds.CloneDBInstance API asynchronously -func (client *Client) CloneDBInstanceWithCallback(request *CloneDBInstanceRequest, callback func(response *CloneDBInstanceResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *CloneDBInstanceResponse - var err error - defer close(result) - response, err = client.CloneDBInstance(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// CloneDBInstanceRequest is the request struct for api CloneDBInstance -type CloneDBInstanceRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - DBInstanceStorage requests.Integer `position:"Query" name:"DBInstanceStorage"` - ClientToken string `position:"Query" name:"ClientToken"` - ZoneIdSlave1 string `position:"Query" name:"ZoneIdSlave1"` - ZoneIdSlave2 string `position:"Query" name:"ZoneIdSlave2"` - ResourceGroupId string `position:"Query" name:"ResourceGroupId"` - TableMeta string `position:"Query" name:"TableMeta"` - DBInstanceDescription string `position:"Query" name:"DBInstanceDescription"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - DBInstanceStorageType string `position:"Query" name:"DBInstanceStorageType"` - DedicatedHostGroupId string `position:"Query" name:"DedicatedHostGroupId"` - BackupType string `position:"Query" name:"BackupType"` - RestoreTime string `position:"Query" name:"RestoreTime"` - Period string `position:"Query" name:"Period"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - BackupId string `position:"Query" name:"BackupId"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - RestoreTable string `position:"Query" name:"RestoreTable"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - UsedTime requests.Integer `position:"Query" name:"UsedTime"` - DBInstanceClass string `position:"Query" name:"DBInstanceClass"` - DbNames string `position:"Query" name:"DbNames"` - VSwitchId string `position:"Query" name:"VSwitchId"` - PrivateIpAddress string `position:"Query" name:"PrivateIpAddress"` - VPCId string `position:"Query" name:"VPCId"` - ZoneId string `position:"Query" name:"ZoneId"` - Category string `position:"Query" name:"Category"` - PayType string `position:"Query" name:"PayType"` - InstanceNetworkType string `position:"Query" name:"InstanceNetworkType"` -} - -// CloneDBInstanceResponse is the response struct for api CloneDBInstance -type CloneDBInstanceResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - OrderId string `json:"OrderId" xml:"OrderId"` - ConnectionString string `json:"ConnectionString" xml:"ConnectionString"` - Port string `json:"Port" xml:"Port"` -} - -// CreateCloneDBInstanceRequest creates a request to invoke CloneDBInstance API -func CreateCloneDBInstanceRequest() (request *CloneDBInstanceRequest) { - request = &CloneDBInstanceRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "CloneDBInstance", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateCloneDBInstanceResponse creates a response to parse from CloneDBInstance response -func CreateCloneDBInstanceResponse() (response *CloneDBInstanceResponse) { - response = &CloneDBInstanceResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/clone_parameter_group.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/clone_parameter_group.go deleted file mode 100644 index 1449cf32400..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/clone_parameter_group.go +++ /dev/null @@ -1,105 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// CloneParameterGroup invokes the rds.CloneParameterGroup API synchronously -func (client *Client) CloneParameterGroup(request *CloneParameterGroupRequest) (response *CloneParameterGroupResponse, err error) { - response = CreateCloneParameterGroupResponse() - err = client.DoAction(request, response) - return -} - -// CloneParameterGroupWithChan invokes the rds.CloneParameterGroup API asynchronously -func (client *Client) CloneParameterGroupWithChan(request *CloneParameterGroupRequest) (<-chan *CloneParameterGroupResponse, <-chan error) { - responseChan := make(chan *CloneParameterGroupResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.CloneParameterGroup(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// CloneParameterGroupWithCallback invokes the rds.CloneParameterGroup API asynchronously -func (client *Client) CloneParameterGroupWithCallback(request *CloneParameterGroupRequest, callback func(response *CloneParameterGroupResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *CloneParameterGroupResponse - var err error - defer close(result) - response, err = client.CloneParameterGroup(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// CloneParameterGroupRequest is the request struct for api CloneParameterGroup -type CloneParameterGroupRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ParameterGroupId string `position:"Query" name:"ParameterGroupId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - TargetRegionId string `position:"Query" name:"TargetRegionId"` - ParameterGroupName string `position:"Query" name:"ParameterGroupName"` - ParameterGroupDesc string `position:"Query" name:"ParameterGroupDesc"` -} - -// CloneParameterGroupResponse is the response struct for api CloneParameterGroup -type CloneParameterGroupResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateCloneParameterGroupRequest creates a request to invoke CloneParameterGroup API -func CreateCloneParameterGroupRequest() (request *CloneParameterGroupRequest) { - request = &CloneParameterGroupRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "CloneParameterGroup", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateCloneParameterGroupResponse creates a response to parse from CloneParameterGroup response -func CreateCloneParameterGroupResponse() (response *CloneParameterGroupResponse) { - response = &CloneParameterGroupResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/copy_database.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/copy_database.go deleted file mode 100644 index 52cd47f8d67..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/copy_database.go +++ /dev/null @@ -1,103 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// CopyDatabase invokes the rds.CopyDatabase API synchronously -func (client *Client) CopyDatabase(request *CopyDatabaseRequest) (response *CopyDatabaseResponse, err error) { - response = CreateCopyDatabaseResponse() - err = client.DoAction(request, response) - return -} - -// CopyDatabaseWithChan invokes the rds.CopyDatabase API asynchronously -func (client *Client) CopyDatabaseWithChan(request *CopyDatabaseRequest) (<-chan *CopyDatabaseResponse, <-chan error) { - responseChan := make(chan *CopyDatabaseResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.CopyDatabase(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// CopyDatabaseWithCallback invokes the rds.CopyDatabase API asynchronously -func (client *Client) CopyDatabaseWithCallback(request *CopyDatabaseRequest, callback func(response *CopyDatabaseResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *CopyDatabaseResponse - var err error - defer close(result) - response, err = client.CopyDatabase(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// CopyDatabaseRequest is the request struct for api CopyDatabase -type CopyDatabaseRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// CopyDatabaseResponse is the response struct for api CopyDatabase -type CopyDatabaseResponse struct { - *responses.BaseResponse - DBName string `json:"DBName" xml:"DBName"` - DBStatus string `json:"DBStatus" xml:"DBStatus"` - TaskId string `json:"TaskId" xml:"TaskId"` -} - -// CreateCopyDatabaseRequest creates a request to invoke CopyDatabase API -func CreateCopyDatabaseRequest() (request *CopyDatabaseRequest) { - request = &CopyDatabaseRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "CopyDatabase", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateCopyDatabaseResponse creates a response to parse from CopyDatabase response -func CreateCopyDatabaseResponse() (response *CopyDatabaseResponse) { - response = &CopyDatabaseResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/copy_database_between_instances.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/copy_database_between_instances.go deleted file mode 100644 index 99658185d7b..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/copy_database_between_instances.go +++ /dev/null @@ -1,112 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// CopyDatabaseBetweenInstances invokes the rds.CopyDatabaseBetweenInstances API synchronously -func (client *Client) CopyDatabaseBetweenInstances(request *CopyDatabaseBetweenInstancesRequest) (response *CopyDatabaseBetweenInstancesResponse, err error) { - response = CreateCopyDatabaseBetweenInstancesResponse() - err = client.DoAction(request, response) - return -} - -// CopyDatabaseBetweenInstancesWithChan invokes the rds.CopyDatabaseBetweenInstances API asynchronously -func (client *Client) CopyDatabaseBetweenInstancesWithChan(request *CopyDatabaseBetweenInstancesRequest) (<-chan *CopyDatabaseBetweenInstancesResponse, <-chan error) { - responseChan := make(chan *CopyDatabaseBetweenInstancesResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.CopyDatabaseBetweenInstances(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// CopyDatabaseBetweenInstancesWithCallback invokes the rds.CopyDatabaseBetweenInstances API asynchronously -func (client *Client) CopyDatabaseBetweenInstancesWithCallback(request *CopyDatabaseBetweenInstancesRequest, callback func(response *CopyDatabaseBetweenInstancesResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *CopyDatabaseBetweenInstancesResponse - var err error - defer close(result) - response, err = client.CopyDatabaseBetweenInstances(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// CopyDatabaseBetweenInstancesRequest is the request struct for api CopyDatabaseBetweenInstances -type CopyDatabaseBetweenInstancesRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ClientToken string `position:"Query" name:"ClientToken"` - ResourceGroupId string `position:"Query" name:"ResourceGroupId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - RestoreTime string `position:"Query" name:"RestoreTime"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - BackupId string `position:"Query" name:"BackupId"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - SyncUserPrivilege string `position:"Query" name:"SyncUserPrivilege"` - DbNames string `position:"Query" name:"DbNames"` - TargetDBInstanceId string `position:"Query" name:"TargetDBInstanceId"` - PayType string `position:"Query" name:"PayType"` -} - -// CopyDatabaseBetweenInstancesResponse is the response struct for api CopyDatabaseBetweenInstances -type CopyDatabaseBetweenInstancesResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` -} - -// CreateCopyDatabaseBetweenInstancesRequest creates a request to invoke CopyDatabaseBetweenInstances API -func CreateCopyDatabaseBetweenInstancesRequest() (request *CopyDatabaseBetweenInstancesRequest) { - request = &CopyDatabaseBetweenInstancesRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "CopyDatabaseBetweenInstances", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateCopyDatabaseBetweenInstancesResponse creates a response to parse from CopyDatabaseBetweenInstances response -func CreateCopyDatabaseBetweenInstancesResponse() (response *CopyDatabaseBetweenInstancesResponse) { - response = &CopyDatabaseBetweenInstancesResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_account.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_account.go deleted file mode 100644 index 09feec6236b..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_account.go +++ /dev/null @@ -1,107 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// CreateAccount invokes the rds.CreateAccount API synchronously -func (client *Client) CreateAccount(request *CreateAccountRequest) (response *CreateAccountResponse, err error) { - response = CreateCreateAccountResponse() - err = client.DoAction(request, response) - return -} - -// CreateAccountWithChan invokes the rds.CreateAccount API asynchronously -func (client *Client) CreateAccountWithChan(request *CreateAccountRequest) (<-chan *CreateAccountResponse, <-chan error) { - responseChan := make(chan *CreateAccountResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.CreateAccount(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// CreateAccountWithCallback invokes the rds.CreateAccount API asynchronously -func (client *Client) CreateAccountWithCallback(request *CreateAccountRequest, callback func(response *CreateAccountResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *CreateAccountResponse - var err error - defer close(result) - response, err = client.CreateAccount(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// CreateAccountRequest is the request struct for api CreateAccount -type CreateAccountRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - AccountType string `position:"Query" name:"AccountType"` - AccountDescription string `position:"Query" name:"AccountDescription"` - AccountName string `position:"Query" name:"AccountName"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - AccountPassword string `position:"Query" name:"AccountPassword"` -} - -// CreateAccountResponse is the response struct for api CreateAccount -type CreateAccountResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateCreateAccountRequest creates a request to invoke CreateAccount API -func CreateCreateAccountRequest() (request *CreateAccountRequest) { - request = &CreateAccountRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "CreateAccount", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateCreateAccountResponse creates a response to parse from CreateAccount response -func CreateCreateAccountResponse() (response *CreateAccountResponse) { - response = &CreateAccountResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_backup.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_backup.go deleted file mode 100644 index 728048e8065..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_backup.go +++ /dev/null @@ -1,108 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// CreateBackup invokes the rds.CreateBackup API synchronously -func (client *Client) CreateBackup(request *CreateBackupRequest) (response *CreateBackupResponse, err error) { - response = CreateCreateBackupResponse() - err = client.DoAction(request, response) - return -} - -// CreateBackupWithChan invokes the rds.CreateBackup API asynchronously -func (client *Client) CreateBackupWithChan(request *CreateBackupRequest) (<-chan *CreateBackupResponse, <-chan error) { - responseChan := make(chan *CreateBackupResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.CreateBackup(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// CreateBackupWithCallback invokes the rds.CreateBackup API asynchronously -func (client *Client) CreateBackupWithCallback(request *CreateBackupRequest, callback func(response *CreateBackupResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *CreateBackupResponse - var err error - defer close(result) - response, err = client.CreateBackup(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// CreateBackupRequest is the request struct for api CreateBackup -type CreateBackupRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - BackupStrategy string `position:"Query" name:"BackupStrategy"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - BackupType string `position:"Query" name:"BackupType"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - BackupMethod string `position:"Query" name:"BackupMethod"` - DBName string `position:"Query" name:"DBName"` -} - -// CreateBackupResponse is the response struct for api CreateBackup -type CreateBackupResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - BackupJobId string `json:"BackupJobId" xml:"BackupJobId"` -} - -// CreateCreateBackupRequest creates a request to invoke CreateBackup API -func CreateCreateBackupRequest() (request *CreateBackupRequest) { - request = &CreateBackupRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "CreateBackup", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateCreateBackupResponse creates a response to parse from CreateBackup response -func CreateCreateBackupResponse() (response *CreateBackupResponse) { - response = &CreateBackupResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_database.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_database.go deleted file mode 100644 index 8ccfeb1c627..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_database.go +++ /dev/null @@ -1,106 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// CreateDatabase invokes the rds.CreateDatabase API synchronously -func (client *Client) CreateDatabase(request *CreateDatabaseRequest) (response *CreateDatabaseResponse, err error) { - response = CreateCreateDatabaseResponse() - err = client.DoAction(request, response) - return -} - -// CreateDatabaseWithChan invokes the rds.CreateDatabase API asynchronously -func (client *Client) CreateDatabaseWithChan(request *CreateDatabaseRequest) (<-chan *CreateDatabaseResponse, <-chan error) { - responseChan := make(chan *CreateDatabaseResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.CreateDatabase(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// CreateDatabaseWithCallback invokes the rds.CreateDatabase API asynchronously -func (client *Client) CreateDatabaseWithCallback(request *CreateDatabaseRequest, callback func(response *CreateDatabaseResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *CreateDatabaseResponse - var err error - defer close(result) - response, err = client.CreateDatabase(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// CreateDatabaseRequest is the request struct for api CreateDatabase -type CreateDatabaseRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - DBDescription string `position:"Query" name:"DBDescription"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBName string `position:"Query" name:"DBName"` - CharacterSetName string `position:"Query" name:"CharacterSetName"` -} - -// CreateDatabaseResponse is the response struct for api CreateDatabase -type CreateDatabaseResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateCreateDatabaseRequest creates a request to invoke CreateDatabase API -func CreateCreateDatabaseRequest() (request *CreateDatabaseRequest) { - request = &CreateDatabaseRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "CreateDatabase", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateCreateDatabaseResponse creates a response to parse from CreateDatabase response -func CreateCreateDatabaseResponse() (response *CreateDatabaseResponse) { - response = &CreateDatabaseResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_db_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_db_instance.go deleted file mode 100644 index 1ca9b5da2ac..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_db_instance.go +++ /dev/null @@ -1,145 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// CreateDBInstance invokes the rds.CreateDBInstance API synchronously -func (client *Client) CreateDBInstance(request *CreateDBInstanceRequest) (response *CreateDBInstanceResponse, err error) { - response = CreateCreateDBInstanceResponse() - err = client.DoAction(request, response) - return -} - -// CreateDBInstanceWithChan invokes the rds.CreateDBInstance API asynchronously -func (client *Client) CreateDBInstanceWithChan(request *CreateDBInstanceRequest) (<-chan *CreateDBInstanceResponse, <-chan error) { - responseChan := make(chan *CreateDBInstanceResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.CreateDBInstance(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// CreateDBInstanceWithCallback invokes the rds.CreateDBInstance API asynchronously -func (client *Client) CreateDBInstanceWithCallback(request *CreateDBInstanceRequest, callback func(response *CreateDBInstanceResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *CreateDBInstanceResponse - var err error - defer close(result) - response, err = client.CreateDBInstance(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// CreateDBInstanceRequest is the request struct for api CreateDBInstance -type CreateDBInstanceRequest struct { - *requests.RpcRequest - DBParamGroupId string `position:"Query" name:"DBParamGroupId"` - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - DBInstanceStorage requests.Integer `position:"Query" name:"DBInstanceStorage"` - SystemDBCharset string `position:"Query" name:"SystemDBCharset"` - EngineVersion string `position:"Query" name:"EngineVersion"` - ResourceGroupId string `position:"Query" name:"ResourceGroupId"` - TargetDedicatedHostIdForMaster string `position:"Query" name:"TargetDedicatedHostIdForMaster"` - DBInstanceDescription string `position:"Query" name:"DBInstanceDescription"` - BusinessInfo string `position:"Query" name:"BusinessInfo"` - Period string `position:"Query" name:"Period"` - EncryptionKey string `position:"Query" name:"EncryptionKey"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceClass string `position:"Query" name:"DBInstanceClass"` - SecurityIPList string `position:"Query" name:"SecurityIPList"` - VSwitchId string `position:"Query" name:"VSwitchId"` - PrivateIpAddress string `position:"Query" name:"PrivateIpAddress"` - TargetDedicatedHostIdForLog string `position:"Query" name:"TargetDedicatedHostIdForLog"` - AutoRenew string `position:"Query" name:"AutoRenew"` - RoleARN string `position:"Query" name:"RoleARN"` - TunnelId string `position:"Query" name:"TunnelId"` - ZoneId string `position:"Query" name:"ZoneId"` - StorageAutoScale string `position:"Query" name:"StorageAutoScale"` - InstanceNetworkType string `position:"Query" name:"InstanceNetworkType"` - ConnectionMode string `position:"Query" name:"ConnectionMode"` - ClientToken string `position:"Query" name:"ClientToken"` - TargetDedicatedHostIdForSlave string `position:"Query" name:"TargetDedicatedHostIdForSlave"` - ZoneIdSlave1 string `position:"Query" name:"ZoneIdSlave1"` - ZoneIdSlave2 string `position:"Query" name:"ZoneIdSlave2"` - DBIsIgnoreCase string `position:"Query" name:"DBIsIgnoreCase"` - Engine string `position:"Query" name:"Engine"` - DBTimeZone string `position:"Query" name:"DBTimeZone"` - DBInstanceStorageType string `position:"Query" name:"DBInstanceStorageType"` - DedicatedHostGroupId string `position:"Query" name:"DedicatedHostGroupId"` - DBInstanceNetType string `position:"Query" name:"DBInstanceNetType"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - UsedTime string `position:"Query" name:"UsedTime"` - TargetMinorVersion string `position:"Query" name:"TargetMinorVersion"` - StorageUpperBound requests.Integer `position:"Query" name:"StorageUpperBound"` - StorageThreshold requests.Integer `position:"Query" name:"StorageThreshold"` - VPCId string `position:"Query" name:"VPCId"` - Category string `position:"Query" name:"Category"` - PayType string `position:"Query" name:"PayType"` -} - -// CreateDBInstanceResponse is the response struct for api CreateDBInstance -type CreateDBInstanceResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - OrderId string `json:"OrderId" xml:"OrderId"` - ConnectionString string `json:"ConnectionString" xml:"ConnectionString"` - Port string `json:"Port" xml:"Port"` -} - -// CreateCreateDBInstanceRequest creates a request to invoke CreateDBInstance API -func CreateCreateDBInstanceRequest() (request *CreateDBInstanceRequest) { - request = &CreateDBInstanceRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "CreateDBInstance", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateCreateDBInstanceResponse creates a response to parse from CreateDBInstance response -func CreateCreateDBInstanceResponse() (response *CreateDBInstanceResponse) { - response = &CreateDBInstanceResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_db_proxy_endpoint_address.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_db_proxy_endpoint_address.go deleted file mode 100644 index a788c413960..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_db_proxy_endpoint_address.go +++ /dev/null @@ -1,105 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// CreateDBProxyEndpointAddress invokes the rds.CreateDBProxyEndpointAddress API synchronously -func (client *Client) CreateDBProxyEndpointAddress(request *CreateDBProxyEndpointAddressRequest) (response *CreateDBProxyEndpointAddressResponse, err error) { - response = CreateCreateDBProxyEndpointAddressResponse() - err = client.DoAction(request, response) - return -} - -// CreateDBProxyEndpointAddressWithChan invokes the rds.CreateDBProxyEndpointAddress API asynchronously -func (client *Client) CreateDBProxyEndpointAddressWithChan(request *CreateDBProxyEndpointAddressRequest) (<-chan *CreateDBProxyEndpointAddressResponse, <-chan error) { - responseChan := make(chan *CreateDBProxyEndpointAddressResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.CreateDBProxyEndpointAddress(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// CreateDBProxyEndpointAddressWithCallback invokes the rds.CreateDBProxyEndpointAddress API asynchronously -func (client *Client) CreateDBProxyEndpointAddressWithCallback(request *CreateDBProxyEndpointAddressRequest, callback func(response *CreateDBProxyEndpointAddressResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *CreateDBProxyEndpointAddressResponse - var err error - defer close(result) - response, err = client.CreateDBProxyEndpointAddress(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// CreateDBProxyEndpointAddressRequest is the request struct for api CreateDBProxyEndpointAddress -type CreateDBProxyEndpointAddressRequest struct { - *requests.RpcRequest - ConnectionStringPrefix string `position:"Query" name:"ConnectionStringPrefix"` - DBProxyConnectStringNetType string `position:"Query" name:"DBProxyConnectStringNetType"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - DBProxyNewConnectStringPort string `position:"Query" name:"DBProxyNewConnectStringPort"` - VSwitchId string `position:"Query" name:"VSwitchId"` - DBProxyEndpointId string `position:"Query" name:"DBProxyEndpointId"` - VPCId string `position:"Query" name:"VPCId"` -} - -// CreateDBProxyEndpointAddressResponse is the response struct for api CreateDBProxyEndpointAddress -type CreateDBProxyEndpointAddressResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateCreateDBProxyEndpointAddressRequest creates a request to invoke CreateDBProxyEndpointAddress API -func CreateCreateDBProxyEndpointAddressRequest() (request *CreateDBProxyEndpointAddressRequest) { - request = &CreateDBProxyEndpointAddressRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "CreateDBProxyEndpointAddress", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateCreateDBProxyEndpointAddressResponse creates a response to parse from CreateDBProxyEndpointAddress response -func CreateCreateDBProxyEndpointAddressResponse() (response *CreateDBProxyEndpointAddressResponse) { - response = &CreateDBProxyEndpointAddressResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_ddr_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_ddr_instance.go deleted file mode 100644 index bd837fd46c7..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_ddr_instance.go +++ /dev/null @@ -1,140 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// CreateDdrInstance invokes the rds.CreateDdrInstance API synchronously -func (client *Client) CreateDdrInstance(request *CreateDdrInstanceRequest) (response *CreateDdrInstanceResponse, err error) { - response = CreateCreateDdrInstanceResponse() - err = client.DoAction(request, response) - return -} - -// CreateDdrInstanceWithChan invokes the rds.CreateDdrInstance API asynchronously -func (client *Client) CreateDdrInstanceWithChan(request *CreateDdrInstanceRequest) (<-chan *CreateDdrInstanceResponse, <-chan error) { - responseChan := make(chan *CreateDdrInstanceResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.CreateDdrInstance(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// CreateDdrInstanceWithCallback invokes the rds.CreateDdrInstance API asynchronously -func (client *Client) CreateDdrInstanceWithCallback(request *CreateDdrInstanceRequest, callback func(response *CreateDdrInstanceResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *CreateDdrInstanceResponse - var err error - defer close(result) - response, err = client.CreateDdrInstance(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// CreateDdrInstanceRequest is the request struct for api CreateDdrInstance -type CreateDdrInstanceRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - DBInstanceStorage requests.Integer `position:"Query" name:"DBInstanceStorage"` - SystemDBCharset string `position:"Query" name:"SystemDBCharset"` - BinlogRole string `position:"Query" name:"BinlogRole"` - EngineVersion string `position:"Query" name:"EngineVersion"` - UserBakSetURL string `position:"Query" name:"UserBakSetURL"` - ResourceGroupId string `position:"Query" name:"ResourceGroupId"` - DBInstanceDescription string `position:"Query" name:"DBInstanceDescription"` - BackupSetRegion string `position:"Query" name:"BackupSetRegion"` - Period string `position:"Query" name:"Period"` - BackupSetId string `position:"Query" name:"BackupSetId"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceClass string `position:"Query" name:"DBInstanceClass"` - SecurityIPList string `position:"Query" name:"SecurityIPList"` - VSwitchId string `position:"Query" name:"VSwitchId"` - PrivateIpAddress string `position:"Query" name:"PrivateIpAddress"` - BinlogName string `position:"Query" name:"BinlogName"` - TunnelId string `position:"Query" name:"TunnelId"` - ZoneId string `position:"Query" name:"ZoneId"` - InstanceNetworkType string `position:"Query" name:"InstanceNetworkType"` - ConnectionMode string `position:"Query" name:"ConnectionMode"` - SourceDBInstanceName string `position:"Query" name:"SourceDBInstanceName"` - ClientToken string `position:"Query" name:"ClientToken"` - HostType string `position:"Query" name:"HostType"` - Engine string `position:"Query" name:"Engine"` - DBInstanceStorageType string `position:"Query" name:"DBInstanceStorageType"` - DBInstanceNetType string `position:"Query" name:"DBInstanceNetType"` - BackupSetType string `position:"Query" name:"BackupSetType"` - RestoreTime string `position:"Query" name:"RestoreTime"` - BakSetName string `position:"Query" name:"BakSetName"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - UsedTime string `position:"Query" name:"UsedTime"` - BinlogPosition string `position:"Query" name:"BinlogPosition"` - RestoreType string `position:"Query" name:"RestoreType"` - VPCId string `position:"Query" name:"VPCId"` - PayType string `position:"Query" name:"PayType"` - SourceRegion string `position:"Query" name:"SourceRegion"` -} - -// CreateDdrInstanceResponse is the response struct for api CreateDdrInstance -type CreateDdrInstanceResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - OrderId string `json:"OrderId" xml:"OrderId"` - ConnectionString string `json:"ConnectionString" xml:"ConnectionString"` - Port string `json:"Port" xml:"Port"` -} - -// CreateCreateDdrInstanceRequest creates a request to invoke CreateDdrInstance API -func CreateCreateDdrInstanceRequest() (request *CreateDdrInstanceRequest) { - request = &CreateDdrInstanceRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "CreateDdrInstance", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateCreateDdrInstanceResponse creates a response to parse from CreateDdrInstance response -func CreateCreateDdrInstanceResponse() (response *CreateDdrInstanceResponse) { - response = &CreateDdrInstanceResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_diagnostic_report.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_diagnostic_report.go deleted file mode 100644 index cab5d67cfe4..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_diagnostic_report.go +++ /dev/null @@ -1,103 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// CreateDiagnosticReport invokes the rds.CreateDiagnosticReport API synchronously -func (client *Client) CreateDiagnosticReport(request *CreateDiagnosticReportRequest) (response *CreateDiagnosticReportResponse, err error) { - response = CreateCreateDiagnosticReportResponse() - err = client.DoAction(request, response) - return -} - -// CreateDiagnosticReportWithChan invokes the rds.CreateDiagnosticReport API asynchronously -func (client *Client) CreateDiagnosticReportWithChan(request *CreateDiagnosticReportRequest) (<-chan *CreateDiagnosticReportResponse, <-chan error) { - responseChan := make(chan *CreateDiagnosticReportResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.CreateDiagnosticReport(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// CreateDiagnosticReportWithCallback invokes the rds.CreateDiagnosticReport API asynchronously -func (client *Client) CreateDiagnosticReportWithCallback(request *CreateDiagnosticReportRequest, callback func(response *CreateDiagnosticReportResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *CreateDiagnosticReportResponse - var err error - defer close(result) - response, err = client.CreateDiagnosticReport(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// CreateDiagnosticReportRequest is the request struct for api CreateDiagnosticReport -type CreateDiagnosticReportRequest struct { - *requests.RpcRequest - EndTime string `position:"Query" name:"EndTime"` - StartTime string `position:"Query" name:"StartTime"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - Category string `position:"Query" name:"Category"` -} - -// CreateDiagnosticReportResponse is the response struct for api CreateDiagnosticReport -type CreateDiagnosticReportResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - ReportId string `json:"ReportId" xml:"ReportId"` -} - -// CreateCreateDiagnosticReportRequest creates a request to invoke CreateDiagnosticReport API -func CreateCreateDiagnosticReportRequest() (request *CreateDiagnosticReportRequest) { - request = &CreateDiagnosticReportRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "CreateDiagnosticReport", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateCreateDiagnosticReportResponse creates a response to parse from CreateDiagnosticReport response -func CreateCreateDiagnosticReportResponse() (response *CreateDiagnosticReportResponse) { - response = &CreateDiagnosticReportResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_migrate_task.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_migrate_task.go deleted file mode 100644 index 5ddc1710666..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_migrate_task.go +++ /dev/null @@ -1,114 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// CreateMigrateTask invokes the rds.CreateMigrateTask API synchronously -func (client *Client) CreateMigrateTask(request *CreateMigrateTaskRequest) (response *CreateMigrateTaskResponse, err error) { - response = CreateCreateMigrateTaskResponse() - err = client.DoAction(request, response) - return -} - -// CreateMigrateTaskWithChan invokes the rds.CreateMigrateTask API asynchronously -func (client *Client) CreateMigrateTaskWithChan(request *CreateMigrateTaskRequest) (<-chan *CreateMigrateTaskResponse, <-chan error) { - responseChan := make(chan *CreateMigrateTaskResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.CreateMigrateTask(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// CreateMigrateTaskWithCallback invokes the rds.CreateMigrateTask API asynchronously -func (client *Client) CreateMigrateTaskWithCallback(request *CreateMigrateTaskRequest, callback func(response *CreateMigrateTaskResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *CreateMigrateTaskResponse - var err error - defer close(result) - response, err = client.CreateMigrateTask(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// CreateMigrateTaskRequest is the request struct for api CreateMigrateTask -type CreateMigrateTaskRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - IsOnlineDB string `position:"Query" name:"IsOnlineDB"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - MigrateTaskId string `position:"Query" name:"MigrateTaskId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - OssObjectPositions string `position:"Query" name:"OssObjectPositions"` - OSSUrls string `position:"Query" name:"OSSUrls"` - DBName string `position:"Query" name:"DBName"` - BackupMode string `position:"Query" name:"BackupMode"` - CheckDBMode string `position:"Query" name:"CheckDBMode"` -} - -// CreateMigrateTaskResponse is the response struct for api CreateMigrateTask -type CreateMigrateTaskResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - TaskId string `json:"TaskId" xml:"TaskId"` - DBName string `json:"DBName" xml:"DBName"` - MigrateTaskId string `json:"MigrateTaskId" xml:"MigrateTaskId"` - BackupMode string `json:"BackupMode" xml:"BackupMode"` -} - -// CreateCreateMigrateTaskRequest creates a request to invoke CreateMigrateTask API -func CreateCreateMigrateTaskRequest() (request *CreateMigrateTaskRequest) { - request = &CreateMigrateTaskRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "CreateMigrateTask", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateCreateMigrateTaskResponse creates a response to parse from CreateMigrateTask response -func CreateCreateMigrateTaskResponse() (response *CreateMigrateTaskResponse) { - response = &CreateMigrateTaskResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_migrate_task_for_sql_server.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_migrate_task_for_sql_server.go deleted file mode 100644 index a951475286c..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_migrate_task_for_sql_server.go +++ /dev/null @@ -1,112 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// CreateMigrateTaskForSQLServer invokes the rds.CreateMigrateTaskForSQLServer API synchronously -func (client *Client) CreateMigrateTaskForSQLServer(request *CreateMigrateTaskForSQLServerRequest) (response *CreateMigrateTaskForSQLServerResponse, err error) { - response = CreateCreateMigrateTaskForSQLServerResponse() - err = client.DoAction(request, response) - return -} - -// CreateMigrateTaskForSQLServerWithChan invokes the rds.CreateMigrateTaskForSQLServer API asynchronously -func (client *Client) CreateMigrateTaskForSQLServerWithChan(request *CreateMigrateTaskForSQLServerRequest) (<-chan *CreateMigrateTaskForSQLServerResponse, <-chan error) { - responseChan := make(chan *CreateMigrateTaskForSQLServerResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.CreateMigrateTaskForSQLServer(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// CreateMigrateTaskForSQLServerWithCallback invokes the rds.CreateMigrateTaskForSQLServer API asynchronously -func (client *Client) CreateMigrateTaskForSQLServerWithCallback(request *CreateMigrateTaskForSQLServerRequest, callback func(response *CreateMigrateTaskForSQLServerResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *CreateMigrateTaskForSQLServerResponse - var err error - defer close(result) - response, err = client.CreateMigrateTaskForSQLServer(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// CreateMigrateTaskForSQLServerRequest is the request struct for api CreateMigrateTaskForSQLServer -type CreateMigrateTaskForSQLServerRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - IsOnlineDB string `position:"Query" name:"IsOnlineDB"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - TaskType string `position:"Query" name:"TaskType"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - OSSUrls string `position:"Query" name:"OSSUrls"` - DBName string `position:"Query" name:"DBName"` -} - -// CreateMigrateTaskForSQLServerResponse is the response struct for api CreateMigrateTaskForSQLServer -type CreateMigrateTaskForSQLServerResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - DBInstanceName string `json:"DBInstanceName" xml:"DBInstanceName"` - TaskId string `json:"TaskId" xml:"TaskId"` - DBName string `json:"DBName" xml:"DBName"` - MigrateIaskId string `json:"MigrateIaskId" xml:"MigrateIaskId"` - TaskType string `json:"TaskType" xml:"TaskType"` -} - -// CreateCreateMigrateTaskForSQLServerRequest creates a request to invoke CreateMigrateTaskForSQLServer API -func CreateCreateMigrateTaskForSQLServerRequest() (request *CreateMigrateTaskForSQLServerRequest) { - request = &CreateMigrateTaskForSQLServerRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "CreateMigrateTaskForSQLServer", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateCreateMigrateTaskForSQLServerResponse creates a response to parse from CreateMigrateTaskForSQLServer response -func CreateCreateMigrateTaskForSQLServerResponse() (response *CreateMigrateTaskForSQLServerResponse) { - response = &CreateMigrateTaskForSQLServerResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_online_database_task.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_online_database_task.go deleted file mode 100644 index f47b806af1b..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_online_database_task.go +++ /dev/null @@ -1,107 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// CreateOnlineDatabaseTask invokes the rds.CreateOnlineDatabaseTask API synchronously -func (client *Client) CreateOnlineDatabaseTask(request *CreateOnlineDatabaseTaskRequest) (response *CreateOnlineDatabaseTaskResponse, err error) { - response = CreateCreateOnlineDatabaseTaskResponse() - err = client.DoAction(request, response) - return -} - -// CreateOnlineDatabaseTaskWithChan invokes the rds.CreateOnlineDatabaseTask API asynchronously -func (client *Client) CreateOnlineDatabaseTaskWithChan(request *CreateOnlineDatabaseTaskRequest) (<-chan *CreateOnlineDatabaseTaskResponse, <-chan error) { - responseChan := make(chan *CreateOnlineDatabaseTaskResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.CreateOnlineDatabaseTask(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// CreateOnlineDatabaseTaskWithCallback invokes the rds.CreateOnlineDatabaseTask API asynchronously -func (client *Client) CreateOnlineDatabaseTaskWithCallback(request *CreateOnlineDatabaseTaskRequest, callback func(response *CreateOnlineDatabaseTaskResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *CreateOnlineDatabaseTaskResponse - var err error - defer close(result) - response, err = client.CreateOnlineDatabaseTask(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// CreateOnlineDatabaseTaskRequest is the request struct for api CreateOnlineDatabaseTask -type CreateOnlineDatabaseTaskRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ClientToken string `position:"Query" name:"ClientToken"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - MigrateTaskId string `position:"Query" name:"MigrateTaskId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBName string `position:"Query" name:"DBName"` - CheckDBMode string `position:"Query" name:"CheckDBMode"` -} - -// CreateOnlineDatabaseTaskResponse is the response struct for api CreateOnlineDatabaseTask -type CreateOnlineDatabaseTaskResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateCreateOnlineDatabaseTaskRequest creates a request to invoke CreateOnlineDatabaseTask API -func CreateCreateOnlineDatabaseTaskRequest() (request *CreateOnlineDatabaseTaskRequest) { - request = &CreateOnlineDatabaseTaskRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "CreateOnlineDatabaseTask", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateCreateOnlineDatabaseTaskResponse creates a response to parse from CreateOnlineDatabaseTask response -func CreateCreateOnlineDatabaseTaskResponse() (response *CreateOnlineDatabaseTaskResponse) { - response = &CreateOnlineDatabaseTaskResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_parameter_group.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_parameter_group.go deleted file mode 100644 index 22c7ce137f2..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_parameter_group.go +++ /dev/null @@ -1,107 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// CreateParameterGroup invokes the rds.CreateParameterGroup API synchronously -func (client *Client) CreateParameterGroup(request *CreateParameterGroupRequest) (response *CreateParameterGroupResponse, err error) { - response = CreateCreateParameterGroupResponse() - err = client.DoAction(request, response) - return -} - -// CreateParameterGroupWithChan invokes the rds.CreateParameterGroup API asynchronously -func (client *Client) CreateParameterGroupWithChan(request *CreateParameterGroupRequest) (<-chan *CreateParameterGroupResponse, <-chan error) { - responseChan := make(chan *CreateParameterGroupResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.CreateParameterGroup(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// CreateParameterGroupWithCallback invokes the rds.CreateParameterGroup API asynchronously -func (client *Client) CreateParameterGroupWithCallback(request *CreateParameterGroupRequest, callback func(response *CreateParameterGroupResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *CreateParameterGroupResponse - var err error - defer close(result) - response, err = client.CreateParameterGroup(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// CreateParameterGroupRequest is the request struct for api CreateParameterGroup -type CreateParameterGroupRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - EngineVersion string `position:"Query" name:"EngineVersion"` - Engine string `position:"Query" name:"Engine"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - ParameterGroupName string `position:"Query" name:"ParameterGroupName"` - Parameters string `position:"Query" name:"Parameters"` - ParameterGroupDesc string `position:"Query" name:"ParameterGroupDesc"` -} - -// CreateParameterGroupResponse is the response struct for api CreateParameterGroup -type CreateParameterGroupResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - ParameterGroupId string `json:"ParameterGroupId" xml:"ParameterGroupId"` -} - -// CreateCreateParameterGroupRequest creates a request to invoke CreateParameterGroup API -func CreateCreateParameterGroupRequest() (request *CreateParameterGroupRequest) { - request = &CreateParameterGroupRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "CreateParameterGroup", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateCreateParameterGroupResponse creates a response to parse from CreateParameterGroup response -func CreateCreateParameterGroupResponse() (response *CreateParameterGroupResponse) { - response = &CreateParameterGroupResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_read_only_db_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_read_only_db_instance.go deleted file mode 100644 index 1ddb90fdb5a..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_read_only_db_instance.go +++ /dev/null @@ -1,130 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// CreateReadOnlyDBInstance invokes the rds.CreateReadOnlyDBInstance API synchronously -func (client *Client) CreateReadOnlyDBInstance(request *CreateReadOnlyDBInstanceRequest) (response *CreateReadOnlyDBInstanceResponse, err error) { - response = CreateCreateReadOnlyDBInstanceResponse() - err = client.DoAction(request, response) - return -} - -// CreateReadOnlyDBInstanceWithChan invokes the rds.CreateReadOnlyDBInstance API asynchronously -func (client *Client) CreateReadOnlyDBInstanceWithChan(request *CreateReadOnlyDBInstanceRequest) (<-chan *CreateReadOnlyDBInstanceResponse, <-chan error) { - responseChan := make(chan *CreateReadOnlyDBInstanceResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.CreateReadOnlyDBInstance(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// CreateReadOnlyDBInstanceWithCallback invokes the rds.CreateReadOnlyDBInstance API asynchronously -func (client *Client) CreateReadOnlyDBInstanceWithCallback(request *CreateReadOnlyDBInstanceRequest, callback func(response *CreateReadOnlyDBInstanceResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *CreateReadOnlyDBInstanceResponse - var err error - defer close(result) - response, err = client.CreateReadOnlyDBInstance(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// CreateReadOnlyDBInstanceRequest is the request struct for api CreateReadOnlyDBInstance -type CreateReadOnlyDBInstanceRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - DBInstanceStorage requests.Integer `position:"Query" name:"DBInstanceStorage"` - ClientToken string `position:"Query" name:"ClientToken"` - InstructionSetArch string `position:"Query" name:"InstructionSetArch"` - EngineVersion string `position:"Query" name:"EngineVersion"` - ResourceGroupId string `position:"Query" name:"ResourceGroupId"` - TddlRegionConfig string `position:"Query" name:"TddlRegionConfig"` - TargetDedicatedHostIdForMaster string `position:"Query" name:"TargetDedicatedHostIdForMaster"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - DBInstanceDescription string `position:"Query" name:"DBInstanceDescription"` - GdnInstanceName string `position:"Query" name:"GdnInstanceName"` - DBInstanceStorageType string `position:"Query" name:"DBInstanceStorageType"` - DedicatedHostGroupId string `position:"Query" name:"DedicatedHostGroupId"` - TddlBizType string `position:"Query" name:"TddlBizType"` - Period string `position:"Query" name:"Period"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - UsedTime string `position:"Query" name:"UsedTime"` - DBInstanceClass string `position:"Query" name:"DBInstanceClass"` - VSwitchId string `position:"Query" name:"VSwitchId"` - PrivateIpAddress string `position:"Query" name:"PrivateIpAddress"` - AutoRenew string `position:"Query" name:"AutoRenew"` - VPCId string `position:"Query" name:"VPCId"` - ZoneId string `position:"Query" name:"ZoneId"` - Category string `position:"Query" name:"Category"` - PayType string `position:"Query" name:"PayType"` - InstanceNetworkType string `position:"Query" name:"InstanceNetworkType"` -} - -// CreateReadOnlyDBInstanceResponse is the response struct for api CreateReadOnlyDBInstance -type CreateReadOnlyDBInstanceResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - OrderId string `json:"OrderId" xml:"OrderId"` - ConnectionString string `json:"ConnectionString" xml:"ConnectionString"` - Port string `json:"Port" xml:"Port"` -} - -// CreateCreateReadOnlyDBInstanceRequest creates a request to invoke CreateReadOnlyDBInstance API -func CreateCreateReadOnlyDBInstanceRequest() (request *CreateReadOnlyDBInstanceRequest) { - request = &CreateReadOnlyDBInstanceRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "CreateReadOnlyDBInstance", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateCreateReadOnlyDBInstanceResponse creates a response to parse from CreateReadOnlyDBInstance response -func CreateCreateReadOnlyDBInstanceResponse() (response *CreateReadOnlyDBInstanceResponse) { - response = &CreateReadOnlyDBInstanceResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_temp_db_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_temp_db_instance.go deleted file mode 100644 index f858cfbb805..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/create_temp_db_instance.go +++ /dev/null @@ -1,106 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// CreateTempDBInstance invokes the rds.CreateTempDBInstance API synchronously -func (client *Client) CreateTempDBInstance(request *CreateTempDBInstanceRequest) (response *CreateTempDBInstanceResponse, err error) { - response = CreateCreateTempDBInstanceResponse() - err = client.DoAction(request, response) - return -} - -// CreateTempDBInstanceWithChan invokes the rds.CreateTempDBInstance API asynchronously -func (client *Client) CreateTempDBInstanceWithChan(request *CreateTempDBInstanceRequest) (<-chan *CreateTempDBInstanceResponse, <-chan error) { - responseChan := make(chan *CreateTempDBInstanceResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.CreateTempDBInstance(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// CreateTempDBInstanceWithCallback invokes the rds.CreateTempDBInstance API asynchronously -func (client *Client) CreateTempDBInstanceWithCallback(request *CreateTempDBInstanceRequest, callback func(response *CreateTempDBInstanceResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *CreateTempDBInstanceResponse - var err error - defer close(result) - response, err = client.CreateTempDBInstance(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// CreateTempDBInstanceRequest is the request struct for api CreateTempDBInstance -type CreateTempDBInstanceRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - RestoreTime string `position:"Query" name:"RestoreTime"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - BackupId requests.Integer `position:"Query" name:"BackupId"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// CreateTempDBInstanceResponse is the response struct for api CreateTempDBInstance -type CreateTempDBInstanceResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - TempDBInstanceId string `json:"TempDBInstanceId" xml:"TempDBInstanceId"` -} - -// CreateCreateTempDBInstanceRequest creates a request to invoke CreateTempDBInstance API -func CreateCreateTempDBInstanceRequest() (request *CreateTempDBInstanceRequest) { - request = &CreateTempDBInstanceRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "CreateTempDBInstance", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateCreateTempDBInstanceResponse creates a response to parse from CreateTempDBInstance response -func CreateCreateTempDBInstanceResponse() (response *CreateTempDBInstanceResponse) { - response = &CreateTempDBInstanceResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/delete_account.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/delete_account.go deleted file mode 100644 index f59ff46f649..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/delete_account.go +++ /dev/null @@ -1,104 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DeleteAccount invokes the rds.DeleteAccount API synchronously -func (client *Client) DeleteAccount(request *DeleteAccountRequest) (response *DeleteAccountResponse, err error) { - response = CreateDeleteAccountResponse() - err = client.DoAction(request, response) - return -} - -// DeleteAccountWithChan invokes the rds.DeleteAccount API asynchronously -func (client *Client) DeleteAccountWithChan(request *DeleteAccountRequest) (<-chan *DeleteAccountResponse, <-chan error) { - responseChan := make(chan *DeleteAccountResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DeleteAccount(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DeleteAccountWithCallback invokes the rds.DeleteAccount API asynchronously -func (client *Client) DeleteAccountWithCallback(request *DeleteAccountRequest, callback func(response *DeleteAccountResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DeleteAccountResponse - var err error - defer close(result) - response, err = client.DeleteAccount(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DeleteAccountRequest is the request struct for api DeleteAccount -type DeleteAccountRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - AccountName string `position:"Query" name:"AccountName"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// DeleteAccountResponse is the response struct for api DeleteAccount -type DeleteAccountResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateDeleteAccountRequest creates a request to invoke DeleteAccount API -func CreateDeleteAccountRequest() (request *DeleteAccountRequest) { - request = &DeleteAccountRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DeleteAccount", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDeleteAccountResponse creates a response to parse from DeleteAccount response -func CreateDeleteAccountResponse() (response *DeleteAccountResponse) { - response = &DeleteAccountResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/delete_backup.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/delete_backup.go deleted file mode 100644 index d25279ea547..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/delete_backup.go +++ /dev/null @@ -1,104 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DeleteBackup invokes the rds.DeleteBackup API synchronously -func (client *Client) DeleteBackup(request *DeleteBackupRequest) (response *DeleteBackupResponse, err error) { - response = CreateDeleteBackupResponse() - err = client.DoAction(request, response) - return -} - -// DeleteBackupWithChan invokes the rds.DeleteBackup API asynchronously -func (client *Client) DeleteBackupWithChan(request *DeleteBackupRequest) (<-chan *DeleteBackupResponse, <-chan error) { - responseChan := make(chan *DeleteBackupResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DeleteBackup(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DeleteBackupWithCallback invokes the rds.DeleteBackup API asynchronously -func (client *Client) DeleteBackupWithCallback(request *DeleteBackupRequest, callback func(response *DeleteBackupResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DeleteBackupResponse - var err error - defer close(result) - response, err = client.DeleteBackup(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DeleteBackupRequest is the request struct for api DeleteBackup -type DeleteBackupRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - BackupId string `position:"Query" name:"BackupId"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// DeleteBackupResponse is the response struct for api DeleteBackup -type DeleteBackupResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateDeleteBackupRequest creates a request to invoke DeleteBackup API -func CreateDeleteBackupRequest() (request *DeleteBackupRequest) { - request = &DeleteBackupRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DeleteBackup", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDeleteBackupResponse creates a response to parse from DeleteBackup response -func CreateDeleteBackupResponse() (response *DeleteBackupResponse) { - response = &DeleteBackupResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/delete_backup_file.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/delete_backup_file.go deleted file mode 100644 index 125f7feebf6..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/delete_backup_file.go +++ /dev/null @@ -1,106 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DeleteBackupFile invokes the rds.DeleteBackupFile API synchronously -func (client *Client) DeleteBackupFile(request *DeleteBackupFileRequest) (response *DeleteBackupFileResponse, err error) { - response = CreateDeleteBackupFileResponse() - err = client.DoAction(request, response) - return -} - -// DeleteBackupFileWithChan invokes the rds.DeleteBackupFile API asynchronously -func (client *Client) DeleteBackupFileWithChan(request *DeleteBackupFileRequest) (<-chan *DeleteBackupFileResponse, <-chan error) { - responseChan := make(chan *DeleteBackupFileResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DeleteBackupFile(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DeleteBackupFileWithCallback invokes the rds.DeleteBackupFile API asynchronously -func (client *Client) DeleteBackupFileWithCallback(request *DeleteBackupFileRequest, callback func(response *DeleteBackupFileResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DeleteBackupFileResponse - var err error - defer close(result) - response, err = client.DeleteBackupFile(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DeleteBackupFileRequest is the request struct for api DeleteBackupFile -type DeleteBackupFileRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - BackupId string `position:"Query" name:"BackupId"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - BackupTime string `position:"Query" name:"BackupTime"` - DBName string `position:"Query" name:"DBName"` -} - -// DeleteBackupFileResponse is the response struct for api DeleteBackupFile -type DeleteBackupFileResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DeletedBaksetIds DeletedBaksetIds `json:"DeletedBaksetIds" xml:"DeletedBaksetIds"` -} - -// CreateDeleteBackupFileRequest creates a request to invoke DeleteBackupFile API -func CreateDeleteBackupFileRequest() (request *DeleteBackupFileRequest) { - request = &DeleteBackupFileRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DeleteBackupFile", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDeleteBackupFileResponse creates a response to parse from DeleteBackupFile response -func CreateDeleteBackupFileResponse() (response *DeleteBackupFileResponse) { - response = &DeleteBackupFileResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/delete_database.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/delete_database.go deleted file mode 100644 index 599aca5da24..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/delete_database.go +++ /dev/null @@ -1,104 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DeleteDatabase invokes the rds.DeleteDatabase API synchronously -func (client *Client) DeleteDatabase(request *DeleteDatabaseRequest) (response *DeleteDatabaseResponse, err error) { - response = CreateDeleteDatabaseResponse() - err = client.DoAction(request, response) - return -} - -// DeleteDatabaseWithChan invokes the rds.DeleteDatabase API asynchronously -func (client *Client) DeleteDatabaseWithChan(request *DeleteDatabaseRequest) (<-chan *DeleteDatabaseResponse, <-chan error) { - responseChan := make(chan *DeleteDatabaseResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DeleteDatabase(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DeleteDatabaseWithCallback invokes the rds.DeleteDatabase API asynchronously -func (client *Client) DeleteDatabaseWithCallback(request *DeleteDatabaseRequest, callback func(response *DeleteDatabaseResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DeleteDatabaseResponse - var err error - defer close(result) - response, err = client.DeleteDatabase(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DeleteDatabaseRequest is the request struct for api DeleteDatabase -type DeleteDatabaseRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBName string `position:"Query" name:"DBName"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// DeleteDatabaseResponse is the response struct for api DeleteDatabase -type DeleteDatabaseResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateDeleteDatabaseRequest creates a request to invoke DeleteDatabase API -func CreateDeleteDatabaseRequest() (request *DeleteDatabaseRequest) { - request = &DeleteDatabaseRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DeleteDatabase", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDeleteDatabaseResponse creates a response to parse from DeleteDatabase response -func CreateDeleteDatabaseResponse() (response *DeleteDatabaseResponse) { - response = &DeleteDatabaseResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/delete_db_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/delete_db_instance.go deleted file mode 100644 index 2d8c2d45188..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/delete_db_instance.go +++ /dev/null @@ -1,106 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DeleteDBInstance invokes the rds.DeleteDBInstance API synchronously -func (client *Client) DeleteDBInstance(request *DeleteDBInstanceRequest) (response *DeleteDBInstanceResponse, err error) { - response = CreateDeleteDBInstanceResponse() - err = client.DoAction(request, response) - return -} - -// DeleteDBInstanceWithChan invokes the rds.DeleteDBInstance API asynchronously -func (client *Client) DeleteDBInstanceWithChan(request *DeleteDBInstanceRequest) (<-chan *DeleteDBInstanceResponse, <-chan error) { - responseChan := make(chan *DeleteDBInstanceResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DeleteDBInstance(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DeleteDBInstanceWithCallback invokes the rds.DeleteDBInstance API asynchronously -func (client *Client) DeleteDBInstanceWithCallback(request *DeleteDBInstanceRequest, callback func(response *DeleteDBInstanceResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DeleteDBInstanceResponse - var err error - defer close(result) - response, err = client.DeleteDBInstance(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DeleteDBInstanceRequest is the request struct for api DeleteDBInstance -type DeleteDBInstanceRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ClientToken string `position:"Query" name:"ClientToken"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ReleasedKeepPolicy string `position:"Query" name:"ReleasedKeepPolicy"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// DeleteDBInstanceResponse is the response struct for api DeleteDBInstance -type DeleteDBInstanceResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - RegionId string `json:"RegionId" xml:"RegionId"` -} - -// CreateDeleteDBInstanceRequest creates a request to invoke DeleteDBInstance API -func CreateDeleteDBInstanceRequest() (request *DeleteDBInstanceRequest) { - request = &DeleteDBInstanceRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DeleteDBInstance", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDeleteDBInstanceResponse creates a response to parse from DeleteDBInstance response -func CreateDeleteDBInstanceResponse() (response *DeleteDBInstanceResponse) { - response = &DeleteDBInstanceResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/delete_db_proxy_endpoint_address.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/delete_db_proxy_endpoint_address.go deleted file mode 100644 index 619e172b5e1..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/delete_db_proxy_endpoint_address.go +++ /dev/null @@ -1,101 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DeleteDBProxyEndpointAddress invokes the rds.DeleteDBProxyEndpointAddress API synchronously -func (client *Client) DeleteDBProxyEndpointAddress(request *DeleteDBProxyEndpointAddressRequest) (response *DeleteDBProxyEndpointAddressResponse, err error) { - response = CreateDeleteDBProxyEndpointAddressResponse() - err = client.DoAction(request, response) - return -} - -// DeleteDBProxyEndpointAddressWithChan invokes the rds.DeleteDBProxyEndpointAddress API asynchronously -func (client *Client) DeleteDBProxyEndpointAddressWithChan(request *DeleteDBProxyEndpointAddressRequest) (<-chan *DeleteDBProxyEndpointAddressResponse, <-chan error) { - responseChan := make(chan *DeleteDBProxyEndpointAddressResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DeleteDBProxyEndpointAddress(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DeleteDBProxyEndpointAddressWithCallback invokes the rds.DeleteDBProxyEndpointAddress API asynchronously -func (client *Client) DeleteDBProxyEndpointAddressWithCallback(request *DeleteDBProxyEndpointAddressRequest, callback func(response *DeleteDBProxyEndpointAddressResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DeleteDBProxyEndpointAddressResponse - var err error - defer close(result) - response, err = client.DeleteDBProxyEndpointAddress(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DeleteDBProxyEndpointAddressRequest is the request struct for api DeleteDBProxyEndpointAddress -type DeleteDBProxyEndpointAddressRequest struct { - *requests.RpcRequest - DBProxyConnectStringNetType string `position:"Query" name:"DBProxyConnectStringNetType"` - DBProxyEndpointId string `position:"Query" name:"DBProxyEndpointId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// DeleteDBProxyEndpointAddressResponse is the response struct for api DeleteDBProxyEndpointAddress -type DeleteDBProxyEndpointAddressResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateDeleteDBProxyEndpointAddressRequest creates a request to invoke DeleteDBProxyEndpointAddress API -func CreateDeleteDBProxyEndpointAddressRequest() (request *DeleteDBProxyEndpointAddressRequest) { - request = &DeleteDBProxyEndpointAddressRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DeleteDBProxyEndpointAddress", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDeleteDBProxyEndpointAddressResponse creates a response to parse from DeleteDBProxyEndpointAddress response -func CreateDeleteDBProxyEndpointAddressResponse() (response *DeleteDBProxyEndpointAddressResponse) { - response = &DeleteDBProxyEndpointAddressResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/delete_parameter_group.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/delete_parameter_group.go deleted file mode 100644 index 63a29bb9be7..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/delete_parameter_group.go +++ /dev/null @@ -1,103 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DeleteParameterGroup invokes the rds.DeleteParameterGroup API synchronously -func (client *Client) DeleteParameterGroup(request *DeleteParameterGroupRequest) (response *DeleteParameterGroupResponse, err error) { - response = CreateDeleteParameterGroupResponse() - err = client.DoAction(request, response) - return -} - -// DeleteParameterGroupWithChan invokes the rds.DeleteParameterGroup API asynchronously -func (client *Client) DeleteParameterGroupWithChan(request *DeleteParameterGroupRequest) (<-chan *DeleteParameterGroupResponse, <-chan error) { - responseChan := make(chan *DeleteParameterGroupResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DeleteParameterGroup(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DeleteParameterGroupWithCallback invokes the rds.DeleteParameterGroup API asynchronously -func (client *Client) DeleteParameterGroupWithCallback(request *DeleteParameterGroupRequest, callback func(response *DeleteParameterGroupResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DeleteParameterGroupResponse - var err error - defer close(result) - response, err = client.DeleteParameterGroup(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DeleteParameterGroupRequest is the request struct for api DeleteParameterGroup -type DeleteParameterGroupRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - ParameterGroupId string `position:"Query" name:"ParameterGroupId"` -} - -// DeleteParameterGroupResponse is the response struct for api DeleteParameterGroup -type DeleteParameterGroupResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - ParameterGroupId string `json:"ParameterGroupId" xml:"ParameterGroupId"` -} - -// CreateDeleteParameterGroupRequest creates a request to invoke DeleteParameterGroup API -func CreateDeleteParameterGroupRequest() (request *DeleteParameterGroupRequest) { - request = &DeleteParameterGroupRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DeleteParameterGroup", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDeleteParameterGroupResponse creates a response to parse from DeleteParameterGroup response -func CreateDeleteParameterGroupResponse() (response *DeleteParameterGroupResponse) { - response = &DeleteParameterGroupResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/descibe_imports_from_database.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/descibe_imports_from_database.go deleted file mode 100644 index f460e6f0537..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/descibe_imports_from_database.go +++ /dev/null @@ -1,114 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescibeImportsFromDatabase invokes the rds.DescibeImportsFromDatabase API synchronously -func (client *Client) DescibeImportsFromDatabase(request *DescibeImportsFromDatabaseRequest) (response *DescibeImportsFromDatabaseResponse, err error) { - response = CreateDescibeImportsFromDatabaseResponse() - err = client.DoAction(request, response) - return -} - -// DescibeImportsFromDatabaseWithChan invokes the rds.DescibeImportsFromDatabase API asynchronously -func (client *Client) DescibeImportsFromDatabaseWithChan(request *DescibeImportsFromDatabaseRequest) (<-chan *DescibeImportsFromDatabaseResponse, <-chan error) { - responseChan := make(chan *DescibeImportsFromDatabaseResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescibeImportsFromDatabase(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescibeImportsFromDatabaseWithCallback invokes the rds.DescibeImportsFromDatabase API asynchronously -func (client *Client) DescibeImportsFromDatabaseWithCallback(request *DescibeImportsFromDatabaseRequest, callback func(response *DescibeImportsFromDatabaseResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescibeImportsFromDatabaseResponse - var err error - defer close(result) - response, err = client.DescibeImportsFromDatabase(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescibeImportsFromDatabaseRequest is the request struct for api DescibeImportsFromDatabase -type DescibeImportsFromDatabaseRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ClientToken string `position:"Query" name:"ClientToken"` - StartTime string `position:"Query" name:"StartTime"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - ImportId requests.Integer `position:"Query" name:"ImportId"` - Engine string `position:"Query" name:"Engine"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - EndTime string `position:"Query" name:"EndTime"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// DescibeImportsFromDatabaseResponse is the response struct for api DescibeImportsFromDatabase -type DescibeImportsFromDatabaseResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - TotalRecordCount int `json:"TotalRecordCount" xml:"TotalRecordCount"` - PageNumber int `json:"PageNumber" xml:"PageNumber"` - PageRecordCount int `json:"PageRecordCount" xml:"PageRecordCount"` - Items ItemsInDescibeImportsFromDatabase `json:"Items" xml:"Items"` -} - -// CreateDescibeImportsFromDatabaseRequest creates a request to invoke DescibeImportsFromDatabase API -func CreateDescibeImportsFromDatabaseRequest() (request *DescibeImportsFromDatabaseRequest) { - request = &DescibeImportsFromDatabaseRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescibeImportsFromDatabase", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescibeImportsFromDatabaseResponse creates a response to parse from DescibeImportsFromDatabase response -func CreateDescibeImportsFromDatabaseResponse() (response *DescibeImportsFromDatabaseResponse) { - response = &DescibeImportsFromDatabaseResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_accounts.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_accounts.go deleted file mode 100644 index 784b5f16356..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_accounts.go +++ /dev/null @@ -1,111 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeAccounts invokes the rds.DescribeAccounts API synchronously -func (client *Client) DescribeAccounts(request *DescribeAccountsRequest) (response *DescribeAccountsResponse, err error) { - response = CreateDescribeAccountsResponse() - err = client.DoAction(request, response) - return -} - -// DescribeAccountsWithChan invokes the rds.DescribeAccounts API asynchronously -func (client *Client) DescribeAccountsWithChan(request *DescribeAccountsRequest) (<-chan *DescribeAccountsResponse, <-chan error) { - responseChan := make(chan *DescribeAccountsResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeAccounts(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeAccountsWithCallback invokes the rds.DescribeAccounts API asynchronously -func (client *Client) DescribeAccountsWithCallback(request *DescribeAccountsRequest, callback func(response *DescribeAccountsResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeAccountsResponse - var err error - defer close(result) - response, err = client.DescribeAccounts(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeAccountsRequest is the request struct for api DescribeAccounts -type DescribeAccountsRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - AccountName string `position:"Query" name:"AccountName"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// DescribeAccountsResponse is the response struct for api DescribeAccounts -type DescribeAccountsResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - SystemAdminAccountStatus string `json:"SystemAdminAccountStatus" xml:"SystemAdminAccountStatus"` - SystemAdminAccountFirstActivationTime string `json:"SystemAdminAccountFirstActivationTime" xml:"SystemAdminAccountFirstActivationTime"` - PageNumber int `json:"PageNumber" xml:"PageNumber"` - TotalRecordCount int `json:"TotalRecordCount" xml:"TotalRecordCount"` - Accounts AccountsInDescribeAccounts `json:"Accounts" xml:"Accounts"` -} - -// CreateDescribeAccountsRequest creates a request to invoke DescribeAccounts API -func CreateDescribeAccountsRequest() (request *DescribeAccountsRequest) { - request = &DescribeAccountsRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeAccounts", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeAccountsResponse creates a response to parse from DescribeAccounts response -func CreateDescribeAccountsResponse() (response *DescribeAccountsResponse) { - response = &DescribeAccountsResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_action_event_policy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_action_event_policy.go deleted file mode 100644 index fb7d63bed02..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_action_event_policy.go +++ /dev/null @@ -1,103 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeActionEventPolicy invokes the rds.DescribeActionEventPolicy API synchronously -func (client *Client) DescribeActionEventPolicy(request *DescribeActionEventPolicyRequest) (response *DescribeActionEventPolicyResponse, err error) { - response = CreateDescribeActionEventPolicyResponse() - err = client.DoAction(request, response) - return -} - -// DescribeActionEventPolicyWithChan invokes the rds.DescribeActionEventPolicy API asynchronously -func (client *Client) DescribeActionEventPolicyWithChan(request *DescribeActionEventPolicyRequest) (<-chan *DescribeActionEventPolicyResponse, <-chan error) { - responseChan := make(chan *DescribeActionEventPolicyResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeActionEventPolicy(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeActionEventPolicyWithCallback invokes the rds.DescribeActionEventPolicy API asynchronously -func (client *Client) DescribeActionEventPolicyWithCallback(request *DescribeActionEventPolicyRequest, callback func(response *DescribeActionEventPolicyResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeActionEventPolicyResponse - var err error - defer close(result) - response, err = client.DescribeActionEventPolicy(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeActionEventPolicyRequest is the request struct for api DescribeActionEventPolicy -type DescribeActionEventPolicyRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// DescribeActionEventPolicyResponse is the response struct for api DescribeActionEventPolicy -type DescribeActionEventPolicyResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - RegionId string `json:"RegionId" xml:"RegionId"` - EnableEventLog string `json:"EnableEventLog" xml:"EnableEventLog"` -} - -// CreateDescribeActionEventPolicyRequest creates a request to invoke DescribeActionEventPolicy API -func CreateDescribeActionEventPolicyRequest() (request *DescribeActionEventPolicyRequest) { - request = &DescribeActionEventPolicyRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeActionEventPolicy", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeActionEventPolicyResponse creates a response to parse from DescribeActionEventPolicy response -func CreateDescribeActionEventPolicyResponse() (response *DescribeActionEventPolicyResponse) { - response = &DescribeActionEventPolicyResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_available_classes.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_available_classes.go deleted file mode 100644 index 7e8b01025b6..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_available_classes.go +++ /dev/null @@ -1,115 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeAvailableClasses invokes the rds.DescribeAvailableClasses API synchronously -func (client *Client) DescribeAvailableClasses(request *DescribeAvailableClassesRequest) (response *DescribeAvailableClassesResponse, err error) { - response = CreateDescribeAvailableClassesResponse() - err = client.DoAction(request, response) - return -} - -// DescribeAvailableClassesWithChan invokes the rds.DescribeAvailableClasses API asynchronously -func (client *Client) DescribeAvailableClassesWithChan(request *DescribeAvailableClassesRequest) (<-chan *DescribeAvailableClassesResponse, <-chan error) { - responseChan := make(chan *DescribeAvailableClassesResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeAvailableClasses(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeAvailableClassesWithCallback invokes the rds.DescribeAvailableClasses API asynchronously -func (client *Client) DescribeAvailableClassesWithCallback(request *DescribeAvailableClassesRequest, callback func(response *DescribeAvailableClassesResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeAvailableClassesResponse - var err error - defer close(result) - response, err = client.DescribeAvailableClasses(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeAvailableClassesRequest is the request struct for api DescribeAvailableClasses -type DescribeAvailableClassesRequest struct { - *requests.RpcRequest - DBInstanceName string `position:"Query" name:"DBInstanceName"` - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - EngineVersion string `position:"Query" name:"EngineVersion"` - Engine string `position:"Query" name:"Engine"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - DBInstanceStorageType string `position:"Query" name:"DBInstanceStorageType"` - InstanceChargeType string `position:"Query" name:"InstanceChargeType"` - DispenseMode string `position:"Query" name:"DispenseMode"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - CommodityCode string `position:"Query" name:"CommodityCode"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - EvaluateResource requests.Boolean `position:"Query" name:"EvaluateResource"` - ZoneId string `position:"Query" name:"ZoneId"` - Category string `position:"Query" name:"Category"` - OrderType string `position:"Query" name:"OrderType"` -} - -// DescribeAvailableClassesResponse is the response struct for api DescribeAvailableClasses -type DescribeAvailableClassesResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceClasses []DBInstanceClass `json:"DBInstanceClasses" xml:"DBInstanceClasses"` -} - -// CreateDescribeAvailableClassesRequest creates a request to invoke DescribeAvailableClasses API -func CreateDescribeAvailableClassesRequest() (request *DescribeAvailableClassesRequest) { - request = &DescribeAvailableClassesRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeAvailableClasses", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeAvailableClassesResponse creates a response to parse from DescribeAvailableClasses response -func CreateDescribeAvailableClassesResponse() (response *DescribeAvailableClassesResponse) { - response = &DescribeAvailableClassesResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_available_cross_region.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_available_cross_region.go deleted file mode 100644 index 20dcf36d01f..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_available_cross_region.go +++ /dev/null @@ -1,102 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeAvailableCrossRegion invokes the rds.DescribeAvailableCrossRegion API synchronously -func (client *Client) DescribeAvailableCrossRegion(request *DescribeAvailableCrossRegionRequest) (response *DescribeAvailableCrossRegionResponse, err error) { - response = CreateDescribeAvailableCrossRegionResponse() - err = client.DoAction(request, response) - return -} - -// DescribeAvailableCrossRegionWithChan invokes the rds.DescribeAvailableCrossRegion API asynchronously -func (client *Client) DescribeAvailableCrossRegionWithChan(request *DescribeAvailableCrossRegionRequest) (<-chan *DescribeAvailableCrossRegionResponse, <-chan error) { - responseChan := make(chan *DescribeAvailableCrossRegionResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeAvailableCrossRegion(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeAvailableCrossRegionWithCallback invokes the rds.DescribeAvailableCrossRegion API asynchronously -func (client *Client) DescribeAvailableCrossRegionWithCallback(request *DescribeAvailableCrossRegionRequest, callback func(response *DescribeAvailableCrossRegionResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeAvailableCrossRegionResponse - var err error - defer close(result) - response, err = client.DescribeAvailableCrossRegion(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeAvailableCrossRegionRequest is the request struct for api DescribeAvailableCrossRegion -type DescribeAvailableCrossRegionRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// DescribeAvailableCrossRegionResponse is the response struct for api DescribeAvailableCrossRegion -type DescribeAvailableCrossRegionResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Regions RegionsInDescribeAvailableCrossRegion `json:"Regions" xml:"Regions"` -} - -// CreateDescribeAvailableCrossRegionRequest creates a request to invoke DescribeAvailableCrossRegion API -func CreateDescribeAvailableCrossRegionRequest() (request *DescribeAvailableCrossRegionRequest) { - request = &DescribeAvailableCrossRegionRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeAvailableCrossRegion", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeAvailableCrossRegionResponse creates a response to parse from DescribeAvailableCrossRegion response -func CreateDescribeAvailableCrossRegionResponse() (response *DescribeAvailableCrossRegionResponse) { - response = &DescribeAvailableCrossRegionResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_available_dedicated_host_classes.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_available_dedicated_host_classes.go deleted file mode 100644 index 23d3ce17211..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_available_dedicated_host_classes.go +++ /dev/null @@ -1,104 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeAvailableDedicatedHostClasses invokes the rds.DescribeAvailableDedicatedHostClasses API synchronously -func (client *Client) DescribeAvailableDedicatedHostClasses(request *DescribeAvailableDedicatedHostClassesRequest) (response *DescribeAvailableDedicatedHostClassesResponse, err error) { - response = CreateDescribeAvailableDedicatedHostClassesResponse() - err = client.DoAction(request, response) - return -} - -// DescribeAvailableDedicatedHostClassesWithChan invokes the rds.DescribeAvailableDedicatedHostClasses API asynchronously -func (client *Client) DescribeAvailableDedicatedHostClassesWithChan(request *DescribeAvailableDedicatedHostClassesRequest) (<-chan *DescribeAvailableDedicatedHostClassesResponse, <-chan error) { - responseChan := make(chan *DescribeAvailableDedicatedHostClassesResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeAvailableDedicatedHostClasses(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeAvailableDedicatedHostClassesWithCallback invokes the rds.DescribeAvailableDedicatedHostClasses API asynchronously -func (client *Client) DescribeAvailableDedicatedHostClassesWithCallback(request *DescribeAvailableDedicatedHostClassesRequest, callback func(response *DescribeAvailableDedicatedHostClassesResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeAvailableDedicatedHostClassesResponse - var err error - defer close(result) - response, err = client.DescribeAvailableDedicatedHostClasses(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeAvailableDedicatedHostClassesRequest is the request struct for api DescribeAvailableDedicatedHostClasses -type DescribeAvailableDedicatedHostClassesRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - StorageType string `position:"Query" name:"StorageType"` - ZoneId string `position:"Query" name:"ZoneId"` -} - -// DescribeAvailableDedicatedHostClassesResponse is the response struct for api DescribeAvailableDedicatedHostClasses -type DescribeAvailableDedicatedHostClassesResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - HostClasses HostClasses `json:"HostClasses" xml:"HostClasses"` -} - -// CreateDescribeAvailableDedicatedHostClassesRequest creates a request to invoke DescribeAvailableDedicatedHostClasses API -func CreateDescribeAvailableDedicatedHostClassesRequest() (request *DescribeAvailableDedicatedHostClassesRequest) { - request = &DescribeAvailableDedicatedHostClassesRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeAvailableDedicatedHostClasses", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeAvailableDedicatedHostClassesResponse creates a response to parse from DescribeAvailableDedicatedHostClasses response -func CreateDescribeAvailableDedicatedHostClassesResponse() (response *DescribeAvailableDedicatedHostClassesResponse) { - response = &DescribeAvailableDedicatedHostClassesResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_available_recovery_time.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_available_recovery_time.go deleted file mode 100644 index 74a69e8525d..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_available_recovery_time.go +++ /dev/null @@ -1,107 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeAvailableRecoveryTime invokes the rds.DescribeAvailableRecoveryTime API synchronously -func (client *Client) DescribeAvailableRecoveryTime(request *DescribeAvailableRecoveryTimeRequest) (response *DescribeAvailableRecoveryTimeResponse, err error) { - response = CreateDescribeAvailableRecoveryTimeResponse() - err = client.DoAction(request, response) - return -} - -// DescribeAvailableRecoveryTimeWithChan invokes the rds.DescribeAvailableRecoveryTime API asynchronously -func (client *Client) DescribeAvailableRecoveryTimeWithChan(request *DescribeAvailableRecoveryTimeRequest) (<-chan *DescribeAvailableRecoveryTimeResponse, <-chan error) { - responseChan := make(chan *DescribeAvailableRecoveryTimeResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeAvailableRecoveryTime(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeAvailableRecoveryTimeWithCallback invokes the rds.DescribeAvailableRecoveryTime API asynchronously -func (client *Client) DescribeAvailableRecoveryTimeWithCallback(request *DescribeAvailableRecoveryTimeRequest, callback func(response *DescribeAvailableRecoveryTimeResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeAvailableRecoveryTimeResponse - var err error - defer close(result) - response, err = client.DescribeAvailableRecoveryTime(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeAvailableRecoveryTimeRequest is the request struct for api DescribeAvailableRecoveryTime -type DescribeAvailableRecoveryTimeRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - CrossBackupId requests.Integer `position:"Query" name:"CrossBackupId"` -} - -// DescribeAvailableRecoveryTimeResponse is the response struct for api DescribeAvailableRecoveryTime -type DescribeAvailableRecoveryTimeResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - RecoveryBeginTime string `json:"RecoveryBeginTime" xml:"RecoveryBeginTime"` - RecoveryEndTime string `json:"RecoveryEndTime" xml:"RecoveryEndTime"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - RegionId string `json:"RegionId" xml:"RegionId"` - CrossBackupId int `json:"CrossBackupId" xml:"CrossBackupId"` -} - -// CreateDescribeAvailableRecoveryTimeRequest creates a request to invoke DescribeAvailableRecoveryTime API -func CreateDescribeAvailableRecoveryTimeRequest() (request *DescribeAvailableRecoveryTimeRequest) { - request = &DescribeAvailableRecoveryTimeRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeAvailableRecoveryTime", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeAvailableRecoveryTimeResponse creates a response to parse from DescribeAvailableRecoveryTime response -func CreateDescribeAvailableRecoveryTimeResponse() (response *DescribeAvailableRecoveryTimeResponse) { - response = &DescribeAvailableRecoveryTimeResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_available_resource.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_available_resource.go deleted file mode 100644 index b7e7c853bfc..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_available_resource.go +++ /dev/null @@ -1,115 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeAvailableResource invokes the rds.DescribeAvailableResource API synchronously -func (client *Client) DescribeAvailableResource(request *DescribeAvailableResourceRequest) (response *DescribeAvailableResourceResponse, err error) { - response = CreateDescribeAvailableResourceResponse() - err = client.DoAction(request, response) - return -} - -// DescribeAvailableResourceWithChan invokes the rds.DescribeAvailableResource API asynchronously -func (client *Client) DescribeAvailableResourceWithChan(request *DescribeAvailableResourceRequest) (<-chan *DescribeAvailableResourceResponse, <-chan error) { - responseChan := make(chan *DescribeAvailableResourceResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeAvailableResource(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeAvailableResourceWithCallback invokes the rds.DescribeAvailableResource API asynchronously -func (client *Client) DescribeAvailableResourceWithCallback(request *DescribeAvailableResourceRequest, callback func(response *DescribeAvailableResourceResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeAvailableResourceResponse - var err error - defer close(result) - response, err = client.DescribeAvailableResource(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeAvailableResourceRequest is the request struct for api DescribeAvailableResource -type DescribeAvailableResourceRequest struct { - *requests.RpcRequest - DBInstanceName string `position:"Query" name:"DBInstanceName"` - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - EngineVersion string `position:"Query" name:"EngineVersion"` - Engine string `position:"Query" name:"Engine"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - DBInstanceStorageType string `position:"Query" name:"DBInstanceStorageType"` - InstanceChargeType string `position:"Query" name:"InstanceChargeType"` - DispenseMode requests.Integer `position:"Query" name:"DispenseMode"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - CommodityCode string `position:"Query" name:"CommodityCode"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceClass string `position:"Query" name:"DBInstanceClass"` - ZoneId string `position:"Query" name:"ZoneId"` - Category string `position:"Query" name:"Category"` - OrderType string `position:"Query" name:"OrderType"` -} - -// DescribeAvailableResourceResponse is the response struct for api DescribeAvailableResource -type DescribeAvailableResourceResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - AvailableZones AvailableZonesInDescribeAvailableResource `json:"AvailableZones" xml:"AvailableZones"` -} - -// CreateDescribeAvailableResourceRequest creates a request to invoke DescribeAvailableResource API -func CreateDescribeAvailableResourceRequest() (request *DescribeAvailableResourceRequest) { - request = &DescribeAvailableResourceRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeAvailableResource", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeAvailableResourceResponse creates a response to parse from DescribeAvailableResource response -func CreateDescribeAvailableResourceResponse() (response *DescribeAvailableResourceResponse) { - response = &DescribeAvailableResourceResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_available_zones.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_available_zones.go deleted file mode 100644 index 3fc1c234be9..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_available_zones.go +++ /dev/null @@ -1,110 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeAvailableZones invokes the rds.DescribeAvailableZones API synchronously -func (client *Client) DescribeAvailableZones(request *DescribeAvailableZonesRequest) (response *DescribeAvailableZonesResponse, err error) { - response = CreateDescribeAvailableZonesResponse() - err = client.DoAction(request, response) - return -} - -// DescribeAvailableZonesWithChan invokes the rds.DescribeAvailableZones API asynchronously -func (client *Client) DescribeAvailableZonesWithChan(request *DescribeAvailableZonesRequest) (<-chan *DescribeAvailableZonesResponse, <-chan error) { - responseChan := make(chan *DescribeAvailableZonesResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeAvailableZones(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeAvailableZonesWithCallback invokes the rds.DescribeAvailableZones API asynchronously -func (client *Client) DescribeAvailableZonesWithCallback(request *DescribeAvailableZonesRequest, callback func(response *DescribeAvailableZonesResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeAvailableZonesResponse - var err error - defer close(result) - response, err = client.DescribeAvailableZones(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeAvailableZonesRequest is the request struct for api DescribeAvailableZones -type DescribeAvailableZonesRequest struct { - *requests.RpcRequest - DBInstanceName string `position:"Query" name:"DBInstanceName"` - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - EngineVersion string `position:"Query" name:"EngineVersion"` - Engine string `position:"Query" name:"Engine"` - InstanceChargeType string `position:"Query" name:"InstanceChargeType"` - DispenseMode string `position:"Query" name:"DispenseMode"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - CommodityCode string `position:"Query" name:"CommodityCode"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - EvaluateResource requests.Boolean `position:"Query" name:"EvaluateResource"` - ZoneId string `position:"Query" name:"ZoneId"` -} - -// DescribeAvailableZonesResponse is the response struct for api DescribeAvailableZones -type DescribeAvailableZonesResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - AvailableZones []AvailableZone `json:"AvailableZones" xml:"AvailableZones"` -} - -// CreateDescribeAvailableZonesRequest creates a request to invoke DescribeAvailableZones API -func CreateDescribeAvailableZonesRequest() (request *DescribeAvailableZonesRequest) { - request = &DescribeAvailableZonesRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeAvailableZones", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeAvailableZonesResponse creates a response to parse from DescribeAvailableZones response -func CreateDescribeAvailableZonesResponse() (response *DescribeAvailableZonesResponse) { - response = &DescribeAvailableZonesResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_backup_database.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_backup_database.go deleted file mode 100644 index 14e6a80164b..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_backup_database.go +++ /dev/null @@ -1,104 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeBackupDatabase invokes the rds.DescribeBackupDatabase API synchronously -func (client *Client) DescribeBackupDatabase(request *DescribeBackupDatabaseRequest) (response *DescribeBackupDatabaseResponse, err error) { - response = CreateDescribeBackupDatabaseResponse() - err = client.DoAction(request, response) - return -} - -// DescribeBackupDatabaseWithChan invokes the rds.DescribeBackupDatabase API asynchronously -func (client *Client) DescribeBackupDatabaseWithChan(request *DescribeBackupDatabaseRequest) (<-chan *DescribeBackupDatabaseResponse, <-chan error) { - responseChan := make(chan *DescribeBackupDatabaseResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeBackupDatabase(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeBackupDatabaseWithCallback invokes the rds.DescribeBackupDatabase API asynchronously -func (client *Client) DescribeBackupDatabaseWithCallback(request *DescribeBackupDatabaseRequest, callback func(response *DescribeBackupDatabaseResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeBackupDatabaseResponse - var err error - defer close(result) - response, err = client.DescribeBackupDatabase(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeBackupDatabaseRequest is the request struct for api DescribeBackupDatabase -type DescribeBackupDatabaseRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - BackupId string `position:"Query" name:"BackupId"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// DescribeBackupDatabaseResponse is the response struct for api DescribeBackupDatabase -type DescribeBackupDatabaseResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DatabaseNames string `json:"DatabaseNames" xml:"DatabaseNames"` -} - -// CreateDescribeBackupDatabaseRequest creates a request to invoke DescribeBackupDatabase API -func CreateDescribeBackupDatabaseRequest() (request *DescribeBackupDatabaseRequest) { - request = &DescribeBackupDatabaseRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeBackupDatabase", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeBackupDatabaseResponse creates a response to parse from DescribeBackupDatabase response -func CreateDescribeBackupDatabaseResponse() (response *DescribeBackupDatabaseResponse) { - response = &DescribeBackupDatabaseResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_backup_policy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_backup_policy.go deleted file mode 100644 index 8987a30b54f..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_backup_policy.go +++ /dev/null @@ -1,131 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeBackupPolicy invokes the rds.DescribeBackupPolicy API synchronously -func (client *Client) DescribeBackupPolicy(request *DescribeBackupPolicyRequest) (response *DescribeBackupPolicyResponse, err error) { - response = CreateDescribeBackupPolicyResponse() - err = client.DoAction(request, response) - return -} - -// DescribeBackupPolicyWithChan invokes the rds.DescribeBackupPolicy API asynchronously -func (client *Client) DescribeBackupPolicyWithChan(request *DescribeBackupPolicyRequest) (<-chan *DescribeBackupPolicyResponse, <-chan error) { - responseChan := make(chan *DescribeBackupPolicyResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeBackupPolicy(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeBackupPolicyWithCallback invokes the rds.DescribeBackupPolicy API asynchronously -func (client *Client) DescribeBackupPolicyWithCallback(request *DescribeBackupPolicyRequest, callback func(response *DescribeBackupPolicyResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeBackupPolicyResponse - var err error - defer close(result) - response, err = client.DescribeBackupPolicy(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeBackupPolicyRequest is the request struct for api DescribeBackupPolicy -type DescribeBackupPolicyRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - BackupPolicyMode string `position:"Query" name:"BackupPolicyMode"` - ReleasedKeepPolicy string `position:"Query" name:"ReleasedKeepPolicy"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - CompressType string `position:"Query" name:"CompressType"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// DescribeBackupPolicyResponse is the response struct for api DescribeBackupPolicy -type DescribeBackupPolicyResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - BackupRetentionPeriod int `json:"BackupRetentionPeriod" xml:"BackupRetentionPeriod"` - PreferredNextBackupTime string `json:"PreferredNextBackupTime" xml:"PreferredNextBackupTime"` - PreferredBackupTime string `json:"PreferredBackupTime" xml:"PreferredBackupTime"` - PreferredBackupPeriod string `json:"PreferredBackupPeriod" xml:"PreferredBackupPeriod"` - BackupLog string `json:"BackupLog" xml:"BackupLog"` - LogBackupRetentionPeriod int `json:"LogBackupRetentionPeriod" xml:"LogBackupRetentionPeriod"` - EnableBackupLog string `json:"EnableBackupLog" xml:"EnableBackupLog"` - LocalLogRetentionHours int `json:"LocalLogRetentionHours" xml:"LocalLogRetentionHours"` - LocalLogRetentionSpace string `json:"LocalLogRetentionSpace" xml:"LocalLogRetentionSpace"` - Duplication string `json:"Duplication" xml:"Duplication"` - DuplicationContent string `json:"DuplicationContent" xml:"DuplicationContent"` - HighSpaceUsageProtection string `json:"HighSpaceUsageProtection" xml:"HighSpaceUsageProtection"` - LogBackupFrequency string `json:"LogBackupFrequency" xml:"LogBackupFrequency"` - CompressType string `json:"CompressType" xml:"CompressType"` - ArchiveBackupRetentionPeriod string `json:"ArchiveBackupRetentionPeriod" xml:"ArchiveBackupRetentionPeriod"` - ArchiveBackupKeepPolicy string `json:"ArchiveBackupKeepPolicy" xml:"ArchiveBackupKeepPolicy"` - ArchiveBackupKeepCount string `json:"ArchiveBackupKeepCount" xml:"ArchiveBackupKeepCount"` - ReleasedKeepPolicy string `json:"ReleasedKeepPolicy" xml:"ReleasedKeepPolicy"` - LogBackupLocalRetentionNumber int `json:"LogBackupLocalRetentionNumber" xml:"LogBackupLocalRetentionNumber"` - Category string `json:"Category" xml:"Category"` - SupportReleasedKeep int `json:"SupportReleasedKeep" xml:"SupportReleasedKeep"` - BackupInterval string `json:"BackupInterval" xml:"BackupInterval"` - SupportVolumeShadowCopy int `json:"SupportVolumeShadowCopy" xml:"SupportVolumeShadowCopy"` - BackupMethod string `json:"BackupMethod" xml:"BackupMethod"` - DuplicationLocation DuplicationLocation `json:"DuplicationLocation" xml:"DuplicationLocation"` -} - -// CreateDescribeBackupPolicyRequest creates a request to invoke DescribeBackupPolicy API -func CreateDescribeBackupPolicyRequest() (request *DescribeBackupPolicyRequest) { - request = &DescribeBackupPolicyRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeBackupPolicy", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeBackupPolicyResponse creates a response to parse from DescribeBackupPolicy response -func CreateDescribeBackupPolicyResponse() (response *DescribeBackupPolicyResponse) { - response = &DescribeBackupPolicyResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_backup_tasks.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_backup_tasks.go deleted file mode 100644 index 64aecc4b8fe..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_backup_tasks.go +++ /dev/null @@ -1,109 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeBackupTasks invokes the rds.DescribeBackupTasks API synchronously -func (client *Client) DescribeBackupTasks(request *DescribeBackupTasksRequest) (response *DescribeBackupTasksResponse, err error) { - response = CreateDescribeBackupTasksResponse() - err = client.DoAction(request, response) - return -} - -// DescribeBackupTasksWithChan invokes the rds.DescribeBackupTasks API asynchronously -func (client *Client) DescribeBackupTasksWithChan(request *DescribeBackupTasksRequest) (<-chan *DescribeBackupTasksResponse, <-chan error) { - responseChan := make(chan *DescribeBackupTasksResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeBackupTasks(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeBackupTasksWithCallback invokes the rds.DescribeBackupTasks API asynchronously -func (client *Client) DescribeBackupTasksWithCallback(request *DescribeBackupTasksRequest, callback func(response *DescribeBackupTasksResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeBackupTasksResponse - var err error - defer close(result) - response, err = client.DescribeBackupTasks(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeBackupTasksRequest is the request struct for api DescribeBackupTasks -type DescribeBackupTasksRequest struct { - *requests.RpcRequest - BackupJobId requests.Integer `position:"Query" name:"BackupJobId"` - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - Flag string `position:"Query" name:"Flag"` - ClientToken string `position:"Query" name:"ClientToken"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - BackupJobStatus string `position:"Query" name:"BackupJobStatus"` - BackupMode string `position:"Query" name:"BackupMode"` -} - -// DescribeBackupTasksResponse is the response struct for api DescribeBackupTasks -type DescribeBackupTasksResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Items ItemsInDescribeBackupTasks `json:"Items" xml:"Items"` -} - -// CreateDescribeBackupTasksRequest creates a request to invoke DescribeBackupTasks API -func CreateDescribeBackupTasksRequest() (request *DescribeBackupTasksRequest) { - request = &DescribeBackupTasksRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeBackupTasks", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeBackupTasksResponse creates a response to parse from DescribeBackupTasks response -func CreateDescribeBackupTasksResponse() (response *DescribeBackupTasksResponse) { - response = &DescribeBackupTasksResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_backups.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_backups.go deleted file mode 100644 index bc46dcd1aed..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_backups.go +++ /dev/null @@ -1,117 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeBackups invokes the rds.DescribeBackups API synchronously -func (client *Client) DescribeBackups(request *DescribeBackupsRequest) (response *DescribeBackupsResponse, err error) { - response = CreateDescribeBackupsResponse() - err = client.DoAction(request, response) - return -} - -// DescribeBackupsWithChan invokes the rds.DescribeBackups API asynchronously -func (client *Client) DescribeBackupsWithChan(request *DescribeBackupsRequest) (<-chan *DescribeBackupsResponse, <-chan error) { - responseChan := make(chan *DescribeBackupsResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeBackups(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeBackupsWithCallback invokes the rds.DescribeBackups API asynchronously -func (client *Client) DescribeBackupsWithCallback(request *DescribeBackupsRequest, callback func(response *DescribeBackupsResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeBackupsResponse - var err error - defer close(result) - response, err = client.DescribeBackups(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeBackupsRequest is the request struct for api DescribeBackups -type DescribeBackupsRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - StartTime string `position:"Query" name:"StartTime"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - BackupLocation string `position:"Query" name:"BackupLocation"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - BackupId string `position:"Query" name:"BackupId"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - EndTime string `position:"Query" name:"EndTime"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - BackupStatus string `position:"Query" name:"BackupStatus"` - BackupMode string `position:"Query" name:"BackupMode"` -} - -// DescribeBackupsResponse is the response struct for api DescribeBackups -type DescribeBackupsResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - TotalRecordCount string `json:"TotalRecordCount" xml:"TotalRecordCount"` - PageNumber string `json:"PageNumber" xml:"PageNumber"` - PageRecordCount string `json:"PageRecordCount" xml:"PageRecordCount"` - TotalBackupSize int64 `json:"TotalBackupSize" xml:"TotalBackupSize"` - TotalEcsSnapshotSize int64 `json:"TotalEcsSnapshotSize" xml:"TotalEcsSnapshotSize"` - Items ItemsInDescribeBackups `json:"Items" xml:"Items"` -} - -// CreateDescribeBackupsRequest creates a request to invoke DescribeBackups API -func CreateDescribeBackupsRequest() (request *DescribeBackupsRequest) { - request = &DescribeBackupsRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeBackups", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeBackupsResponse creates a response to parse from DescribeBackups response -func CreateDescribeBackupsResponse() (response *DescribeBackupsResponse) { - response = &DescribeBackupsResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_binlog_files.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_binlog_files.go deleted file mode 100644 index b535bf62156..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_binlog_files.go +++ /dev/null @@ -1,113 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeBinlogFiles invokes the rds.DescribeBinlogFiles API synchronously -func (client *Client) DescribeBinlogFiles(request *DescribeBinlogFilesRequest) (response *DescribeBinlogFilesResponse, err error) { - response = CreateDescribeBinlogFilesResponse() - err = client.DoAction(request, response) - return -} - -// DescribeBinlogFilesWithChan invokes the rds.DescribeBinlogFiles API asynchronously -func (client *Client) DescribeBinlogFilesWithChan(request *DescribeBinlogFilesRequest) (<-chan *DescribeBinlogFilesResponse, <-chan error) { - responseChan := make(chan *DescribeBinlogFilesResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeBinlogFiles(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeBinlogFilesWithCallback invokes the rds.DescribeBinlogFiles API asynchronously -func (client *Client) DescribeBinlogFilesWithCallback(request *DescribeBinlogFilesRequest, callback func(response *DescribeBinlogFilesResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeBinlogFilesResponse - var err error - defer close(result) - response, err = client.DescribeBinlogFiles(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeBinlogFilesRequest is the request struct for api DescribeBinlogFiles -type DescribeBinlogFilesRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - StartTime string `position:"Query" name:"StartTime"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - Latest requests.Integer `position:"Query" name:"Latest"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - EndTime string `position:"Query" name:"EndTime"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// DescribeBinlogFilesResponse is the response struct for api DescribeBinlogFiles -type DescribeBinlogFilesResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - TotalRecordCount int `json:"TotalRecordCount" xml:"TotalRecordCount"` - PageNumber int `json:"PageNumber" xml:"PageNumber"` - PageRecordCount int `json:"PageRecordCount" xml:"PageRecordCount"` - TotalFileSize int64 `json:"TotalFileSize" xml:"TotalFileSize"` - Items ItemsInDescribeBinlogFiles `json:"Items" xml:"Items"` -} - -// CreateDescribeBinlogFilesRequest creates a request to invoke DescribeBinlogFiles API -func CreateDescribeBinlogFilesRequest() (request *DescribeBinlogFilesRequest) { - request = &DescribeBinlogFilesRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeBinlogFiles", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeBinlogFilesResponse creates a response to parse from DescribeBinlogFiles response -func CreateDescribeBinlogFilesResponse() (response *DescribeBinlogFilesResponse) { - response = &DescribeBinlogFilesResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_character_set_name.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_character_set_name.go deleted file mode 100644 index f2c09534b07..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_character_set_name.go +++ /dev/null @@ -1,105 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeCharacterSetName invokes the rds.DescribeCharacterSetName API synchronously -func (client *Client) DescribeCharacterSetName(request *DescribeCharacterSetNameRequest) (response *DescribeCharacterSetNameResponse, err error) { - response = CreateDescribeCharacterSetNameResponse() - err = client.DoAction(request, response) - return -} - -// DescribeCharacterSetNameWithChan invokes the rds.DescribeCharacterSetName API asynchronously -func (client *Client) DescribeCharacterSetNameWithChan(request *DescribeCharacterSetNameRequest) (<-chan *DescribeCharacterSetNameResponse, <-chan error) { - responseChan := make(chan *DescribeCharacterSetNameResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeCharacterSetName(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeCharacterSetNameWithCallback invokes the rds.DescribeCharacterSetName API asynchronously -func (client *Client) DescribeCharacterSetNameWithCallback(request *DescribeCharacterSetNameRequest, callback func(response *DescribeCharacterSetNameResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeCharacterSetNameResponse - var err error - defer close(result) - response, err = client.DescribeCharacterSetName(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeCharacterSetNameRequest is the request struct for api DescribeCharacterSetName -type DescribeCharacterSetNameRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - Engine string `position:"Query" name:"Engine"` -} - -// DescribeCharacterSetNameResponse is the response struct for api DescribeCharacterSetName -type DescribeCharacterSetNameResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Engine string `json:"Engine" xml:"Engine"` - CharacterSetNameItems CharacterSetNameItems `json:"CharacterSetNameItems" xml:"CharacterSetNameItems"` -} - -// CreateDescribeCharacterSetNameRequest creates a request to invoke DescribeCharacterSetName API -func CreateDescribeCharacterSetNameRequest() (request *DescribeCharacterSetNameRequest) { - request = &DescribeCharacterSetNameRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeCharacterSetName", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeCharacterSetNameResponse creates a response to parse from DescribeCharacterSetName response -func CreateDescribeCharacterSetNameResponse() (response *DescribeCharacterSetNameResponse) { - response = &DescribeCharacterSetNameResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_collation_time_zones.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_collation_time_zones.go deleted file mode 100644 index 59d42c40a8c..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_collation_time_zones.go +++ /dev/null @@ -1,102 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeCollationTimeZones invokes the rds.DescribeCollationTimeZones API synchronously -func (client *Client) DescribeCollationTimeZones(request *DescribeCollationTimeZonesRequest) (response *DescribeCollationTimeZonesResponse, err error) { - response = CreateDescribeCollationTimeZonesResponse() - err = client.DoAction(request, response) - return -} - -// DescribeCollationTimeZonesWithChan invokes the rds.DescribeCollationTimeZones API asynchronously -func (client *Client) DescribeCollationTimeZonesWithChan(request *DescribeCollationTimeZonesRequest) (<-chan *DescribeCollationTimeZonesResponse, <-chan error) { - responseChan := make(chan *DescribeCollationTimeZonesResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeCollationTimeZones(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeCollationTimeZonesWithCallback invokes the rds.DescribeCollationTimeZones API asynchronously -func (client *Client) DescribeCollationTimeZonesWithCallback(request *DescribeCollationTimeZonesRequest, callback func(response *DescribeCollationTimeZonesResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeCollationTimeZonesResponse - var err error - defer close(result) - response, err = client.DescribeCollationTimeZones(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeCollationTimeZonesRequest is the request struct for api DescribeCollationTimeZones -type DescribeCollationTimeZonesRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// DescribeCollationTimeZonesResponse is the response struct for api DescribeCollationTimeZones -type DescribeCollationTimeZonesResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - CollationTimeZones CollationTimeZones `json:"CollationTimeZones" xml:"CollationTimeZones"` -} - -// CreateDescribeCollationTimeZonesRequest creates a request to invoke DescribeCollationTimeZones API -func CreateDescribeCollationTimeZonesRequest() (request *DescribeCollationTimeZonesRequest) { - request = &DescribeCollationTimeZonesRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeCollationTimeZones", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeCollationTimeZonesResponse creates a response to parse from DescribeCollationTimeZones response -func CreateDescribeCollationTimeZonesResponse() (response *DescribeCollationTimeZonesResponse) { - response = &DescribeCollationTimeZonesResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_cross_backup_meta_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_cross_backup_meta_list.go deleted file mode 100644 index 255cc5ff196..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_cross_backup_meta_list.go +++ /dev/null @@ -1,113 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeCrossBackupMetaList invokes the rds.DescribeCrossBackupMetaList API synchronously -func (client *Client) DescribeCrossBackupMetaList(request *DescribeCrossBackupMetaListRequest) (response *DescribeCrossBackupMetaListResponse, err error) { - response = CreateDescribeCrossBackupMetaListResponse() - err = client.DoAction(request, response) - return -} - -// DescribeCrossBackupMetaListWithChan invokes the rds.DescribeCrossBackupMetaList API asynchronously -func (client *Client) DescribeCrossBackupMetaListWithChan(request *DescribeCrossBackupMetaListRequest) (<-chan *DescribeCrossBackupMetaListResponse, <-chan error) { - responseChan := make(chan *DescribeCrossBackupMetaListResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeCrossBackupMetaList(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeCrossBackupMetaListWithCallback invokes the rds.DescribeCrossBackupMetaList API asynchronously -func (client *Client) DescribeCrossBackupMetaListWithCallback(request *DescribeCrossBackupMetaListRequest, callback func(response *DescribeCrossBackupMetaListResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeCrossBackupMetaListResponse - var err error - defer close(result) - response, err = client.DescribeCrossBackupMetaList(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeCrossBackupMetaListRequest is the request struct for api DescribeCrossBackupMetaList -type DescribeCrossBackupMetaListRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - Pattern string `position:"Query" name:"Pattern"` - PageSize string `position:"Query" name:"PageSize"` - PageIndex string `position:"Query" name:"PageIndex"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - BackupSetId string `position:"Query" name:"BackupSetId"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - GetDbName string `position:"Query" name:"GetDbName"` - Region string `position:"Query" name:"Region"` -} - -// DescribeCrossBackupMetaListResponse is the response struct for api DescribeCrossBackupMetaList -type DescribeCrossBackupMetaListResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceName string `json:"DBInstanceName" xml:"DBInstanceName"` - PageNumber int `json:"PageNumber" xml:"PageNumber"` - PageRecordCount int `json:"PageRecordCount" xml:"PageRecordCount"` - TotalRecordCount int `json:"TotalRecordCount" xml:"TotalRecordCount"` - TotalPageCount int `json:"TotalPageCount" xml:"TotalPageCount"` - Items ItemsInDescribeCrossBackupMetaList `json:"Items" xml:"Items"` -} - -// CreateDescribeCrossBackupMetaListRequest creates a request to invoke DescribeCrossBackupMetaList API -func CreateDescribeCrossBackupMetaListRequest() (request *DescribeCrossBackupMetaListRequest) { - request = &DescribeCrossBackupMetaListRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeCrossBackupMetaList", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeCrossBackupMetaListResponse creates a response to parse from DescribeCrossBackupMetaList response -func CreateDescribeCrossBackupMetaListResponse() (response *DescribeCrossBackupMetaListResponse) { - response = &DescribeCrossBackupMetaListResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_cross_region_backup_db_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_cross_region_backup_db_instance.go deleted file mode 100644 index 05d0c0eb563..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_cross_region_backup_db_instance.go +++ /dev/null @@ -1,112 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeCrossRegionBackupDBInstance invokes the rds.DescribeCrossRegionBackupDBInstance API synchronously -func (client *Client) DescribeCrossRegionBackupDBInstance(request *DescribeCrossRegionBackupDBInstanceRequest) (response *DescribeCrossRegionBackupDBInstanceResponse, err error) { - response = CreateDescribeCrossRegionBackupDBInstanceResponse() - err = client.DoAction(request, response) - return -} - -// DescribeCrossRegionBackupDBInstanceWithChan invokes the rds.DescribeCrossRegionBackupDBInstance API asynchronously -func (client *Client) DescribeCrossRegionBackupDBInstanceWithChan(request *DescribeCrossRegionBackupDBInstanceRequest) (<-chan *DescribeCrossRegionBackupDBInstanceResponse, <-chan error) { - responseChan := make(chan *DescribeCrossRegionBackupDBInstanceResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeCrossRegionBackupDBInstance(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeCrossRegionBackupDBInstanceWithCallback invokes the rds.DescribeCrossRegionBackupDBInstance API asynchronously -func (client *Client) DescribeCrossRegionBackupDBInstanceWithCallback(request *DescribeCrossRegionBackupDBInstanceRequest, callback func(response *DescribeCrossRegionBackupDBInstanceResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeCrossRegionBackupDBInstanceResponse - var err error - defer close(result) - response, err = client.DescribeCrossRegionBackupDBInstance(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeCrossRegionBackupDBInstanceRequest is the request struct for api DescribeCrossRegionBackupDBInstance -type DescribeCrossRegionBackupDBInstanceRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - NotEnabled requests.Integer `position:"Query" name:"NotEnabled"` - Product string `position:"Query" name:"Product"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// DescribeCrossRegionBackupDBInstanceResponse is the response struct for api DescribeCrossRegionBackupDBInstance -type DescribeCrossRegionBackupDBInstanceResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - RegionId string `json:"RegionId" xml:"RegionId"` - TotalRecords int `json:"TotalRecords" xml:"TotalRecords"` - PageSize int `json:"PageSize" xml:"PageSize"` - PageNumber int `json:"PageNumber" xml:"PageNumber"` - ItemsNumbers int `json:"ItemsNumbers" xml:"ItemsNumbers"` - Items ItemsInDescribeCrossRegionBackupDBInstance `json:"Items" xml:"Items"` -} - -// CreateDescribeCrossRegionBackupDBInstanceRequest creates a request to invoke DescribeCrossRegionBackupDBInstance API -func CreateDescribeCrossRegionBackupDBInstanceRequest() (request *DescribeCrossRegionBackupDBInstanceRequest) { - request = &DescribeCrossRegionBackupDBInstanceRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeCrossRegionBackupDBInstance", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeCrossRegionBackupDBInstanceResponse creates a response to parse from DescribeCrossRegionBackupDBInstance response -func CreateDescribeCrossRegionBackupDBInstanceResponse() (response *DescribeCrossRegionBackupDBInstanceResponse) { - response = &DescribeCrossRegionBackupDBInstanceResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_cross_region_backups.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_cross_region_backups.go deleted file mode 100644 index 08d142bb3f9..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_cross_region_backups.go +++ /dev/null @@ -1,116 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeCrossRegionBackups invokes the rds.DescribeCrossRegionBackups API synchronously -func (client *Client) DescribeCrossRegionBackups(request *DescribeCrossRegionBackupsRequest) (response *DescribeCrossRegionBackupsResponse, err error) { - response = CreateDescribeCrossRegionBackupsResponse() - err = client.DoAction(request, response) - return -} - -// DescribeCrossRegionBackupsWithChan invokes the rds.DescribeCrossRegionBackups API asynchronously -func (client *Client) DescribeCrossRegionBackupsWithChan(request *DescribeCrossRegionBackupsRequest) (<-chan *DescribeCrossRegionBackupsResponse, <-chan error) { - responseChan := make(chan *DescribeCrossRegionBackupsResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeCrossRegionBackups(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeCrossRegionBackupsWithCallback invokes the rds.DescribeCrossRegionBackups API asynchronously -func (client *Client) DescribeCrossRegionBackupsWithCallback(request *DescribeCrossRegionBackupsRequest, callback func(response *DescribeCrossRegionBackupsResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeCrossRegionBackupsResponse - var err error - defer close(result) - response, err = client.DescribeCrossRegionBackups(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeCrossRegionBackupsRequest is the request struct for api DescribeCrossRegionBackups -type DescribeCrossRegionBackupsRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - StartTime string `position:"Query" name:"StartTime"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - BackupId requests.Integer `position:"Query" name:"BackupId"` - EndTime string `position:"Query" name:"EndTime"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - CrossBackupRegion string `position:"Query" name:"CrossBackupRegion"` - CrossBackupId requests.Integer `position:"Query" name:"CrossBackupId"` -} - -// DescribeCrossRegionBackupsResponse is the response struct for api DescribeCrossRegionBackups -type DescribeCrossRegionBackupsResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - RegionId string `json:"RegionId" xml:"RegionId"` - StartTime string `json:"StartTime" xml:"StartTime"` - EndTime string `json:"EndTime" xml:"EndTime"` - TotalRecordCount int `json:"TotalRecordCount" xml:"TotalRecordCount"` - PageRecordCount int `json:"PageRecordCount" xml:"PageRecordCount"` - PageNumber int `json:"PageNumber" xml:"PageNumber"` - Items ItemsInDescribeCrossRegionBackups `json:"Items" xml:"Items"` -} - -// CreateDescribeCrossRegionBackupsRequest creates a request to invoke DescribeCrossRegionBackups API -func CreateDescribeCrossRegionBackupsRequest() (request *DescribeCrossRegionBackupsRequest) { - request = &DescribeCrossRegionBackupsRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeCrossRegionBackups", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeCrossRegionBackupsResponse creates a response to parse from DescribeCrossRegionBackups response -func CreateDescribeCrossRegionBackupsResponse() (response *DescribeCrossRegionBackupsResponse) { - response = &DescribeCrossRegionBackupsResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_cross_region_log_backup_files.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_cross_region_log_backup_files.go deleted file mode 100644 index e58f4de7cd4..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_cross_region_log_backup_files.go +++ /dev/null @@ -1,115 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeCrossRegionLogBackupFiles invokes the rds.DescribeCrossRegionLogBackupFiles API synchronously -func (client *Client) DescribeCrossRegionLogBackupFiles(request *DescribeCrossRegionLogBackupFilesRequest) (response *DescribeCrossRegionLogBackupFilesResponse, err error) { - response = CreateDescribeCrossRegionLogBackupFilesResponse() - err = client.DoAction(request, response) - return -} - -// DescribeCrossRegionLogBackupFilesWithChan invokes the rds.DescribeCrossRegionLogBackupFiles API asynchronously -func (client *Client) DescribeCrossRegionLogBackupFilesWithChan(request *DescribeCrossRegionLogBackupFilesRequest) (<-chan *DescribeCrossRegionLogBackupFilesResponse, <-chan error) { - responseChan := make(chan *DescribeCrossRegionLogBackupFilesResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeCrossRegionLogBackupFiles(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeCrossRegionLogBackupFilesWithCallback invokes the rds.DescribeCrossRegionLogBackupFiles API asynchronously -func (client *Client) DescribeCrossRegionLogBackupFilesWithCallback(request *DescribeCrossRegionLogBackupFilesRequest, callback func(response *DescribeCrossRegionLogBackupFilesResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeCrossRegionLogBackupFilesResponse - var err error - defer close(result) - response, err = client.DescribeCrossRegionLogBackupFiles(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeCrossRegionLogBackupFilesRequest is the request struct for api DescribeCrossRegionLogBackupFiles -type DescribeCrossRegionLogBackupFilesRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - StartTime string `position:"Query" name:"StartTime"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - EndTime string `position:"Query" name:"EndTime"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - CrossBackupRegion string `position:"Query" name:"CrossBackupRegion"` -} - -// DescribeCrossRegionLogBackupFilesResponse is the response struct for api DescribeCrossRegionLogBackupFiles -type DescribeCrossRegionLogBackupFilesResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - RegionId string `json:"RegionId" xml:"RegionId"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - StartTime string `json:"StartTime" xml:"StartTime"` - EndTime string `json:"EndTime" xml:"EndTime"` - TotalRecordCount int `json:"TotalRecordCount" xml:"TotalRecordCount"` - PageRecordCount int `json:"PageRecordCount" xml:"PageRecordCount"` - PageNumber int `json:"PageNumber" xml:"PageNumber"` - Items ItemsInDescribeCrossRegionLogBackupFiles `json:"Items" xml:"Items"` -} - -// CreateDescribeCrossRegionLogBackupFilesRequest creates a request to invoke DescribeCrossRegionLogBackupFiles API -func CreateDescribeCrossRegionLogBackupFilesRequest() (request *DescribeCrossRegionLogBackupFilesRequest) { - request = &DescribeCrossRegionLogBackupFilesRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeCrossRegionLogBackupFiles", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeCrossRegionLogBackupFilesResponse creates a response to parse from DescribeCrossRegionLogBackupFiles response -func CreateDescribeCrossRegionLogBackupFilesResponse() (response *DescribeCrossRegionLogBackupFilesResponse) { - response = &DescribeCrossRegionLogBackupFilesResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_databases.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_databases.go deleted file mode 100644 index ea3a52f9b87..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_databases.go +++ /dev/null @@ -1,108 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeDatabases invokes the rds.DescribeDatabases API synchronously -func (client *Client) DescribeDatabases(request *DescribeDatabasesRequest) (response *DescribeDatabasesResponse, err error) { - response = CreateDescribeDatabasesResponse() - err = client.DoAction(request, response) - return -} - -// DescribeDatabasesWithChan invokes the rds.DescribeDatabases API asynchronously -func (client *Client) DescribeDatabasesWithChan(request *DescribeDatabasesRequest) (<-chan *DescribeDatabasesResponse, <-chan error) { - responseChan := make(chan *DescribeDatabasesResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeDatabases(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeDatabasesWithCallback invokes the rds.DescribeDatabases API asynchronously -func (client *Client) DescribeDatabasesWithCallback(request *DescribeDatabasesRequest, callback func(response *DescribeDatabasesResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeDatabasesResponse - var err error - defer close(result) - response, err = client.DescribeDatabases(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeDatabasesRequest is the request struct for api DescribeDatabases -type DescribeDatabasesRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - DBStatus string `position:"Query" name:"DBStatus"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBName string `position:"Query" name:"DBName"` -} - -// DescribeDatabasesResponse is the response struct for api DescribeDatabases -type DescribeDatabasesResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Databases DatabasesInDescribeDatabases `json:"Databases" xml:"Databases"` -} - -// CreateDescribeDatabasesRequest creates a request to invoke DescribeDatabases API -func CreateDescribeDatabasesRequest() (request *DescribeDatabasesRequest) { - request = &DescribeDatabasesRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeDatabases", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeDatabasesResponse creates a response to parse from DescribeDatabases response -func CreateDescribeDatabasesResponse() (response *DescribeDatabasesResponse) { - response = &DescribeDatabasesResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_attribute.go deleted file mode 100644 index 8c55ce6ea45..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_attribute.go +++ /dev/null @@ -1,106 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeDBInstanceAttribute invokes the rds.DescribeDBInstanceAttribute API synchronously -func (client *Client) DescribeDBInstanceAttribute(request *DescribeDBInstanceAttributeRequest) (response *DescribeDBInstanceAttributeResponse, err error) { - response = CreateDescribeDBInstanceAttributeResponse() - err = client.DoAction(request, response) - return -} - -// DescribeDBInstanceAttributeWithChan invokes the rds.DescribeDBInstanceAttribute API asynchronously -func (client *Client) DescribeDBInstanceAttributeWithChan(request *DescribeDBInstanceAttributeRequest) (<-chan *DescribeDBInstanceAttributeResponse, <-chan error) { - responseChan := make(chan *DescribeDBInstanceAttributeResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeDBInstanceAttribute(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeDBInstanceAttributeWithCallback invokes the rds.DescribeDBInstanceAttribute API asynchronously -func (client *Client) DescribeDBInstanceAttributeWithCallback(request *DescribeDBInstanceAttributeRequest, callback func(response *DescribeDBInstanceAttributeResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeDBInstanceAttributeResponse - var err error - defer close(result) - response, err = client.DescribeDBInstanceAttribute(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeDBInstanceAttributeRequest is the request struct for api DescribeDBInstanceAttribute -type DescribeDBInstanceAttributeRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceGroupId string `position:"Query" name:"ResourceGroupId"` - Expired string `position:"Query" name:"Expired"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// DescribeDBInstanceAttributeResponse is the response struct for api DescribeDBInstanceAttribute -type DescribeDBInstanceAttributeResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Items ItemsInDescribeDBInstanceAttribute `json:"Items" xml:"Items"` -} - -// CreateDescribeDBInstanceAttributeRequest creates a request to invoke DescribeDBInstanceAttribute API -func CreateDescribeDBInstanceAttributeRequest() (request *DescribeDBInstanceAttributeRequest) { - request = &DescribeDBInstanceAttributeRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeDBInstanceAttribute", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeDBInstanceAttributeResponse creates a response to parse from DescribeDBInstanceAttribute response -func CreateDescribeDBInstanceAttributeResponse() (response *DescribeDBInstanceAttributeResponse) { - response = &DescribeDBInstanceAttributeResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_detail.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_detail.go deleted file mode 100644 index eac746d669b..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_detail.go +++ /dev/null @@ -1,107 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeDBInstanceDetail invokes the rds.DescribeDBInstanceDetail API synchronously -func (client *Client) DescribeDBInstanceDetail(request *DescribeDBInstanceDetailRequest) (response *DescribeDBInstanceDetailResponse, err error) { - response = CreateDescribeDBInstanceDetailResponse() - err = client.DoAction(request, response) - return -} - -// DescribeDBInstanceDetailWithChan invokes the rds.DescribeDBInstanceDetail API asynchronously -func (client *Client) DescribeDBInstanceDetailWithChan(request *DescribeDBInstanceDetailRequest) (<-chan *DescribeDBInstanceDetailResponse, <-chan error) { - responseChan := make(chan *DescribeDBInstanceDetailResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeDBInstanceDetail(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeDBInstanceDetailWithCallback invokes the rds.DescribeDBInstanceDetail API asynchronously -func (client *Client) DescribeDBInstanceDetailWithCallback(request *DescribeDBInstanceDetailRequest, callback func(response *DescribeDBInstanceDetailResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeDBInstanceDetailResponse - var err error - defer close(result) - response, err = client.DescribeDBInstanceDetail(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeDBInstanceDetailRequest is the request struct for api DescribeDBInstanceDetail -type DescribeDBInstanceDetailRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - ClientToken string `position:"Query" name:"ClientToken"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// DescribeDBInstanceDetailResponse is the response struct for api DescribeDBInstanceDetail -type DescribeDBInstanceDetailResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - RegionId string `json:"RegionId" xml:"RegionId"` - LicenseType string `json:"LicenseType" xml:"LicenseType"` - ActivationState string `json:"ActivationState" xml:"ActivationState"` -} - -// CreateDescribeDBInstanceDetailRequest creates a request to invoke DescribeDBInstanceDetail API -func CreateDescribeDBInstanceDetailRequest() (request *DescribeDBInstanceDetailRequest) { - request = &DescribeDBInstanceDetailRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeDBInstanceDetail", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeDBInstanceDetailResponse creates a response to parse from DescribeDBInstanceDetail response -func CreateDescribeDBInstanceDetailResponse() (response *DescribeDBInstanceDetailResponse) { - response = &DescribeDBInstanceDetailResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_encryption_key.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_encryption_key.go deleted file mode 100644 index 7099717efed..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_encryption_key.go +++ /dev/null @@ -1,114 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeDBInstanceEncryptionKey invokes the rds.DescribeDBInstanceEncryptionKey API synchronously -func (client *Client) DescribeDBInstanceEncryptionKey(request *DescribeDBInstanceEncryptionKeyRequest) (response *DescribeDBInstanceEncryptionKeyResponse, err error) { - response = CreateDescribeDBInstanceEncryptionKeyResponse() - err = client.DoAction(request, response) - return -} - -// DescribeDBInstanceEncryptionKeyWithChan invokes the rds.DescribeDBInstanceEncryptionKey API asynchronously -func (client *Client) DescribeDBInstanceEncryptionKeyWithChan(request *DescribeDBInstanceEncryptionKeyRequest) (<-chan *DescribeDBInstanceEncryptionKeyResponse, <-chan error) { - responseChan := make(chan *DescribeDBInstanceEncryptionKeyResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeDBInstanceEncryptionKey(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeDBInstanceEncryptionKeyWithCallback invokes the rds.DescribeDBInstanceEncryptionKey API asynchronously -func (client *Client) DescribeDBInstanceEncryptionKeyWithCallback(request *DescribeDBInstanceEncryptionKeyRequest, callback func(response *DescribeDBInstanceEncryptionKeyResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeDBInstanceEncryptionKeyResponse - var err error - defer close(result) - response, err = client.DescribeDBInstanceEncryptionKey(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeDBInstanceEncryptionKeyRequest is the request struct for api DescribeDBInstanceEncryptionKey -type DescribeDBInstanceEncryptionKeyRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - SecurityToken string `position:"Query" name:"SecurityToken"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - EncryptionKey string `position:"Query" name:"EncryptionKey"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - TargetRegionId string `position:"Query" name:"TargetRegionId"` -} - -// DescribeDBInstanceEncryptionKeyResponse is the response struct for api DescribeDBInstanceEncryptionKey -type DescribeDBInstanceEncryptionKeyResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - EncryptionKey string `json:"EncryptionKey" xml:"EncryptionKey"` - Description string `json:"Description" xml:"Description"` - KeyUsage string `json:"KeyUsage" xml:"KeyUsage"` - DeleteDate string `json:"DeleteDate" xml:"DeleteDate"` - Creator string `json:"Creator" xml:"Creator"` - Origin string `json:"Origin" xml:"Origin"` - MaterialExpireTime string `json:"MaterialExpireTime" xml:"MaterialExpireTime"` - EncryptionKeyStatus string `json:"EncryptionKeyStatus" xml:"EncryptionKeyStatus"` -} - -// CreateDescribeDBInstanceEncryptionKeyRequest creates a request to invoke DescribeDBInstanceEncryptionKey API -func CreateDescribeDBInstanceEncryptionKeyRequest() (request *DescribeDBInstanceEncryptionKeyRequest) { - request = &DescribeDBInstanceEncryptionKeyRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeDBInstanceEncryptionKey", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeDBInstanceEncryptionKeyResponse creates a response to parse from DescribeDBInstanceEncryptionKey response -func CreateDescribeDBInstanceEncryptionKeyResponse() (response *DescribeDBInstanceEncryptionKeyResponse) { - response = &DescribeDBInstanceEncryptionKeyResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_ha_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_ha_config.go deleted file mode 100644 index 8496e810da8..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_ha_config.go +++ /dev/null @@ -1,107 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeDBInstanceHAConfig invokes the rds.DescribeDBInstanceHAConfig API synchronously -func (client *Client) DescribeDBInstanceHAConfig(request *DescribeDBInstanceHAConfigRequest) (response *DescribeDBInstanceHAConfigResponse, err error) { - response = CreateDescribeDBInstanceHAConfigResponse() - err = client.DoAction(request, response) - return -} - -// DescribeDBInstanceHAConfigWithChan invokes the rds.DescribeDBInstanceHAConfig API asynchronously -func (client *Client) DescribeDBInstanceHAConfigWithChan(request *DescribeDBInstanceHAConfigRequest) (<-chan *DescribeDBInstanceHAConfigResponse, <-chan error) { - responseChan := make(chan *DescribeDBInstanceHAConfigResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeDBInstanceHAConfig(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeDBInstanceHAConfigWithCallback invokes the rds.DescribeDBInstanceHAConfig API asynchronously -func (client *Client) DescribeDBInstanceHAConfigWithCallback(request *DescribeDBInstanceHAConfigRequest, callback func(response *DescribeDBInstanceHAConfigResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeDBInstanceHAConfigResponse - var err error - defer close(result) - response, err = client.DescribeDBInstanceHAConfig(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeDBInstanceHAConfigRequest is the request struct for api DescribeDBInstanceHAConfig -type DescribeDBInstanceHAConfigRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// DescribeDBInstanceHAConfigResponse is the response struct for api DescribeDBInstanceHAConfig -type DescribeDBInstanceHAConfigResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - SyncMode string `json:"SyncMode" xml:"SyncMode"` - HAMode string `json:"HAMode" xml:"HAMode"` - HostInstanceInfos HostInstanceInfos `json:"HostInstanceInfos" xml:"HostInstanceInfos"` -} - -// CreateDescribeDBInstanceHAConfigRequest creates a request to invoke DescribeDBInstanceHAConfig API -func CreateDescribeDBInstanceHAConfigRequest() (request *DescribeDBInstanceHAConfigRequest) { - request = &DescribeDBInstanceHAConfigRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeDBInstanceHAConfig", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeDBInstanceHAConfigResponse creates a response to parse from DescribeDBInstanceHAConfig response -func CreateDescribeDBInstanceHAConfigResponse() (response *DescribeDBInstanceHAConfigResponse) { - response = &DescribeDBInstanceHAConfigResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_ip_array_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_ip_array_list.go deleted file mode 100644 index 29a82d5a5e0..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_ip_array_list.go +++ /dev/null @@ -1,105 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeDBInstanceIPArrayList invokes the rds.DescribeDBInstanceIPArrayList API synchronously -func (client *Client) DescribeDBInstanceIPArrayList(request *DescribeDBInstanceIPArrayListRequest) (response *DescribeDBInstanceIPArrayListResponse, err error) { - response = CreateDescribeDBInstanceIPArrayListResponse() - err = client.DoAction(request, response) - return -} - -// DescribeDBInstanceIPArrayListWithChan invokes the rds.DescribeDBInstanceIPArrayList API asynchronously -func (client *Client) DescribeDBInstanceIPArrayListWithChan(request *DescribeDBInstanceIPArrayListRequest) (<-chan *DescribeDBInstanceIPArrayListResponse, <-chan error) { - responseChan := make(chan *DescribeDBInstanceIPArrayListResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeDBInstanceIPArrayList(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeDBInstanceIPArrayListWithCallback invokes the rds.DescribeDBInstanceIPArrayList API asynchronously -func (client *Client) DescribeDBInstanceIPArrayListWithCallback(request *DescribeDBInstanceIPArrayListRequest, callback func(response *DescribeDBInstanceIPArrayListResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeDBInstanceIPArrayListResponse - var err error - defer close(result) - response, err = client.DescribeDBInstanceIPArrayList(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeDBInstanceIPArrayListRequest is the request struct for api DescribeDBInstanceIPArrayList -type DescribeDBInstanceIPArrayListRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - WhitelistNetworkType string `position:"Query" name:"WhitelistNetworkType"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// DescribeDBInstanceIPArrayListResponse is the response struct for api DescribeDBInstanceIPArrayList -type DescribeDBInstanceIPArrayListResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Items ItemsInDescribeDBInstanceIPArrayList `json:"Items" xml:"Items"` -} - -// CreateDescribeDBInstanceIPArrayListRequest creates a request to invoke DescribeDBInstanceIPArrayList API -func CreateDescribeDBInstanceIPArrayListRequest() (request *DescribeDBInstanceIPArrayListRequest) { - request = &DescribeDBInstanceIPArrayListRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeDBInstanceIPArrayList", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeDBInstanceIPArrayListResponse creates a response to parse from DescribeDBInstanceIPArrayList response -func CreateDescribeDBInstanceIPArrayListResponse() (response *DescribeDBInstanceIPArrayListResponse) { - response = &DescribeDBInstanceIPArrayListResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_ip_hostname.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_ip_hostname.go deleted file mode 100644 index bf6664b3f69..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_ip_hostname.go +++ /dev/null @@ -1,106 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeDBInstanceIpHostname invokes the rds.DescribeDBInstanceIpHostname API synchronously -func (client *Client) DescribeDBInstanceIpHostname(request *DescribeDBInstanceIpHostnameRequest) (response *DescribeDBInstanceIpHostnameResponse, err error) { - response = CreateDescribeDBInstanceIpHostnameResponse() - err = client.DoAction(request, response) - return -} - -// DescribeDBInstanceIpHostnameWithChan invokes the rds.DescribeDBInstanceIpHostname API asynchronously -func (client *Client) DescribeDBInstanceIpHostnameWithChan(request *DescribeDBInstanceIpHostnameRequest) (<-chan *DescribeDBInstanceIpHostnameResponse, <-chan error) { - responseChan := make(chan *DescribeDBInstanceIpHostnameResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeDBInstanceIpHostname(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeDBInstanceIpHostnameWithCallback invokes the rds.DescribeDBInstanceIpHostname API asynchronously -func (client *Client) DescribeDBInstanceIpHostnameWithCallback(request *DescribeDBInstanceIpHostnameRequest, callback func(response *DescribeDBInstanceIpHostnameResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeDBInstanceIpHostnameResponse - var err error - defer close(result) - response, err = client.DescribeDBInstanceIpHostname(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeDBInstanceIpHostnameRequest is the request struct for api DescribeDBInstanceIpHostname -type DescribeDBInstanceIpHostnameRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - SecurityToken string `position:"Query" name:"SecurityToken"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// DescribeDBInstanceIpHostnameResponse is the response struct for api DescribeDBInstanceIpHostname -type DescribeDBInstanceIpHostnameResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - IpHostnameInfos string `json:"IpHostnameInfos" xml:"IpHostnameInfos"` -} - -// CreateDescribeDBInstanceIpHostnameRequest creates a request to invoke DescribeDBInstanceIpHostname API -func CreateDescribeDBInstanceIpHostnameRequest() (request *DescribeDBInstanceIpHostnameRequest) { - request = &DescribeDBInstanceIpHostnameRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeDBInstanceIpHostname", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeDBInstanceIpHostnameResponse creates a response to parse from DescribeDBInstanceIpHostname response -func CreateDescribeDBInstanceIpHostnameResponse() (response *DescribeDBInstanceIpHostnameResponse) { - response = &DescribeDBInstanceIpHostnameResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_monitor.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_monitor.go deleted file mode 100644 index 77f0db2ea84..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_monitor.go +++ /dev/null @@ -1,105 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeDBInstanceMonitor invokes the rds.DescribeDBInstanceMonitor API synchronously -func (client *Client) DescribeDBInstanceMonitor(request *DescribeDBInstanceMonitorRequest) (response *DescribeDBInstanceMonitorResponse, err error) { - response = CreateDescribeDBInstanceMonitorResponse() - err = client.DoAction(request, response) - return -} - -// DescribeDBInstanceMonitorWithChan invokes the rds.DescribeDBInstanceMonitor API asynchronously -func (client *Client) DescribeDBInstanceMonitorWithChan(request *DescribeDBInstanceMonitorRequest) (<-chan *DescribeDBInstanceMonitorResponse, <-chan error) { - responseChan := make(chan *DescribeDBInstanceMonitorResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeDBInstanceMonitor(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeDBInstanceMonitorWithCallback invokes the rds.DescribeDBInstanceMonitor API asynchronously -func (client *Client) DescribeDBInstanceMonitorWithCallback(request *DescribeDBInstanceMonitorRequest, callback func(response *DescribeDBInstanceMonitorResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeDBInstanceMonitorResponse - var err error - defer close(result) - response, err = client.DescribeDBInstanceMonitor(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeDBInstanceMonitorRequest is the request struct for api DescribeDBInstanceMonitor -type DescribeDBInstanceMonitorRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - ClientToken string `position:"Query" name:"ClientToken"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// DescribeDBInstanceMonitorResponse is the response struct for api DescribeDBInstanceMonitor -type DescribeDBInstanceMonitorResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Period string `json:"Period" xml:"Period"` -} - -// CreateDescribeDBInstanceMonitorRequest creates a request to invoke DescribeDBInstanceMonitor API -func CreateDescribeDBInstanceMonitorRequest() (request *DescribeDBInstanceMonitorRequest) { - request = &DescribeDBInstanceMonitorRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeDBInstanceMonitor", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeDBInstanceMonitorResponse creates a response to parse from DescribeDBInstanceMonitor response -func CreateDescribeDBInstanceMonitorResponse() (response *DescribeDBInstanceMonitorResponse) { - response = &DescribeDBInstanceMonitorResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_net_info.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_net_info.go deleted file mode 100644 index 576e229a14c..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_net_info.go +++ /dev/null @@ -1,109 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeDBInstanceNetInfo invokes the rds.DescribeDBInstanceNetInfo API synchronously -func (client *Client) DescribeDBInstanceNetInfo(request *DescribeDBInstanceNetInfoRequest) (response *DescribeDBInstanceNetInfoResponse, err error) { - response = CreateDescribeDBInstanceNetInfoResponse() - err = client.DoAction(request, response) - return -} - -// DescribeDBInstanceNetInfoWithChan invokes the rds.DescribeDBInstanceNetInfo API asynchronously -func (client *Client) DescribeDBInstanceNetInfoWithChan(request *DescribeDBInstanceNetInfoRequest) (<-chan *DescribeDBInstanceNetInfoResponse, <-chan error) { - responseChan := make(chan *DescribeDBInstanceNetInfoResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeDBInstanceNetInfo(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeDBInstanceNetInfoWithCallback invokes the rds.DescribeDBInstanceNetInfo API asynchronously -func (client *Client) DescribeDBInstanceNetInfoWithCallback(request *DescribeDBInstanceNetInfoRequest, callback func(response *DescribeDBInstanceNetInfoResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeDBInstanceNetInfoResponse - var err error - defer close(result) - response, err = client.DescribeDBInstanceNetInfo(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeDBInstanceNetInfoRequest is the request struct for api DescribeDBInstanceNetInfo -type DescribeDBInstanceNetInfoRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - Flag requests.Integer `position:"Query" name:"Flag"` - ClientToken string `position:"Query" name:"ClientToken"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceNetRWSplitType string `position:"Query" name:"DBInstanceNetRWSplitType"` -} - -// DescribeDBInstanceNetInfoResponse is the response struct for api DescribeDBInstanceNetInfo -type DescribeDBInstanceNetInfoResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - InstanceNetworkType string `json:"InstanceNetworkType" xml:"InstanceNetworkType"` - SecurityIPMode string `json:"SecurityIPMode" xml:"SecurityIPMode"` - DBInstanceNetInfos DBInstanceNetInfos `json:"DBInstanceNetInfos" xml:"DBInstanceNetInfos"` -} - -// CreateDescribeDBInstanceNetInfoRequest creates a request to invoke DescribeDBInstanceNetInfo API -func CreateDescribeDBInstanceNetInfoRequest() (request *DescribeDBInstanceNetInfoRequest) { - request = &DescribeDBInstanceNetInfoRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeDBInstanceNetInfo", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeDBInstanceNetInfoResponse creates a response to parse from DescribeDBInstanceNetInfo response -func CreateDescribeDBInstanceNetInfoResponse() (response *DescribeDBInstanceNetInfoResponse) { - response = &DescribeDBInstanceNetInfoResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_performance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_performance.go deleted file mode 100644 index cb87e845b31..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_performance.go +++ /dev/null @@ -1,113 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeDBInstancePerformance invokes the rds.DescribeDBInstancePerformance API synchronously -func (client *Client) DescribeDBInstancePerformance(request *DescribeDBInstancePerformanceRequest) (response *DescribeDBInstancePerformanceResponse, err error) { - response = CreateDescribeDBInstancePerformanceResponse() - err = client.DoAction(request, response) - return -} - -// DescribeDBInstancePerformanceWithChan invokes the rds.DescribeDBInstancePerformance API asynchronously -func (client *Client) DescribeDBInstancePerformanceWithChan(request *DescribeDBInstancePerformanceRequest) (<-chan *DescribeDBInstancePerformanceResponse, <-chan error) { - responseChan := make(chan *DescribeDBInstancePerformanceResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeDBInstancePerformance(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeDBInstancePerformanceWithCallback invokes the rds.DescribeDBInstancePerformance API asynchronously -func (client *Client) DescribeDBInstancePerformanceWithCallback(request *DescribeDBInstancePerformanceRequest, callback func(response *DescribeDBInstancePerformanceResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeDBInstancePerformanceResponse - var err error - defer close(result) - response, err = client.DescribeDBInstancePerformance(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeDBInstancePerformanceRequest is the request struct for api DescribeDBInstancePerformance -type DescribeDBInstancePerformanceRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - RoleId string `position:"Query" name:"RoleId"` - StartTime string `position:"Query" name:"StartTime"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - Key string `position:"Query" name:"Key"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - EndTime string `position:"Query" name:"EndTime"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - UseNullWhenMissingPoint requests.Boolean `position:"Query" name:"UseNullWhenMissingPoint"` -} - -// DescribeDBInstancePerformanceResponse is the response struct for api DescribeDBInstancePerformance -type DescribeDBInstancePerformanceResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - Engine string `json:"Engine" xml:"Engine"` - StartTime string `json:"StartTime" xml:"StartTime"` - EndTime string `json:"EndTime" xml:"EndTime"` - PerformanceKeys PerformanceKeysInDescribeDBInstancePerformance `json:"PerformanceKeys" xml:"PerformanceKeys"` -} - -// CreateDescribeDBInstancePerformanceRequest creates a request to invoke DescribeDBInstancePerformance API -func CreateDescribeDBInstancePerformanceRequest() (request *DescribeDBInstancePerformanceRequest) { - request = &DescribeDBInstancePerformanceRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeDBInstancePerformance", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeDBInstancePerformanceResponse creates a response to parse from DescribeDBInstancePerformance response -func CreateDescribeDBInstancePerformanceResponse() (response *DescribeDBInstancePerformanceResponse) { - response = &DescribeDBInstancePerformanceResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_proxy_configuration.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_proxy_configuration.go deleted file mode 100644 index 8f8676fd729..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_proxy_configuration.go +++ /dev/null @@ -1,105 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeDBInstanceProxyConfiguration invokes the rds.DescribeDBInstanceProxyConfiguration API synchronously -func (client *Client) DescribeDBInstanceProxyConfiguration(request *DescribeDBInstanceProxyConfigurationRequest) (response *DescribeDBInstanceProxyConfigurationResponse, err error) { - response = CreateDescribeDBInstanceProxyConfigurationResponse() - err = client.DoAction(request, response) - return -} - -// DescribeDBInstanceProxyConfigurationWithChan invokes the rds.DescribeDBInstanceProxyConfiguration API asynchronously -func (client *Client) DescribeDBInstanceProxyConfigurationWithChan(request *DescribeDBInstanceProxyConfigurationRequest) (<-chan *DescribeDBInstanceProxyConfigurationResponse, <-chan error) { - responseChan := make(chan *DescribeDBInstanceProxyConfigurationResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeDBInstanceProxyConfiguration(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeDBInstanceProxyConfigurationWithCallback invokes the rds.DescribeDBInstanceProxyConfiguration API asynchronously -func (client *Client) DescribeDBInstanceProxyConfigurationWithCallback(request *DescribeDBInstanceProxyConfigurationRequest, callback func(response *DescribeDBInstanceProxyConfigurationResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeDBInstanceProxyConfigurationResponse - var err error - defer close(result) - response, err = client.DescribeDBInstanceProxyConfiguration(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeDBInstanceProxyConfigurationRequest is the request struct for api DescribeDBInstanceProxyConfiguration -type DescribeDBInstanceProxyConfigurationRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// DescribeDBInstanceProxyConfigurationResponse is the response struct for api DescribeDBInstanceProxyConfiguration -type DescribeDBInstanceProxyConfigurationResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - TransparentSwitchConfiguration string `json:"TransparentSwitchConfiguration" xml:"TransparentSwitchConfiguration"` - PersistentConnectionsConfiguration string `json:"PersistentConnectionsConfiguration" xml:"PersistentConnectionsConfiguration"` - AttacksProtectionConfiguration string `json:"AttacksProtectionConfiguration" xml:"AttacksProtectionConfiguration"` -} - -// CreateDescribeDBInstanceProxyConfigurationRequest creates a request to invoke DescribeDBInstanceProxyConfiguration API -func CreateDescribeDBInstanceProxyConfigurationRequest() (request *DescribeDBInstanceProxyConfigurationRequest) { - request = &DescribeDBInstanceProxyConfigurationRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeDBInstanceProxyConfiguration", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeDBInstanceProxyConfigurationResponse creates a response to parse from DescribeDBInstanceProxyConfiguration response -func CreateDescribeDBInstanceProxyConfigurationResponse() (response *DescribeDBInstanceProxyConfigurationResponse) { - response = &DescribeDBInstanceProxyConfigurationResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_ssl.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_ssl.go deleted file mode 100644 index 53ba6d19d5a..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_ssl.go +++ /dev/null @@ -1,107 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeDBInstanceSSL invokes the rds.DescribeDBInstanceSSL API synchronously -func (client *Client) DescribeDBInstanceSSL(request *DescribeDBInstanceSSLRequest) (response *DescribeDBInstanceSSLResponse, err error) { - response = CreateDescribeDBInstanceSSLResponse() - err = client.DoAction(request, response) - return -} - -// DescribeDBInstanceSSLWithChan invokes the rds.DescribeDBInstanceSSL API asynchronously -func (client *Client) DescribeDBInstanceSSLWithChan(request *DescribeDBInstanceSSLRequest) (<-chan *DescribeDBInstanceSSLResponse, <-chan error) { - responseChan := make(chan *DescribeDBInstanceSSLResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeDBInstanceSSL(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeDBInstanceSSLWithCallback invokes the rds.DescribeDBInstanceSSL API asynchronously -func (client *Client) DescribeDBInstanceSSLWithCallback(request *DescribeDBInstanceSSLRequest, callback func(response *DescribeDBInstanceSSLResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeDBInstanceSSLResponse - var err error - defer close(result) - response, err = client.DescribeDBInstanceSSL(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeDBInstanceSSLRequest is the request struct for api DescribeDBInstanceSSL -type DescribeDBInstanceSSLRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// DescribeDBInstanceSSLResponse is the response struct for api DescribeDBInstanceSSL -type DescribeDBInstanceSSLResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - ConnectionString string `json:"ConnectionString" xml:"ConnectionString"` - SSLExpireTime string `json:"SSLExpireTime" xml:"SSLExpireTime"` - RequireUpdate string `json:"RequireUpdate" xml:"RequireUpdate"` - RequireUpdateReason string `json:"RequireUpdateReason" xml:"RequireUpdateReason"` -} - -// CreateDescribeDBInstanceSSLRequest creates a request to invoke DescribeDBInstanceSSL API -func CreateDescribeDBInstanceSSLRequest() (request *DescribeDBInstanceSSLRequest) { - request = &DescribeDBInstanceSSLRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeDBInstanceSSL", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeDBInstanceSSLResponse creates a response to parse from DescribeDBInstanceSSL response -func CreateDescribeDBInstanceSSLResponse() (response *DescribeDBInstanceSSLResponse) { - response = &DescribeDBInstanceSSLResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_tde.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_tde.go deleted file mode 100644 index fb762b9f2ea..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instance_tde.go +++ /dev/null @@ -1,105 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeDBInstanceTDE invokes the rds.DescribeDBInstanceTDE API synchronously -func (client *Client) DescribeDBInstanceTDE(request *DescribeDBInstanceTDERequest) (response *DescribeDBInstanceTDEResponse, err error) { - response = CreateDescribeDBInstanceTDEResponse() - err = client.DoAction(request, response) - return -} - -// DescribeDBInstanceTDEWithChan invokes the rds.DescribeDBInstanceTDE API asynchronously -func (client *Client) DescribeDBInstanceTDEWithChan(request *DescribeDBInstanceTDERequest) (<-chan *DescribeDBInstanceTDEResponse, <-chan error) { - responseChan := make(chan *DescribeDBInstanceTDEResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeDBInstanceTDE(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeDBInstanceTDEWithCallback invokes the rds.DescribeDBInstanceTDE API asynchronously -func (client *Client) DescribeDBInstanceTDEWithCallback(request *DescribeDBInstanceTDERequest, callback func(response *DescribeDBInstanceTDEResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeDBInstanceTDEResponse - var err error - defer close(result) - response, err = client.DescribeDBInstanceTDE(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeDBInstanceTDERequest is the request struct for api DescribeDBInstanceTDE -type DescribeDBInstanceTDERequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// DescribeDBInstanceTDEResponse is the response struct for api DescribeDBInstanceTDE -type DescribeDBInstanceTDEResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - TDEStatus string `json:"TDEStatus" xml:"TDEStatus"` - Databases DatabasesInDescribeDBInstanceTDE `json:"Databases" xml:"Databases"` -} - -// CreateDescribeDBInstanceTDERequest creates a request to invoke DescribeDBInstanceTDE API -func CreateDescribeDBInstanceTDERequest() (request *DescribeDBInstanceTDERequest) { - request = &DescribeDBInstanceTDERequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeDBInstanceTDE", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeDBInstanceTDEResponse creates a response to parse from DescribeDBInstanceTDE response -func CreateDescribeDBInstanceTDEResponse() (response *DescribeDBInstanceTDEResponse) { - response = &DescribeDBInstanceTDEResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instances.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instances.go deleted file mode 100644 index 82c2e27ffe7..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instances.go +++ /dev/null @@ -1,141 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeDBInstances invokes the rds.DescribeDBInstances API synchronously -func (client *Client) DescribeDBInstances(request *DescribeDBInstancesRequest) (response *DescribeDBInstancesResponse, err error) { - response = CreateDescribeDBInstancesResponse() - err = client.DoAction(request, response) - return -} - -// DescribeDBInstancesWithChan invokes the rds.DescribeDBInstances API asynchronously -func (client *Client) DescribeDBInstancesWithChan(request *DescribeDBInstancesRequest) (<-chan *DescribeDBInstancesResponse, <-chan error) { - responseChan := make(chan *DescribeDBInstancesResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeDBInstances(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeDBInstancesWithCallback invokes the rds.DescribeDBInstances API asynchronously -func (client *Client) DescribeDBInstancesWithCallback(request *DescribeDBInstancesRequest, callback func(response *DescribeDBInstancesResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeDBInstancesResponse - var err error - defer close(result) - response, err = client.DescribeDBInstances(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeDBInstancesRequest is the request struct for api DescribeDBInstances -type DescribeDBInstancesRequest struct { - *requests.RpcRequest - Tag4Value string `position:"Query" name:"Tag.4.value"` - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - Tag2Key string `position:"Query" name:"Tag.2.key"` - ConnectionString string `position:"Query" name:"ConnectionString"` - NeedVpcName requests.Boolean `position:"Query" name:"NeedVpcName"` - Tag3Key string `position:"Query" name:"Tag.3.key"` - EngineVersion string `position:"Query" name:"EngineVersion"` - Tag1Value string `position:"Query" name:"Tag.1.value"` - ResourceGroupId string `position:"Query" name:"ResourceGroupId"` - ProxyId string `position:"Query" name:"proxyId"` - Tag5Key string `position:"Query" name:"Tag.5.key"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceType string `position:"Query" name:"DBInstanceType"` - DBInstanceClass string `position:"Query" name:"DBInstanceClass"` - Tags string `position:"Query" name:"Tags"` - VSwitchId string `position:"Query" name:"VSwitchId"` - ZoneId string `position:"Query" name:"ZoneId"` - Tag4Key string `position:"Query" name:"Tag.4.key"` - InstanceNetworkType string `position:"Query" name:"InstanceNetworkType"` - ConnectionMode string `position:"Query" name:"ConnectionMode"` - ClientToken string `position:"Query" name:"ClientToken"` - InstanceLevel requests.Integer `position:"Query" name:"InstanceLevel"` - SearchKey string `position:"Query" name:"SearchKey"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - Expired string `position:"Query" name:"Expired"` - Engine string `position:"Query" name:"Engine"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - DBInstanceStatus string `position:"Query" name:"DBInstanceStatus"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - DedicatedHostGroupId string `position:"Query" name:"DedicatedHostGroupId"` - Tag3Value string `position:"Query" name:"Tag.3.value"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - DedicatedHostId string `position:"Query" name:"DedicatedHostId"` - Tag5Value string `position:"Query" name:"Tag.5.value"` - Tag1Key string `position:"Query" name:"Tag.1.key"` - VpcId string `position:"Query" name:"VpcId"` - Tag2Value string `position:"Query" name:"Tag.2.value"` - PayType string `position:"Query" name:"PayType"` -} - -// DescribeDBInstancesResponse is the response struct for api DescribeDBInstances -type DescribeDBInstancesResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - PageNumber int `json:"PageNumber" xml:"PageNumber"` - TotalRecordCount int `json:"TotalRecordCount" xml:"TotalRecordCount"` - PageRecordCount int `json:"PageRecordCount" xml:"PageRecordCount"` - Items ItemsInDescribeDBInstances `json:"Items" xml:"Items"` -} - -// CreateDescribeDBInstancesRequest creates a request to invoke DescribeDBInstances API -func CreateDescribeDBInstancesRequest() (request *DescribeDBInstancesRequest) { - request = &DescribeDBInstancesRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeDBInstances", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeDBInstancesResponse creates a response to parse from DescribeDBInstances response -func CreateDescribeDBInstancesResponse() (response *DescribeDBInstancesResponse) { - response = &DescribeDBInstancesResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instances_as_csv.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instances_as_csv.go deleted file mode 100644 index cf96875ac39..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instances_as_csv.go +++ /dev/null @@ -1,103 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeDBInstancesAsCsv invokes the rds.DescribeDBInstancesAsCsv API synchronously -func (client *Client) DescribeDBInstancesAsCsv(request *DescribeDBInstancesAsCsvRequest) (response *DescribeDBInstancesAsCsvResponse, err error) { - response = CreateDescribeDBInstancesAsCsvResponse() - err = client.DoAction(request, response) - return -} - -// DescribeDBInstancesAsCsvWithChan invokes the rds.DescribeDBInstancesAsCsv API asynchronously -func (client *Client) DescribeDBInstancesAsCsvWithChan(request *DescribeDBInstancesAsCsvRequest) (<-chan *DescribeDBInstancesAsCsvResponse, <-chan error) { - responseChan := make(chan *DescribeDBInstancesAsCsvResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeDBInstancesAsCsv(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeDBInstancesAsCsvWithCallback invokes the rds.DescribeDBInstancesAsCsv API asynchronously -func (client *Client) DescribeDBInstancesAsCsvWithCallback(request *DescribeDBInstancesAsCsvRequest, callback func(response *DescribeDBInstancesAsCsvResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeDBInstancesAsCsvResponse - var err error - defer close(result) - response, err = client.DescribeDBInstancesAsCsv(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeDBInstancesAsCsvRequest is the request struct for api DescribeDBInstancesAsCsv -type DescribeDBInstancesAsCsvRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// DescribeDBInstancesAsCsvResponse is the response struct for api DescribeDBInstancesAsCsv -type DescribeDBInstancesAsCsvResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Items ItemsInDescribeDBInstancesAsCsv `json:"Items" xml:"Items"` -} - -// CreateDescribeDBInstancesAsCsvRequest creates a request to invoke DescribeDBInstancesAsCsv API -func CreateDescribeDBInstancesAsCsvRequest() (request *DescribeDBInstancesAsCsvRequest) { - request = &DescribeDBInstancesAsCsvRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeDBInstancesAsCsv", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeDBInstancesAsCsvResponse creates a response to parse from DescribeDBInstancesAsCsv response -func CreateDescribeDBInstancesAsCsvResponse() (response *DescribeDBInstancesAsCsvResponse) { - response = &DescribeDBInstancesAsCsvResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instances_by_expire_time.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instances_by_expire_time.go deleted file mode 100644 index 77010d7c252..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instances_by_expire_time.go +++ /dev/null @@ -1,112 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeDBInstancesByExpireTime invokes the rds.DescribeDBInstancesByExpireTime API synchronously -func (client *Client) DescribeDBInstancesByExpireTime(request *DescribeDBInstancesByExpireTimeRequest) (response *DescribeDBInstancesByExpireTimeResponse, err error) { - response = CreateDescribeDBInstancesByExpireTimeResponse() - err = client.DoAction(request, response) - return -} - -// DescribeDBInstancesByExpireTimeWithChan invokes the rds.DescribeDBInstancesByExpireTime API asynchronously -func (client *Client) DescribeDBInstancesByExpireTimeWithChan(request *DescribeDBInstancesByExpireTimeRequest) (<-chan *DescribeDBInstancesByExpireTimeResponse, <-chan error) { - responseChan := make(chan *DescribeDBInstancesByExpireTimeResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeDBInstancesByExpireTime(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeDBInstancesByExpireTimeWithCallback invokes the rds.DescribeDBInstancesByExpireTime API asynchronously -func (client *Client) DescribeDBInstancesByExpireTimeWithCallback(request *DescribeDBInstancesByExpireTimeRequest, callback func(response *DescribeDBInstancesByExpireTimeResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeDBInstancesByExpireTimeResponse - var err error - defer close(result) - response, err = client.DescribeDBInstancesByExpireTime(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeDBInstancesByExpireTimeRequest is the request struct for api DescribeDBInstancesByExpireTime -type DescribeDBInstancesByExpireTimeRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - Expired requests.Boolean `position:"Query" name:"Expired"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - ExpirePeriod requests.Integer `position:"Query" name:"ExpirePeriod"` - ProxyId string `position:"Query" name:"proxyId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - Tags string `position:"Query" name:"Tags"` -} - -// DescribeDBInstancesByExpireTimeResponse is the response struct for api DescribeDBInstancesByExpireTime -type DescribeDBInstancesByExpireTimeResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - PageNumber int `json:"PageNumber" xml:"PageNumber"` - TotalRecordCount int `json:"TotalRecordCount" xml:"TotalRecordCount"` - PageRecordCount int `json:"PageRecordCount" xml:"PageRecordCount"` - Items ItemsInDescribeDBInstancesByExpireTime `json:"Items" xml:"Items"` -} - -// CreateDescribeDBInstancesByExpireTimeRequest creates a request to invoke DescribeDBInstancesByExpireTime API -func CreateDescribeDBInstancesByExpireTimeRequest() (request *DescribeDBInstancesByExpireTimeRequest) { - request = &DescribeDBInstancesByExpireTimeRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeDBInstancesByExpireTime", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeDBInstancesByExpireTimeResponse creates a response to parse from DescribeDBInstancesByExpireTime response -func CreateDescribeDBInstancesByExpireTimeResponse() (response *DescribeDBInstancesByExpireTimeResponse) { - response = &DescribeDBInstancesByExpireTimeResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instances_by_performance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instances_by_performance.go deleted file mode 100644 index 5f40f648bbf..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instances_by_performance.go +++ /dev/null @@ -1,124 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeDBInstancesByPerformance invokes the rds.DescribeDBInstancesByPerformance API synchronously -func (client *Client) DescribeDBInstancesByPerformance(request *DescribeDBInstancesByPerformanceRequest) (response *DescribeDBInstancesByPerformanceResponse, err error) { - response = CreateDescribeDBInstancesByPerformanceResponse() - err = client.DoAction(request, response) - return -} - -// DescribeDBInstancesByPerformanceWithChan invokes the rds.DescribeDBInstancesByPerformance API asynchronously -func (client *Client) DescribeDBInstancesByPerformanceWithChan(request *DescribeDBInstancesByPerformanceRequest) (<-chan *DescribeDBInstancesByPerformanceResponse, <-chan error) { - responseChan := make(chan *DescribeDBInstancesByPerformanceResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeDBInstancesByPerformance(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeDBInstancesByPerformanceWithCallback invokes the rds.DescribeDBInstancesByPerformance API asynchronously -func (client *Client) DescribeDBInstancesByPerformanceWithCallback(request *DescribeDBInstancesByPerformanceRequest, callback func(response *DescribeDBInstancesByPerformanceResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeDBInstancesByPerformanceResponse - var err error - defer close(result) - response, err = client.DescribeDBInstancesByPerformance(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeDBInstancesByPerformanceRequest is the request struct for api DescribeDBInstancesByPerformance -type DescribeDBInstancesByPerformanceRequest struct { - *requests.RpcRequest - Tag4Value string `position:"Query" name:"Tag.4.value"` - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - Tag2Key string `position:"Query" name:"Tag.2.key"` - ClientToken string `position:"Query" name:"ClientToken"` - Tag3Key string `position:"Query" name:"Tag.3.key"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - Tag1Value string `position:"Query" name:"Tag.1.value"` - SortKey string `position:"Query" name:"SortKey"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - Tag3Value string `position:"Query" name:"Tag.3.value"` - ProxyId string `position:"Query" name:"proxyId"` - Tag5Key string `position:"Query" name:"Tag.5.key"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - Tag5Value string `position:"Query" name:"Tag.5.value"` - Tags string `position:"Query" name:"Tags"` - Tag1Key string `position:"Query" name:"Tag.1.key"` - SortMethod string `position:"Query" name:"SortMethod"` - Tag2Value string `position:"Query" name:"Tag.2.value"` - Tag4Key string `position:"Query" name:"Tag.4.key"` -} - -// DescribeDBInstancesByPerformanceResponse is the response struct for api DescribeDBInstancesByPerformance -type DescribeDBInstancesByPerformanceResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - PageNumber int `json:"PageNumber" xml:"PageNumber"` - TotalRecordCount int `json:"TotalRecordCount" xml:"TotalRecordCount"` - PageRecordCount int `json:"PageRecordCount" xml:"PageRecordCount"` - Items ItemsInDescribeDBInstancesByPerformance `json:"Items" xml:"Items"` -} - -// CreateDescribeDBInstancesByPerformanceRequest creates a request to invoke DescribeDBInstancesByPerformance API -func CreateDescribeDBInstancesByPerformanceRequest() (request *DescribeDBInstancesByPerformanceRequest) { - request = &DescribeDBInstancesByPerformanceRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeDBInstancesByPerformance", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeDBInstancesByPerformanceResponse creates a response to parse from DescribeDBInstancesByPerformance response -func CreateDescribeDBInstancesByPerformanceResponse() (response *DescribeDBInstancesByPerformanceResponse) { - response = &DescribeDBInstancesByPerformanceResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instances_for_clone.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instances_for_clone.go deleted file mode 100644 index 0749a809927..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_instances_for_clone.go +++ /dev/null @@ -1,126 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeDBInstancesForClone invokes the rds.DescribeDBInstancesForClone API synchronously -func (client *Client) DescribeDBInstancesForClone(request *DescribeDBInstancesForCloneRequest) (response *DescribeDBInstancesForCloneResponse, err error) { - response = CreateDescribeDBInstancesForCloneResponse() - err = client.DoAction(request, response) - return -} - -// DescribeDBInstancesForCloneWithChan invokes the rds.DescribeDBInstancesForClone API asynchronously -func (client *Client) DescribeDBInstancesForCloneWithChan(request *DescribeDBInstancesForCloneRequest) (<-chan *DescribeDBInstancesForCloneResponse, <-chan error) { - responseChan := make(chan *DescribeDBInstancesForCloneResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeDBInstancesForClone(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeDBInstancesForCloneWithCallback invokes the rds.DescribeDBInstancesForClone API asynchronously -func (client *Client) DescribeDBInstancesForCloneWithCallback(request *DescribeDBInstancesForCloneRequest, callback func(response *DescribeDBInstancesForCloneResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeDBInstancesForCloneResponse - var err error - defer close(result) - response, err = client.DescribeDBInstancesForClone(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeDBInstancesForCloneRequest is the request struct for api DescribeDBInstancesForClone -type DescribeDBInstancesForCloneRequest struct { - *requests.RpcRequest - ConnectionMode string `position:"Query" name:"ConnectionMode"` - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - NodeType string `position:"Query" name:"NodeType"` - ClientToken string `position:"Query" name:"ClientToken"` - SearchKey string `position:"Query" name:"SearchKey"` - EngineVersion string `position:"Query" name:"EngineVersion"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - Expired string `position:"Query" name:"Expired"` - Engine string `position:"Query" name:"Engine"` - CurrentInstanceId string `position:"Query" name:"CurrentInstanceId"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - DBInstanceStatus string `position:"Query" name:"DBInstanceStatus"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ProxyId string `position:"Query" name:"proxyId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceType string `position:"Query" name:"DBInstanceType"` - DBInstanceClass string `position:"Query" name:"DBInstanceClass"` - VSwitchId string `position:"Query" name:"VSwitchId"` - VpcId string `position:"Query" name:"VpcId"` - ZoneId string `position:"Query" name:"ZoneId"` - PayType string `position:"Query" name:"PayType"` - InstanceNetworkType string `position:"Query" name:"InstanceNetworkType"` -} - -// DescribeDBInstancesForCloneResponse is the response struct for api DescribeDBInstancesForClone -type DescribeDBInstancesForCloneResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - PageNumber int `json:"PageNumber" xml:"PageNumber"` - TotalRecordCount int `json:"TotalRecordCount" xml:"TotalRecordCount"` - PageRecordCount int `json:"PageRecordCount" xml:"PageRecordCount"` - Items ItemsInDescribeDBInstancesForClone `json:"Items" xml:"Items"` -} - -// CreateDescribeDBInstancesForCloneRequest creates a request to invoke DescribeDBInstancesForClone API -func CreateDescribeDBInstancesForCloneRequest() (request *DescribeDBInstancesForCloneRequest) { - request = &DescribeDBInstancesForCloneRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeDBInstancesForClone", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeDBInstancesForCloneResponse creates a response to parse from DescribeDBInstancesForClone response -func CreateDescribeDBInstancesForCloneResponse() (response *DescribeDBInstancesForCloneResponse) { - response = &DescribeDBInstancesForCloneResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_proxy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_proxy.go deleted file mode 100644 index 0e8672db523..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_proxy.go +++ /dev/null @@ -1,111 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeDBProxy invokes the rds.DescribeDBProxy API synchronously -func (client *Client) DescribeDBProxy(request *DescribeDBProxyRequest) (response *DescribeDBProxyResponse, err error) { - response = CreateDescribeDBProxyResponse() - err = client.DoAction(request, response) - return -} - -// DescribeDBProxyWithChan invokes the rds.DescribeDBProxy API asynchronously -func (client *Client) DescribeDBProxyWithChan(request *DescribeDBProxyRequest) (<-chan *DescribeDBProxyResponse, <-chan error) { - responseChan := make(chan *DescribeDBProxyResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeDBProxy(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeDBProxyWithCallback invokes the rds.DescribeDBProxy API asynchronously -func (client *Client) DescribeDBProxyWithCallback(request *DescribeDBProxyRequest, callback func(response *DescribeDBProxyResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeDBProxyResponse - var err error - defer close(result) - response, err = client.DescribeDBProxy(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeDBProxyRequest is the request struct for api DescribeDBProxy -type DescribeDBProxyRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// DescribeDBProxyResponse is the response struct for api DescribeDBProxy -type DescribeDBProxyResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBProxyServiceStatus string `json:"DBProxyServiceStatus" xml:"DBProxyServiceStatus"` - DBProxyInstanceType string `json:"DBProxyInstanceType" xml:"DBProxyInstanceType"` - DBProxyInstanceNum int `json:"DBProxyInstanceNum" xml:"DBProxyInstanceNum"` - DBProxyInstanceStatus string `json:"DBProxyInstanceStatus" xml:"DBProxyInstanceStatus"` - DBProxyInstanceCurrentMinorVersion string `json:"DBProxyInstanceCurrentMinorVersion" xml:"DBProxyInstanceCurrentMinorVersion"` - DBProxyInstanceLatestMinorVersion string `json:"DBProxyInstanceLatestMinorVersion" xml:"DBProxyInstanceLatestMinorVersion"` - DBProxyInstanceName string `json:"DBProxyInstanceName" xml:"DBProxyInstanceName"` - DBProxyConnectStringItems DBProxyConnectStringItems `json:"DBProxyConnectStringItems" xml:"DBProxyConnectStringItems"` - DbProxyEndpointItems DbProxyEndpointItems `json:"DbProxyEndpointItems" xml:"DbProxyEndpointItems"` -} - -// CreateDescribeDBProxyRequest creates a request to invoke DescribeDBProxy API -func CreateDescribeDBProxyRequest() (request *DescribeDBProxyRequest) { - request = &DescribeDBProxyRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeDBProxy", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeDBProxyResponse creates a response to parse from DescribeDBProxy response -func CreateDescribeDBProxyResponse() (response *DescribeDBProxyResponse) { - response = &DescribeDBProxyResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_proxy_endpoint.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_proxy_endpoint.go deleted file mode 100644 index d8b46fcb802..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_proxy_endpoint.go +++ /dev/null @@ -1,115 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeDBProxyEndpoint invokes the rds.DescribeDBProxyEndpoint API synchronously -func (client *Client) DescribeDBProxyEndpoint(request *DescribeDBProxyEndpointRequest) (response *DescribeDBProxyEndpointResponse, err error) { - response = CreateDescribeDBProxyEndpointResponse() - err = client.DoAction(request, response) - return -} - -// DescribeDBProxyEndpointWithChan invokes the rds.DescribeDBProxyEndpoint API asynchronously -func (client *Client) DescribeDBProxyEndpointWithChan(request *DescribeDBProxyEndpointRequest) (<-chan *DescribeDBProxyEndpointResponse, <-chan error) { - responseChan := make(chan *DescribeDBProxyEndpointResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeDBProxyEndpoint(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeDBProxyEndpointWithCallback invokes the rds.DescribeDBProxyEndpoint API asynchronously -func (client *Client) DescribeDBProxyEndpointWithCallback(request *DescribeDBProxyEndpointRequest, callback func(response *DescribeDBProxyEndpointResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeDBProxyEndpointResponse - var err error - defer close(result) - response, err = client.DescribeDBProxyEndpoint(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeDBProxyEndpointRequest is the request struct for api DescribeDBProxyEndpoint -type DescribeDBProxyEndpointRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - DBProxyConnectString string `position:"Query" name:"DBProxyConnectString"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBProxyEndpointId string `position:"Query" name:"DBProxyEndpointId"` -} - -// DescribeDBProxyEndpointResponse is the response struct for api DescribeDBProxyEndpoint -type DescribeDBProxyEndpointResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBProxyEndpointId string `json:"DBProxyEndpointId" xml:"DBProxyEndpointId"` - DBProxyConnectString string `json:"DBProxyConnectString" xml:"DBProxyConnectString"` - DBProxyConnectStringPort string `json:"DBProxyConnectStringPort" xml:"DBProxyConnectStringPort"` - DBProxyConnectStringNetType string `json:"DBProxyConnectStringNetType" xml:"DBProxyConnectStringNetType"` - DBProxyFeatures string `json:"DBProxyFeatures" xml:"DBProxyFeatures"` - ReadOnlyInstanceMaxDelayTime string `json:"ReadOnlyInstanceMaxDelayTime" xml:"ReadOnlyInstanceMaxDelayTime"` - ReadOnlyInstanceDistributionType string `json:"ReadOnlyInstanceDistributionType" xml:"ReadOnlyInstanceDistributionType"` - ReadOnlyInstanceWeight string `json:"ReadOnlyInstanceWeight" xml:"ReadOnlyInstanceWeight"` - DbProxyEndpointAliases string `json:"DbProxyEndpointAliases" xml:"DbProxyEndpointAliases"` - DbProxyEndpointReadWriteMode string `json:"DbProxyEndpointReadWriteMode" xml:"DbProxyEndpointReadWriteMode"` - EndpointConnectItems EndpointConnectItems `json:"EndpointConnectItems" xml:"EndpointConnectItems"` -} - -// CreateDescribeDBProxyEndpointRequest creates a request to invoke DescribeDBProxyEndpoint API -func CreateDescribeDBProxyEndpointRequest() (request *DescribeDBProxyEndpointRequest) { - request = &DescribeDBProxyEndpointRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeDBProxyEndpoint", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeDBProxyEndpointResponse creates a response to parse from DescribeDBProxyEndpoint response -func CreateDescribeDBProxyEndpointResponse() (response *DescribeDBProxyEndpointResponse) { - response = &DescribeDBProxyEndpointResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_proxy_performance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_proxy_performance.go deleted file mode 100644 index a2229b4c75f..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_db_proxy_performance.go +++ /dev/null @@ -1,110 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeDBProxyPerformance invokes the rds.DescribeDBProxyPerformance API synchronously -func (client *Client) DescribeDBProxyPerformance(request *DescribeDBProxyPerformanceRequest) (response *DescribeDBProxyPerformanceResponse, err error) { - response = CreateDescribeDBProxyPerformanceResponse() - err = client.DoAction(request, response) - return -} - -// DescribeDBProxyPerformanceWithChan invokes the rds.DescribeDBProxyPerformance API asynchronously -func (client *Client) DescribeDBProxyPerformanceWithChan(request *DescribeDBProxyPerformanceRequest) (<-chan *DescribeDBProxyPerformanceResponse, <-chan error) { - responseChan := make(chan *DescribeDBProxyPerformanceResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeDBProxyPerformance(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeDBProxyPerformanceWithCallback invokes the rds.DescribeDBProxyPerformance API asynchronously -func (client *Client) DescribeDBProxyPerformanceWithCallback(request *DescribeDBProxyPerformanceRequest, callback func(response *DescribeDBProxyPerformanceResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeDBProxyPerformanceResponse - var err error - defer close(result) - response, err = client.DescribeDBProxyPerformance(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeDBProxyPerformanceRequest is the request struct for api DescribeDBProxyPerformance -type DescribeDBProxyPerformanceRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - MetricsName string `position:"Query" name:"MetricsName"` - StartTime string `position:"Query" name:"StartTime"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - EndTime string `position:"Query" name:"EndTime"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBProxyInstanceType string `position:"Query" name:"DBProxyInstanceType"` -} - -// DescribeDBProxyPerformanceResponse is the response struct for api DescribeDBProxyPerformance -type DescribeDBProxyPerformanceResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - StartTime string `json:"StartTime" xml:"StartTime"` - EndTime string `json:"EndTime" xml:"EndTime"` - PerformanceKeys PerformanceKeysInDescribeDBProxyPerformance `json:"PerformanceKeys" xml:"PerformanceKeys"` -} - -// CreateDescribeDBProxyPerformanceRequest creates a request to invoke DescribeDBProxyPerformance API -func CreateDescribeDBProxyPerformanceRequest() (request *DescribeDBProxyPerformanceRequest) { - request = &DescribeDBProxyPerformanceRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeDBProxyPerformance", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeDBProxyPerformanceResponse creates a response to parse from DescribeDBProxyPerformance response -func CreateDescribeDBProxyPerformanceResponse() (response *DescribeDBProxyPerformanceResponse) { - response = &DescribeDBProxyPerformanceResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_dedicated_host_groups.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_dedicated_host_groups.go deleted file mode 100644 index fb7dc0c254e..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_dedicated_host_groups.go +++ /dev/null @@ -1,104 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeDedicatedHostGroups invokes the rds.DescribeDedicatedHostGroups API synchronously -func (client *Client) DescribeDedicatedHostGroups(request *DescribeDedicatedHostGroupsRequest) (response *DescribeDedicatedHostGroupsResponse, err error) { - response = CreateDescribeDedicatedHostGroupsResponse() - err = client.DoAction(request, response) - return -} - -// DescribeDedicatedHostGroupsWithChan invokes the rds.DescribeDedicatedHostGroups API asynchronously -func (client *Client) DescribeDedicatedHostGroupsWithChan(request *DescribeDedicatedHostGroupsRequest) (<-chan *DescribeDedicatedHostGroupsResponse, <-chan error) { - responseChan := make(chan *DescribeDedicatedHostGroupsResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeDedicatedHostGroups(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeDedicatedHostGroupsWithCallback invokes the rds.DescribeDedicatedHostGroups API asynchronously -func (client *Client) DescribeDedicatedHostGroupsWithCallback(request *DescribeDedicatedHostGroupsRequest, callback func(response *DescribeDedicatedHostGroupsResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeDedicatedHostGroupsResponse - var err error - defer close(result) - response, err = client.DescribeDedicatedHostGroups(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeDedicatedHostGroupsRequest is the request struct for api DescribeDedicatedHostGroups -type DescribeDedicatedHostGroupsRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - ImageCategory string `position:"Query" name:"ImageCategory"` - DedicatedHostGroupId string `position:"Query" name:"DedicatedHostGroupId"` -} - -// DescribeDedicatedHostGroupsResponse is the response struct for api DescribeDedicatedHostGroups -type DescribeDedicatedHostGroupsResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DedicatedHostGroups DedicatedHostGroups `json:"DedicatedHostGroups" xml:"DedicatedHostGroups"` -} - -// CreateDescribeDedicatedHostGroupsRequest creates a request to invoke DescribeDedicatedHostGroups API -func CreateDescribeDedicatedHostGroupsRequest() (request *DescribeDedicatedHostGroupsRequest) { - request = &DescribeDedicatedHostGroupsRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeDedicatedHostGroups", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeDedicatedHostGroupsResponse creates a response to parse from DescribeDedicatedHostGroups response -func CreateDescribeDedicatedHostGroupsResponse() (response *DescribeDedicatedHostGroupsResponse) { - response = &DescribeDedicatedHostGroupsResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_dedicated_hosts.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_dedicated_hosts.go deleted file mode 100644 index 4718fe876d6..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_dedicated_hosts.go +++ /dev/null @@ -1,110 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeDedicatedHosts invokes the rds.DescribeDedicatedHosts API synchronously -func (client *Client) DescribeDedicatedHosts(request *DescribeDedicatedHostsRequest) (response *DescribeDedicatedHostsResponse, err error) { - response = CreateDescribeDedicatedHostsResponse() - err = client.DoAction(request, response) - return -} - -// DescribeDedicatedHostsWithChan invokes the rds.DescribeDedicatedHosts API asynchronously -func (client *Client) DescribeDedicatedHostsWithChan(request *DescribeDedicatedHostsRequest) (<-chan *DescribeDedicatedHostsResponse, <-chan error) { - responseChan := make(chan *DescribeDedicatedHostsResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeDedicatedHosts(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeDedicatedHostsWithCallback invokes the rds.DescribeDedicatedHosts API asynchronously -func (client *Client) DescribeDedicatedHostsWithCallback(request *DescribeDedicatedHostsRequest, callback func(response *DescribeDedicatedHostsResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeDedicatedHostsResponse - var err error - defer close(result) - response, err = client.DescribeDedicatedHosts(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeDedicatedHostsRequest is the request struct for api DescribeDedicatedHosts -type DescribeDedicatedHostsRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - HostType string `position:"Query" name:"HostType"` - HostStatus string `position:"Query" name:"HostStatus"` - AllocationStatus string `position:"Query" name:"AllocationStatus"` - DedicatedHostGroupId string `position:"Query" name:"DedicatedHostGroupId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OrderId requests.Integer `position:"Query" name:"OrderId"` - DedicatedHostId string `position:"Query" name:"DedicatedHostId"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - ZoneId string `position:"Query" name:"ZoneId"` -} - -// DescribeDedicatedHostsResponse is the response struct for api DescribeDedicatedHosts -type DescribeDedicatedHostsResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DedicatedHostGroupId string `json:"DedicatedHostGroupId" xml:"DedicatedHostGroupId"` - DedicatedHosts DedicatedHosts `json:"DedicatedHosts" xml:"DedicatedHosts"` -} - -// CreateDescribeDedicatedHostsRequest creates a request to invoke DescribeDedicatedHosts API -func CreateDescribeDedicatedHostsRequest() (request *DescribeDedicatedHostsRequest) { - request = &DescribeDedicatedHostsRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeDedicatedHosts", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeDedicatedHostsResponse creates a response to parse from DescribeDedicatedHosts response -func CreateDescribeDedicatedHostsResponse() (response *DescribeDedicatedHostsResponse) { - response = &DescribeDedicatedHostsResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_detached_backups.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_detached_backups.go deleted file mode 100644 index 646ed7a1147..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_detached_backups.go +++ /dev/null @@ -1,117 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeDetachedBackups invokes the rds.DescribeDetachedBackups API synchronously -func (client *Client) DescribeDetachedBackups(request *DescribeDetachedBackupsRequest) (response *DescribeDetachedBackupsResponse, err error) { - response = CreateDescribeDetachedBackupsResponse() - err = client.DoAction(request, response) - return -} - -// DescribeDetachedBackupsWithChan invokes the rds.DescribeDetachedBackups API asynchronously -func (client *Client) DescribeDetachedBackupsWithChan(request *DescribeDetachedBackupsRequest) (<-chan *DescribeDetachedBackupsResponse, <-chan error) { - responseChan := make(chan *DescribeDetachedBackupsResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeDetachedBackups(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeDetachedBackupsWithCallback invokes the rds.DescribeDetachedBackups API asynchronously -func (client *Client) DescribeDetachedBackupsWithCallback(request *DescribeDetachedBackupsRequest, callback func(response *DescribeDetachedBackupsResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeDetachedBackupsResponse - var err error - defer close(result) - response, err = client.DescribeDetachedBackups(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeDetachedBackupsRequest is the request struct for api DescribeDetachedBackups -type DescribeDetachedBackupsRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - StartTime string `position:"Query" name:"StartTime"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - BackupLocation string `position:"Query" name:"BackupLocation"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - BackupId string `position:"Query" name:"BackupId"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - EndTime string `position:"Query" name:"EndTime"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - BackupStatus string `position:"Query" name:"BackupStatus"` - BackupMode string `position:"Query" name:"BackupMode"` - Region string `position:"Query" name:"Region"` -} - -// DescribeDetachedBackupsResponse is the response struct for api DescribeDetachedBackups -type DescribeDetachedBackupsResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - TotalRecordCount string `json:"TotalRecordCount" xml:"TotalRecordCount"` - PageNumber string `json:"PageNumber" xml:"PageNumber"` - PageRecordCount string `json:"PageRecordCount" xml:"PageRecordCount"` - TotalBackupSize int64 `json:"TotalBackupSize" xml:"TotalBackupSize"` - Items ItemsInDescribeDetachedBackups `json:"Items" xml:"Items"` -} - -// CreateDescribeDetachedBackupsRequest creates a request to invoke DescribeDetachedBackups API -func CreateDescribeDetachedBackupsRequest() (request *DescribeDetachedBackupsRequest) { - request = &DescribeDetachedBackupsRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeDetachedBackups", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeDetachedBackupsResponse creates a response to parse from DescribeDetachedBackups response -func CreateDescribeDetachedBackupsResponse() (response *DescribeDetachedBackupsResponse) { - response = &DescribeDetachedBackupsResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_diagnostic_report_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_diagnostic_report_list.go deleted file mode 100644 index 7d489116468..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_diagnostic_report_list.go +++ /dev/null @@ -1,100 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeDiagnosticReportList invokes the rds.DescribeDiagnosticReportList API synchronously -func (client *Client) DescribeDiagnosticReportList(request *DescribeDiagnosticReportListRequest) (response *DescribeDiagnosticReportListResponse, err error) { - response = CreateDescribeDiagnosticReportListResponse() - err = client.DoAction(request, response) - return -} - -// DescribeDiagnosticReportListWithChan invokes the rds.DescribeDiagnosticReportList API asynchronously -func (client *Client) DescribeDiagnosticReportListWithChan(request *DescribeDiagnosticReportListRequest) (<-chan *DescribeDiagnosticReportListResponse, <-chan error) { - responseChan := make(chan *DescribeDiagnosticReportListResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeDiagnosticReportList(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeDiagnosticReportListWithCallback invokes the rds.DescribeDiagnosticReportList API asynchronously -func (client *Client) DescribeDiagnosticReportListWithCallback(request *DescribeDiagnosticReportListRequest, callback func(response *DescribeDiagnosticReportListResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeDiagnosticReportListResponse - var err error - defer close(result) - response, err = client.DescribeDiagnosticReportList(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeDiagnosticReportListRequest is the request struct for api DescribeDiagnosticReportList -type DescribeDiagnosticReportListRequest struct { - *requests.RpcRequest - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// DescribeDiagnosticReportListResponse is the response struct for api DescribeDiagnosticReportList -type DescribeDiagnosticReportListResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - ReportList []Report `json:"ReportList" xml:"ReportList"` -} - -// CreateDescribeDiagnosticReportListRequest creates a request to invoke DescribeDiagnosticReportList API -func CreateDescribeDiagnosticReportListRequest() (request *DescribeDiagnosticReportListRequest) { - request = &DescribeDiagnosticReportListRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeDiagnosticReportList", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeDiagnosticReportListResponse creates a response to parse from DescribeDiagnosticReportList response -func CreateDescribeDiagnosticReportListResponse() (response *DescribeDiagnosticReportListResponse) { - response = &DescribeDiagnosticReportListResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_dtc_security_ip_hosts_for_sql_server.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_dtc_security_ip_hosts_for_sql_server.go deleted file mode 100644 index 823fe187220..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_dtc_security_ip_hosts_for_sql_server.go +++ /dev/null @@ -1,107 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeDTCSecurityIpHostsForSQLServer invokes the rds.DescribeDTCSecurityIpHostsForSQLServer API synchronously -func (client *Client) DescribeDTCSecurityIpHostsForSQLServer(request *DescribeDTCSecurityIpHostsForSQLServerRequest) (response *DescribeDTCSecurityIpHostsForSQLServerResponse, err error) { - response = CreateDescribeDTCSecurityIpHostsForSQLServerResponse() - err = client.DoAction(request, response) - return -} - -// DescribeDTCSecurityIpHostsForSQLServerWithChan invokes the rds.DescribeDTCSecurityIpHostsForSQLServer API asynchronously -func (client *Client) DescribeDTCSecurityIpHostsForSQLServerWithChan(request *DescribeDTCSecurityIpHostsForSQLServerRequest) (<-chan *DescribeDTCSecurityIpHostsForSQLServerResponse, <-chan error) { - responseChan := make(chan *DescribeDTCSecurityIpHostsForSQLServerResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeDTCSecurityIpHostsForSQLServer(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeDTCSecurityIpHostsForSQLServerWithCallback invokes the rds.DescribeDTCSecurityIpHostsForSQLServer API asynchronously -func (client *Client) DescribeDTCSecurityIpHostsForSQLServerWithCallback(request *DescribeDTCSecurityIpHostsForSQLServerRequest, callback func(response *DescribeDTCSecurityIpHostsForSQLServerResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeDTCSecurityIpHostsForSQLServerResponse - var err error - defer close(result) - response, err = client.DescribeDTCSecurityIpHostsForSQLServer(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeDTCSecurityIpHostsForSQLServerRequest is the request struct for api DescribeDTCSecurityIpHostsForSQLServer -type DescribeDTCSecurityIpHostsForSQLServerRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - SecurityToken string `position:"Query" name:"SecurityToken"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// DescribeDTCSecurityIpHostsForSQLServerResponse is the response struct for api DescribeDTCSecurityIpHostsForSQLServer -type DescribeDTCSecurityIpHostsForSQLServerResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - IpHostPairNum string `json:"IpHostPairNum" xml:"IpHostPairNum"` - Items ItemsInDescribeDTCSecurityIpHostsForSQLServer `json:"Items" xml:"Items"` -} - -// CreateDescribeDTCSecurityIpHostsForSQLServerRequest creates a request to invoke DescribeDTCSecurityIpHostsForSQLServer API -func CreateDescribeDTCSecurityIpHostsForSQLServerRequest() (request *DescribeDTCSecurityIpHostsForSQLServerRequest) { - request = &DescribeDTCSecurityIpHostsForSQLServerRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeDTCSecurityIpHostsForSQLServer", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeDTCSecurityIpHostsForSQLServerResponse creates a response to parse from DescribeDTCSecurityIpHostsForSQLServer response -func CreateDescribeDTCSecurityIpHostsForSQLServerResponse() (response *DescribeDTCSecurityIpHostsForSQLServerResponse) { - response = &DescribeDTCSecurityIpHostsForSQLServerResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_error_logs.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_error_logs.go deleted file mode 100644 index 5b4ce75f239..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_error_logs.go +++ /dev/null @@ -1,111 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeErrorLogs invokes the rds.DescribeErrorLogs API synchronously -func (client *Client) DescribeErrorLogs(request *DescribeErrorLogsRequest) (response *DescribeErrorLogsResponse, err error) { - response = CreateDescribeErrorLogsResponse() - err = client.DoAction(request, response) - return -} - -// DescribeErrorLogsWithChan invokes the rds.DescribeErrorLogs API asynchronously -func (client *Client) DescribeErrorLogsWithChan(request *DescribeErrorLogsRequest) (<-chan *DescribeErrorLogsResponse, <-chan error) { - responseChan := make(chan *DescribeErrorLogsResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeErrorLogs(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeErrorLogsWithCallback invokes the rds.DescribeErrorLogs API asynchronously -func (client *Client) DescribeErrorLogsWithCallback(request *DescribeErrorLogsRequest, callback func(response *DescribeErrorLogsResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeErrorLogsResponse - var err error - defer close(result) - response, err = client.DescribeErrorLogs(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeErrorLogsRequest is the request struct for api DescribeErrorLogs -type DescribeErrorLogsRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - StartTime string `position:"Query" name:"StartTime"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - EndTime string `position:"Query" name:"EndTime"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// DescribeErrorLogsResponse is the response struct for api DescribeErrorLogs -type DescribeErrorLogsResponse struct { - *responses.BaseResponse - PageNumber int `json:"PageNumber" xml:"PageNumber"` - PageRecordCount int `json:"PageRecordCount" xml:"PageRecordCount"` - RequestId string `json:"RequestId" xml:"RequestId"` - TotalRecordCount int `json:"TotalRecordCount" xml:"TotalRecordCount"` - Items ItemsInDescribeErrorLogs `json:"Items" xml:"Items"` -} - -// CreateDescribeErrorLogsRequest creates a request to invoke DescribeErrorLogs API -func CreateDescribeErrorLogsRequest() (request *DescribeErrorLogsRequest) { - request = &DescribeErrorLogsRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeErrorLogs", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeErrorLogsResponse creates a response to parse from DescribeErrorLogs response -func CreateDescribeErrorLogsResponse() (response *DescribeErrorLogsResponse) { - response = &DescribeErrorLogsResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_events.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_events.go deleted file mode 100644 index 538c1e7d831..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_events.go +++ /dev/null @@ -1,109 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeEvents invokes the rds.DescribeEvents API synchronously -func (client *Client) DescribeEvents(request *DescribeEventsRequest) (response *DescribeEventsResponse, err error) { - response = CreateDescribeEventsResponse() - err = client.DoAction(request, response) - return -} - -// DescribeEventsWithChan invokes the rds.DescribeEvents API asynchronously -func (client *Client) DescribeEventsWithChan(request *DescribeEventsRequest) (<-chan *DescribeEventsResponse, <-chan error) { - responseChan := make(chan *DescribeEventsResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeEvents(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeEventsWithCallback invokes the rds.DescribeEvents API asynchronously -func (client *Client) DescribeEventsWithCallback(request *DescribeEventsRequest, callback func(response *DescribeEventsResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeEventsResponse - var err error - defer close(result) - response, err = client.DescribeEvents(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeEventsRequest is the request struct for api DescribeEvents -type DescribeEventsRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - StartTime string `position:"Query" name:"StartTime"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - EndTime string `position:"Query" name:"EndTime"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// DescribeEventsResponse is the response struct for api DescribeEvents -type DescribeEventsResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - TotalRecordCount int `json:"TotalRecordCount" xml:"TotalRecordCount"` - PageSize int `json:"PageSize" xml:"PageSize"` - PageNumber int `json:"PageNumber" xml:"PageNumber"` - EventItems EventItems `json:"EventItems" xml:"EventItems"` -} - -// CreateDescribeEventsRequest creates a request to invoke DescribeEvents API -func CreateDescribeEventsRequest() (request *DescribeEventsRequest) { - request = &DescribeEventsRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeEvents", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeEventsResponse creates a response to parse from DescribeEvents response -func CreateDescribeEventsResponse() (response *DescribeEventsResponse) { - response = &DescribeEventsResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_ha_diagnose_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_ha_diagnose_config.go deleted file mode 100644 index 807aaeb2cec..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_ha_diagnose_config.go +++ /dev/null @@ -1,103 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeHADiagnoseConfig invokes the rds.DescribeHADiagnoseConfig API synchronously -func (client *Client) DescribeHADiagnoseConfig(request *DescribeHADiagnoseConfigRequest) (response *DescribeHADiagnoseConfigResponse, err error) { - response = CreateDescribeHADiagnoseConfigResponse() - err = client.DoAction(request, response) - return -} - -// DescribeHADiagnoseConfigWithChan invokes the rds.DescribeHADiagnoseConfig API asynchronously -func (client *Client) DescribeHADiagnoseConfigWithChan(request *DescribeHADiagnoseConfigRequest) (<-chan *DescribeHADiagnoseConfigResponse, <-chan error) { - responseChan := make(chan *DescribeHADiagnoseConfigResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeHADiagnoseConfig(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeHADiagnoseConfigWithCallback invokes the rds.DescribeHADiagnoseConfig API asynchronously -func (client *Client) DescribeHADiagnoseConfigWithCallback(request *DescribeHADiagnoseConfigRequest, callback func(response *DescribeHADiagnoseConfigResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeHADiagnoseConfigResponse - var err error - defer close(result) - response, err = client.DescribeHADiagnoseConfig(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeHADiagnoseConfigRequest is the request struct for api DescribeHADiagnoseConfig -type DescribeHADiagnoseConfigRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// DescribeHADiagnoseConfigResponse is the response struct for api DescribeHADiagnoseConfig -type DescribeHADiagnoseConfigResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - TcpConnectionType string `json:"TcpConnectionType" xml:"TcpConnectionType"` -} - -// CreateDescribeHADiagnoseConfigRequest creates a request to invoke DescribeHADiagnoseConfig API -func CreateDescribeHADiagnoseConfigRequest() (request *DescribeHADiagnoseConfigRequest) { - request = &DescribeHADiagnoseConfigRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeHADiagnoseConfig", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeHADiagnoseConfigResponse creates a response to parse from DescribeHADiagnoseConfig response -func CreateDescribeHADiagnoseConfigResponse() (response *DescribeHADiagnoseConfigResponse) { - response = &DescribeHADiagnoseConfigResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_ha_switch_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_ha_switch_config.go deleted file mode 100644 index 3884bba3948..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_ha_switch_config.go +++ /dev/null @@ -1,104 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeHASwitchConfig invokes the rds.DescribeHASwitchConfig API synchronously -func (client *Client) DescribeHASwitchConfig(request *DescribeHASwitchConfigRequest) (response *DescribeHASwitchConfigResponse, err error) { - response = CreateDescribeHASwitchConfigResponse() - err = client.DoAction(request, response) - return -} - -// DescribeHASwitchConfigWithChan invokes the rds.DescribeHASwitchConfig API asynchronously -func (client *Client) DescribeHASwitchConfigWithChan(request *DescribeHASwitchConfigRequest) (<-chan *DescribeHASwitchConfigResponse, <-chan error) { - responseChan := make(chan *DescribeHASwitchConfigResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeHASwitchConfig(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeHASwitchConfigWithCallback invokes the rds.DescribeHASwitchConfig API asynchronously -func (client *Client) DescribeHASwitchConfigWithCallback(request *DescribeHASwitchConfigRequest, callback func(response *DescribeHASwitchConfigResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeHASwitchConfigResponse - var err error - defer close(result) - response, err = client.DescribeHASwitchConfig(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeHASwitchConfigRequest is the request struct for api DescribeHASwitchConfig -type DescribeHASwitchConfigRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// DescribeHASwitchConfigResponse is the response struct for api DescribeHASwitchConfig -type DescribeHASwitchConfigResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - HAConfig string `json:"HAConfig" xml:"HAConfig"` - ManualHATime string `json:"ManualHATime" xml:"ManualHATime"` -} - -// CreateDescribeHASwitchConfigRequest creates a request to invoke DescribeHASwitchConfig API -func CreateDescribeHASwitchConfigRequest() (request *DescribeHASwitchConfigRequest) { - request = &DescribeHASwitchConfigRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeHASwitchConfig", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeHASwitchConfigResponse creates a response to parse from DescribeHASwitchConfig response -func CreateDescribeHASwitchConfigResponse() (response *DescribeHASwitchConfigResponse) { - response = &DescribeHASwitchConfigResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_instance_auto_renewal_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_instance_auto_renewal_attribute.go deleted file mode 100644 index 6399672639c..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_instance_auto_renewal_attribute.go +++ /dev/null @@ -1,111 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeInstanceAutoRenewalAttribute invokes the rds.DescribeInstanceAutoRenewalAttribute API synchronously -func (client *Client) DescribeInstanceAutoRenewalAttribute(request *DescribeInstanceAutoRenewalAttributeRequest) (response *DescribeInstanceAutoRenewalAttributeResponse, err error) { - response = CreateDescribeInstanceAutoRenewalAttributeResponse() - err = client.DoAction(request, response) - return -} - -// DescribeInstanceAutoRenewalAttributeWithChan invokes the rds.DescribeInstanceAutoRenewalAttribute API asynchronously -func (client *Client) DescribeInstanceAutoRenewalAttributeWithChan(request *DescribeInstanceAutoRenewalAttributeRequest) (<-chan *DescribeInstanceAutoRenewalAttributeResponse, <-chan error) { - responseChan := make(chan *DescribeInstanceAutoRenewalAttributeResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeInstanceAutoRenewalAttribute(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeInstanceAutoRenewalAttributeWithCallback invokes the rds.DescribeInstanceAutoRenewalAttribute API asynchronously -func (client *Client) DescribeInstanceAutoRenewalAttributeWithCallback(request *DescribeInstanceAutoRenewalAttributeRequest, callback func(response *DescribeInstanceAutoRenewalAttributeResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeInstanceAutoRenewalAttributeResponse - var err error - defer close(result) - response, err = client.DescribeInstanceAutoRenewalAttribute(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeInstanceAutoRenewalAttributeRequest is the request struct for api DescribeInstanceAutoRenewalAttribute -type DescribeInstanceAutoRenewalAttributeRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ClientToken string `position:"Query" name:"ClientToken"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ProxyId string `position:"Query" name:"proxyId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// DescribeInstanceAutoRenewalAttributeResponse is the response struct for api DescribeInstanceAutoRenewalAttribute -type DescribeInstanceAutoRenewalAttributeResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - PageNumber int `json:"PageNumber" xml:"PageNumber"` - TotalRecordCount int `json:"TotalRecordCount" xml:"TotalRecordCount"` - PageRecordCount int `json:"PageRecordCount" xml:"PageRecordCount"` - Items ItemsInDescribeInstanceAutoRenewalAttribute `json:"Items" xml:"Items"` -} - -// CreateDescribeInstanceAutoRenewalAttributeRequest creates a request to invoke DescribeInstanceAutoRenewalAttribute API -func CreateDescribeInstanceAutoRenewalAttributeRequest() (request *DescribeInstanceAutoRenewalAttributeRequest) { - request = &DescribeInstanceAutoRenewalAttributeRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeInstanceAutoRenewalAttribute", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeInstanceAutoRenewalAttributeResponse creates a response to parse from DescribeInstanceAutoRenewalAttribute response -func CreateDescribeInstanceAutoRenewalAttributeResponse() (response *DescribeInstanceAutoRenewalAttributeResponse) { - response = &DescribeInstanceAutoRenewalAttributeResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_instance_cross_backup_policy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_instance_cross_backup_policy.go deleted file mode 100644 index 502efc0121e..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_instance_cross_backup_policy.go +++ /dev/null @@ -1,123 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeInstanceCrossBackupPolicy invokes the rds.DescribeInstanceCrossBackupPolicy API synchronously -func (client *Client) DescribeInstanceCrossBackupPolicy(request *DescribeInstanceCrossBackupPolicyRequest) (response *DescribeInstanceCrossBackupPolicyResponse, err error) { - response = CreateDescribeInstanceCrossBackupPolicyResponse() - err = client.DoAction(request, response) - return -} - -// DescribeInstanceCrossBackupPolicyWithChan invokes the rds.DescribeInstanceCrossBackupPolicy API asynchronously -func (client *Client) DescribeInstanceCrossBackupPolicyWithChan(request *DescribeInstanceCrossBackupPolicyRequest) (<-chan *DescribeInstanceCrossBackupPolicyResponse, <-chan error) { - responseChan := make(chan *DescribeInstanceCrossBackupPolicyResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeInstanceCrossBackupPolicy(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeInstanceCrossBackupPolicyWithCallback invokes the rds.DescribeInstanceCrossBackupPolicy API asynchronously -func (client *Client) DescribeInstanceCrossBackupPolicyWithCallback(request *DescribeInstanceCrossBackupPolicyRequest, callback func(response *DescribeInstanceCrossBackupPolicyResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeInstanceCrossBackupPolicyResponse - var err error - defer close(result) - response, err = client.DescribeInstanceCrossBackupPolicy(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeInstanceCrossBackupPolicyRequest is the request struct for api DescribeInstanceCrossBackupPolicy -type DescribeInstanceCrossBackupPolicyRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// DescribeInstanceCrossBackupPolicyResponse is the response struct for api DescribeInstanceCrossBackupPolicy -type DescribeInstanceCrossBackupPolicyResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - DBInstanceDescription string `json:"DBInstanceDescription" xml:"DBInstanceDescription"` - DBInstanceStatus string `json:"DBInstanceStatus" xml:"DBInstanceStatus"` - DBInstanceStatusDesc string `json:"DBInstanceStatusDesc" xml:"DBInstanceStatusDesc"` - Engine string `json:"Engine" xml:"Engine"` - EngineVersion string `json:"EngineVersion" xml:"EngineVersion"` - RegionId string `json:"RegionId" xml:"RegionId"` - CrossBackupRegion string `json:"CrossBackupRegion" xml:"CrossBackupRegion"` - CrossBackupType string `json:"CrossBackupType" xml:"CrossBackupType"` - BackupEnabledTime string `json:"BackupEnabledTime" xml:"BackupEnabledTime"` - BackupEnabled string `json:"BackupEnabled" xml:"BackupEnabled"` - LogBackupEnabled string `json:"LogBackupEnabled" xml:"LogBackupEnabled"` - LogBackupEnabledTime string `json:"LogBackupEnabledTime" xml:"LogBackupEnabledTime"` - StorageOwner string `json:"StorageOwner" xml:"StorageOwner"` - StorageType string `json:"StorageType" xml:"StorageType"` - Endpoint string `json:"Endpoint" xml:"Endpoint"` - RetentType int `json:"RetentType" xml:"RetentType"` - Retention int `json:"Retention" xml:"Retention"` - LockMode string `json:"LockMode" xml:"LockMode"` - RelService string `json:"RelService" xml:"RelService"` - RelServiceId string `json:"RelServiceId" xml:"RelServiceId"` -} - -// CreateDescribeInstanceCrossBackupPolicyRequest creates a request to invoke DescribeInstanceCrossBackupPolicy API -func CreateDescribeInstanceCrossBackupPolicyRequest() (request *DescribeInstanceCrossBackupPolicyRequest) { - request = &DescribeInstanceCrossBackupPolicyRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeInstanceCrossBackupPolicy", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeInstanceCrossBackupPolicyResponse creates a response to parse from DescribeInstanceCrossBackupPolicy response -func CreateDescribeInstanceCrossBackupPolicyResponse() (response *DescribeInstanceCrossBackupPolicyResponse) { - response = &DescribeInstanceCrossBackupPolicyResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_instance_keywords.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_instance_keywords.go deleted file mode 100644 index c446441834c..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_instance_keywords.go +++ /dev/null @@ -1,105 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeInstanceKeywords invokes the rds.DescribeInstanceKeywords API synchronously -func (client *Client) DescribeInstanceKeywords(request *DescribeInstanceKeywordsRequest) (response *DescribeInstanceKeywordsResponse, err error) { - response = CreateDescribeInstanceKeywordsResponse() - err = client.DoAction(request, response) - return -} - -// DescribeInstanceKeywordsWithChan invokes the rds.DescribeInstanceKeywords API asynchronously -func (client *Client) DescribeInstanceKeywordsWithChan(request *DescribeInstanceKeywordsRequest) (<-chan *DescribeInstanceKeywordsResponse, <-chan error) { - responseChan := make(chan *DescribeInstanceKeywordsResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeInstanceKeywords(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeInstanceKeywordsWithCallback invokes the rds.DescribeInstanceKeywords API asynchronously -func (client *Client) DescribeInstanceKeywordsWithCallback(request *DescribeInstanceKeywordsRequest, callback func(response *DescribeInstanceKeywordsResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeInstanceKeywordsResponse - var err error - defer close(result) - response, err = client.DescribeInstanceKeywords(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeInstanceKeywordsRequest is the request struct for api DescribeInstanceKeywords -type DescribeInstanceKeywordsRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - Key string `position:"Query" name:"Key"` -} - -// DescribeInstanceKeywordsResponse is the response struct for api DescribeInstanceKeywords -type DescribeInstanceKeywordsResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Key string `json:"Key" xml:"Key"` - Words Words `json:"Words" xml:"Words"` -} - -// CreateDescribeInstanceKeywordsRequest creates a request to invoke DescribeInstanceKeywords API -func CreateDescribeInstanceKeywordsRequest() (request *DescribeInstanceKeywordsRequest) { - request = &DescribeInstanceKeywordsRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeInstanceKeywords", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeInstanceKeywordsResponse creates a response to parse from DescribeInstanceKeywords response -func CreateDescribeInstanceKeywordsResponse() (response *DescribeInstanceKeywordsResponse) { - response = &DescribeInstanceKeywordsResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_local_available_recovery_time.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_local_available_recovery_time.go deleted file mode 100644 index 3885783fd09..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_local_available_recovery_time.go +++ /dev/null @@ -1,106 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeLocalAvailableRecoveryTime invokes the rds.DescribeLocalAvailableRecoveryTime API synchronously -func (client *Client) DescribeLocalAvailableRecoveryTime(request *DescribeLocalAvailableRecoveryTimeRequest) (response *DescribeLocalAvailableRecoveryTimeResponse, err error) { - response = CreateDescribeLocalAvailableRecoveryTimeResponse() - err = client.DoAction(request, response) - return -} - -// DescribeLocalAvailableRecoveryTimeWithChan invokes the rds.DescribeLocalAvailableRecoveryTime API asynchronously -func (client *Client) DescribeLocalAvailableRecoveryTimeWithChan(request *DescribeLocalAvailableRecoveryTimeRequest) (<-chan *DescribeLocalAvailableRecoveryTimeResponse, <-chan error) { - responseChan := make(chan *DescribeLocalAvailableRecoveryTimeResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeLocalAvailableRecoveryTime(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeLocalAvailableRecoveryTimeWithCallback invokes the rds.DescribeLocalAvailableRecoveryTime API asynchronously -func (client *Client) DescribeLocalAvailableRecoveryTimeWithCallback(request *DescribeLocalAvailableRecoveryTimeRequest, callback func(response *DescribeLocalAvailableRecoveryTimeResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeLocalAvailableRecoveryTimeResponse - var err error - defer close(result) - response, err = client.DescribeLocalAvailableRecoveryTime(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeLocalAvailableRecoveryTimeRequest is the request struct for api DescribeLocalAvailableRecoveryTime -type DescribeLocalAvailableRecoveryTimeRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - Region string `position:"Query" name:"Region"` -} - -// DescribeLocalAvailableRecoveryTimeResponse is the response struct for api DescribeLocalAvailableRecoveryTime -type DescribeLocalAvailableRecoveryTimeResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - RecoveryBeginTime string `json:"RecoveryBeginTime" xml:"RecoveryBeginTime"` - RecoveryEndTime string `json:"RecoveryEndTime" xml:"RecoveryEndTime"` -} - -// CreateDescribeLocalAvailableRecoveryTimeRequest creates a request to invoke DescribeLocalAvailableRecoveryTime API -func CreateDescribeLocalAvailableRecoveryTimeRequest() (request *DescribeLocalAvailableRecoveryTimeRequest) { - request = &DescribeLocalAvailableRecoveryTimeRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeLocalAvailableRecoveryTime", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeLocalAvailableRecoveryTimeResponse creates a response to parse from DescribeLocalAvailableRecoveryTime response -func CreateDescribeLocalAvailableRecoveryTimeResponse() (response *DescribeLocalAvailableRecoveryTimeResponse) { - response = &DescribeLocalAvailableRecoveryTimeResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_log_backup_files.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_log_backup_files.go deleted file mode 100644 index 3ab6b2d86b1..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_log_backup_files.go +++ /dev/null @@ -1,112 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeLogBackupFiles invokes the rds.DescribeLogBackupFiles API synchronously -func (client *Client) DescribeLogBackupFiles(request *DescribeLogBackupFilesRequest) (response *DescribeLogBackupFilesResponse, err error) { - response = CreateDescribeLogBackupFilesResponse() - err = client.DoAction(request, response) - return -} - -// DescribeLogBackupFilesWithChan invokes the rds.DescribeLogBackupFiles API asynchronously -func (client *Client) DescribeLogBackupFilesWithChan(request *DescribeLogBackupFilesRequest) (<-chan *DescribeLogBackupFilesResponse, <-chan error) { - responseChan := make(chan *DescribeLogBackupFilesResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeLogBackupFiles(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeLogBackupFilesWithCallback invokes the rds.DescribeLogBackupFiles API asynchronously -func (client *Client) DescribeLogBackupFilesWithCallback(request *DescribeLogBackupFilesRequest, callback func(response *DescribeLogBackupFilesResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeLogBackupFilesResponse - var err error - defer close(result) - response, err = client.DescribeLogBackupFiles(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeLogBackupFilesRequest is the request struct for api DescribeLogBackupFiles -type DescribeLogBackupFilesRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - StartTime string `position:"Query" name:"StartTime"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - EndTime string `position:"Query" name:"EndTime"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// DescribeLogBackupFilesResponse is the response struct for api DescribeLogBackupFiles -type DescribeLogBackupFilesResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - TotalRecordCount int `json:"TotalRecordCount" xml:"TotalRecordCount"` - PageNumber int `json:"PageNumber" xml:"PageNumber"` - PageRecordCount int `json:"PageRecordCount" xml:"PageRecordCount"` - TotalFileSize int64 `json:"TotalFileSize" xml:"TotalFileSize"` - Items ItemsInDescribeLogBackupFiles `json:"Items" xml:"Items"` -} - -// CreateDescribeLogBackupFilesRequest creates a request to invoke DescribeLogBackupFiles API -func CreateDescribeLogBackupFilesRequest() (request *DescribeLogBackupFilesRequest) { - request = &DescribeLogBackupFilesRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeLogBackupFiles", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeLogBackupFilesResponse creates a response to parse from DescribeLogBackupFiles response -func CreateDescribeLogBackupFilesResponse() (response *DescribeLogBackupFilesResponse) { - response = &DescribeLogBackupFilesResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_meta_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_meta_list.go deleted file mode 100644 index cdb946db971..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_meta_list.go +++ /dev/null @@ -1,116 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeMetaList invokes the rds.DescribeMetaList API synchronously -func (client *Client) DescribeMetaList(request *DescribeMetaListRequest) (response *DescribeMetaListResponse, err error) { - response = CreateDescribeMetaListResponse() - err = client.DoAction(request, response) - return -} - -// DescribeMetaListWithChan invokes the rds.DescribeMetaList API asynchronously -func (client *Client) DescribeMetaListWithChan(request *DescribeMetaListRequest) (<-chan *DescribeMetaListResponse, <-chan error) { - responseChan := make(chan *DescribeMetaListResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeMetaList(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeMetaListWithCallback invokes the rds.DescribeMetaList API asynchronously -func (client *Client) DescribeMetaListWithCallback(request *DescribeMetaListRequest, callback func(response *DescribeMetaListResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeMetaListResponse - var err error - defer close(result) - response, err = client.DescribeMetaList(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeMetaListRequest is the request struct for api DescribeMetaList -type DescribeMetaListRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ClientToken string `position:"Query" name:"ClientToken"` - Pattern string `position:"Query" name:"Pattern"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - PageIndex requests.Integer `position:"Query" name:"PageIndex"` - RestoreTime string `position:"Query" name:"RestoreTime"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - BackupSetID requests.Integer `position:"Query" name:"BackupSetID"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - GetDbName string `position:"Query" name:"GetDbName"` - RestoreType string `position:"Query" name:"RestoreType"` -} - -// DescribeMetaListResponse is the response struct for api DescribeMetaList -type DescribeMetaListResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceName string `json:"DBInstanceName" xml:"DBInstanceName"` - PageNumber int `json:"PageNumber" xml:"PageNumber"` - PageRecordCount int `json:"PageRecordCount" xml:"PageRecordCount"` - TotalRecordCount int `json:"TotalRecordCount" xml:"TotalRecordCount"` - TotalPageCount int `json:"TotalPageCount" xml:"TotalPageCount"` - Items ItemsInDescribeMetaList `json:"Items" xml:"Items"` -} - -// CreateDescribeMetaListRequest creates a request to invoke DescribeMetaList API -func CreateDescribeMetaListRequest() (request *DescribeMetaListRequest) { - request = &DescribeMetaListRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeMetaList", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeMetaListResponse creates a response to parse from DescribeMetaList response -func CreateDescribeMetaListResponse() (response *DescribeMetaListResponse) { - response = &DescribeMetaListResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_migrate_task_by_id.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_migrate_task_by_id.go deleted file mode 100644 index 383a49e53a9..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_migrate_task_by_id.go +++ /dev/null @@ -1,112 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeMigrateTaskById invokes the rds.DescribeMigrateTaskById API synchronously -func (client *Client) DescribeMigrateTaskById(request *DescribeMigrateTaskByIdRequest) (response *DescribeMigrateTaskByIdResponse, err error) { - response = CreateDescribeMigrateTaskByIdResponse() - err = client.DoAction(request, response) - return -} - -// DescribeMigrateTaskByIdWithChan invokes the rds.DescribeMigrateTaskById API asynchronously -func (client *Client) DescribeMigrateTaskByIdWithChan(request *DescribeMigrateTaskByIdRequest) (<-chan *DescribeMigrateTaskByIdResponse, <-chan error) { - responseChan := make(chan *DescribeMigrateTaskByIdResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeMigrateTaskById(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeMigrateTaskByIdWithCallback invokes the rds.DescribeMigrateTaskById API asynchronously -func (client *Client) DescribeMigrateTaskByIdWithCallback(request *DescribeMigrateTaskByIdRequest, callback func(response *DescribeMigrateTaskByIdResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeMigrateTaskByIdResponse - var err error - defer close(result) - response, err = client.DescribeMigrateTaskById(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeMigrateTaskByIdRequest is the request struct for api DescribeMigrateTaskById -type DescribeMigrateTaskByIdRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - MigrateTaskId string `position:"Query" name:"MigrateTaskId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// DescribeMigrateTaskByIdResponse is the response struct for api DescribeMigrateTaskById -type DescribeMigrateTaskByIdResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceName string `json:"DBInstanceName" xml:"DBInstanceName"` - DBName string `json:"DBName" xml:"DBName"` - MigrateTaskId string `json:"MigrateTaskId" xml:"MigrateTaskId"` - CreateTime string `json:"CreateTime" xml:"CreateTime"` - EndTime string `json:"EndTime" xml:"EndTime"` - BackupMode string `json:"BackupMode" xml:"BackupMode"` - Status string `json:"Status" xml:"Status"` - IsDBReplaced string `json:"IsDBReplaced" xml:"IsDBReplaced"` - Description string `json:"Description" xml:"Description"` -} - -// CreateDescribeMigrateTaskByIdRequest creates a request to invoke DescribeMigrateTaskById API -func CreateDescribeMigrateTaskByIdRequest() (request *DescribeMigrateTaskByIdRequest) { - request = &DescribeMigrateTaskByIdRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeMigrateTaskById", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeMigrateTaskByIdResponse creates a response to parse from DescribeMigrateTaskById response -func CreateDescribeMigrateTaskByIdResponse() (response *DescribeMigrateTaskByIdResponse) { - response = &DescribeMigrateTaskByIdResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_migrate_tasks.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_migrate_tasks.go deleted file mode 100644 index cc34a434b8d..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_migrate_tasks.go +++ /dev/null @@ -1,111 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeMigrateTasks invokes the rds.DescribeMigrateTasks API synchronously -func (client *Client) DescribeMigrateTasks(request *DescribeMigrateTasksRequest) (response *DescribeMigrateTasksResponse, err error) { - response = CreateDescribeMigrateTasksResponse() - err = client.DoAction(request, response) - return -} - -// DescribeMigrateTasksWithChan invokes the rds.DescribeMigrateTasks API asynchronously -func (client *Client) DescribeMigrateTasksWithChan(request *DescribeMigrateTasksRequest) (<-chan *DescribeMigrateTasksResponse, <-chan error) { - responseChan := make(chan *DescribeMigrateTasksResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeMigrateTasks(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeMigrateTasksWithCallback invokes the rds.DescribeMigrateTasks API asynchronously -func (client *Client) DescribeMigrateTasksWithCallback(request *DescribeMigrateTasksRequest, callback func(response *DescribeMigrateTasksResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeMigrateTasksResponse - var err error - defer close(result) - response, err = client.DescribeMigrateTasks(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeMigrateTasksRequest is the request struct for api DescribeMigrateTasks -type DescribeMigrateTasksRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - StartTime string `position:"Query" name:"StartTime"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - EndTime string `position:"Query" name:"EndTime"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// DescribeMigrateTasksResponse is the response struct for api DescribeMigrateTasks -type DescribeMigrateTasksResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - TotalRecordCount int `json:"TotalRecordCount" xml:"TotalRecordCount"` - PageNumber int `json:"PageNumber" xml:"PageNumber"` - PageRecordCount int `json:"PageRecordCount" xml:"PageRecordCount"` - Items ItemsInDescribeMigrateTasks `json:"Items" xml:"Items"` -} - -// CreateDescribeMigrateTasksRequest creates a request to invoke DescribeMigrateTasks API -func CreateDescribeMigrateTasksRequest() (request *DescribeMigrateTasksRequest) { - request = &DescribeMigrateTasksRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeMigrateTasks", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeMigrateTasksResponse creates a response to parse from DescribeMigrateTasks response -func CreateDescribeMigrateTasksResponse() (response *DescribeMigrateTasksResponse) { - response = &DescribeMigrateTasksResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_migrate_tasks_for_sql_server.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_migrate_tasks_for_sql_server.go deleted file mode 100644 index da1166522e2..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_migrate_tasks_for_sql_server.go +++ /dev/null @@ -1,114 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeMigrateTasksForSQLServer invokes the rds.DescribeMigrateTasksForSQLServer API synchronously -func (client *Client) DescribeMigrateTasksForSQLServer(request *DescribeMigrateTasksForSQLServerRequest) (response *DescribeMigrateTasksForSQLServerResponse, err error) { - response = CreateDescribeMigrateTasksForSQLServerResponse() - err = client.DoAction(request, response) - return -} - -// DescribeMigrateTasksForSQLServerWithChan invokes the rds.DescribeMigrateTasksForSQLServer API asynchronously -func (client *Client) DescribeMigrateTasksForSQLServerWithChan(request *DescribeMigrateTasksForSQLServerRequest) (<-chan *DescribeMigrateTasksForSQLServerResponse, <-chan error) { - responseChan := make(chan *DescribeMigrateTasksForSQLServerResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeMigrateTasksForSQLServer(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeMigrateTasksForSQLServerWithCallback invokes the rds.DescribeMigrateTasksForSQLServer API asynchronously -func (client *Client) DescribeMigrateTasksForSQLServerWithCallback(request *DescribeMigrateTasksForSQLServerRequest, callback func(response *DescribeMigrateTasksForSQLServerResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeMigrateTasksForSQLServerResponse - var err error - defer close(result) - response, err = client.DescribeMigrateTasksForSQLServer(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeMigrateTasksForSQLServerRequest is the request struct for api DescribeMigrateTasksForSQLServer -type DescribeMigrateTasksForSQLServerRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - StartTime string `position:"Query" name:"StartTime"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - EndTime string `position:"Query" name:"EndTime"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// DescribeMigrateTasksForSQLServerResponse is the response struct for api DescribeMigrateTasksForSQLServer -type DescribeMigrateTasksForSQLServerResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceID string `json:"DBInstanceID" xml:"DBInstanceID"` - DBInstanceName string `json:"DBInstanceName" xml:"DBInstanceName"` - StartTime string `json:"StartTime" xml:"StartTime"` - EndTime string `json:"EndTime" xml:"EndTime"` - TotalRecordCount int `json:"TotalRecordCount" xml:"TotalRecordCount"` - PageNumber int `json:"PageNumber" xml:"PageNumber"` - PageRecordCount int `json:"PageRecordCount" xml:"PageRecordCount"` - Items ItemsInDescribeMigrateTasksForSQLServer `json:"Items" xml:"Items"` -} - -// CreateDescribeMigrateTasksForSQLServerRequest creates a request to invoke DescribeMigrateTasksForSQLServer API -func CreateDescribeMigrateTasksForSQLServerRequest() (request *DescribeMigrateTasksForSQLServerRequest) { - request = &DescribeMigrateTasksForSQLServerRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeMigrateTasksForSQLServer", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeMigrateTasksForSQLServerResponse creates a response to parse from DescribeMigrateTasksForSQLServer response -func CreateDescribeMigrateTasksForSQLServerResponse() (response *DescribeMigrateTasksForSQLServerResponse) { - response = &DescribeMigrateTasksForSQLServerResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_modify_parameter_log.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_modify_parameter_log.go deleted file mode 100644 index 84c4ed33fb8..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_modify_parameter_log.go +++ /dev/null @@ -1,114 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeModifyParameterLog invokes the rds.DescribeModifyParameterLog API synchronously -func (client *Client) DescribeModifyParameterLog(request *DescribeModifyParameterLogRequest) (response *DescribeModifyParameterLogResponse, err error) { - response = CreateDescribeModifyParameterLogResponse() - err = client.DoAction(request, response) - return -} - -// DescribeModifyParameterLogWithChan invokes the rds.DescribeModifyParameterLog API asynchronously -func (client *Client) DescribeModifyParameterLogWithChan(request *DescribeModifyParameterLogRequest) (<-chan *DescribeModifyParameterLogResponse, <-chan error) { - responseChan := make(chan *DescribeModifyParameterLogResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeModifyParameterLog(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeModifyParameterLogWithCallback invokes the rds.DescribeModifyParameterLog API asynchronously -func (client *Client) DescribeModifyParameterLogWithCallback(request *DescribeModifyParameterLogRequest, callback func(response *DescribeModifyParameterLogResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeModifyParameterLogResponse - var err error - defer close(result) - response, err = client.DescribeModifyParameterLog(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeModifyParameterLogRequest is the request struct for api DescribeModifyParameterLog -type DescribeModifyParameterLogRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - StartTime string `position:"Query" name:"StartTime"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - EndTime string `position:"Query" name:"EndTime"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// DescribeModifyParameterLogResponse is the response struct for api DescribeModifyParameterLog -type DescribeModifyParameterLogResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Engine string `json:"Engine" xml:"Engine"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - EngineVersion string `json:"EngineVersion" xml:"EngineVersion"` - TotalRecordCount int `json:"TotalRecordCount" xml:"TotalRecordCount"` - PageNumber int `json:"PageNumber" xml:"PageNumber"` - PageRecordCount int `json:"PageRecordCount" xml:"PageRecordCount"` - Items ItemsInDescribeModifyParameterLog `json:"Items" xml:"Items"` -} - -// CreateDescribeModifyParameterLogRequest creates a request to invoke DescribeModifyParameterLog API -func CreateDescribeModifyParameterLogRequest() (request *DescribeModifyParameterLogRequest) { - request = &DescribeModifyParameterLogRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeModifyParameterLog", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeModifyParameterLogResponse creates a response to parse from DescribeModifyParameterLog response -func CreateDescribeModifyParameterLogResponse() (response *DescribeModifyParameterLogResponse) { - response = &DescribeModifyParameterLogResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_oss_downloads.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_oss_downloads.go deleted file mode 100644 index 3a58cedc24f..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_oss_downloads.go +++ /dev/null @@ -1,106 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeOssDownloads invokes the rds.DescribeOssDownloads API synchronously -func (client *Client) DescribeOssDownloads(request *DescribeOssDownloadsRequest) (response *DescribeOssDownloadsResponse, err error) { - response = CreateDescribeOssDownloadsResponse() - err = client.DoAction(request, response) - return -} - -// DescribeOssDownloadsWithChan invokes the rds.DescribeOssDownloads API asynchronously -func (client *Client) DescribeOssDownloadsWithChan(request *DescribeOssDownloadsRequest) (<-chan *DescribeOssDownloadsResponse, <-chan error) { - responseChan := make(chan *DescribeOssDownloadsResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeOssDownloads(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeOssDownloadsWithCallback invokes the rds.DescribeOssDownloads API asynchronously -func (client *Client) DescribeOssDownloadsWithCallback(request *DescribeOssDownloadsRequest, callback func(response *DescribeOssDownloadsResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeOssDownloadsResponse - var err error - defer close(result) - response, err = client.DescribeOssDownloads(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeOssDownloadsRequest is the request struct for api DescribeOssDownloads -type DescribeOssDownloadsRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - MigrateTaskId string `position:"Query" name:"MigrateTaskId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// DescribeOssDownloadsResponse is the response struct for api DescribeOssDownloads -type DescribeOssDownloadsResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - MigrateTaskId string `json:"MigrateTaskId" xml:"MigrateTaskId"` - Items ItemsInDescribeOssDownloads `json:"Items" xml:"Items"` -} - -// CreateDescribeOssDownloadsRequest creates a request to invoke DescribeOssDownloads API -func CreateDescribeOssDownloadsRequest() (request *DescribeOssDownloadsRequest) { - request = &DescribeOssDownloadsRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeOssDownloads", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeOssDownloadsResponse creates a response to parse from DescribeOssDownloads response -func CreateDescribeOssDownloadsResponse() (response *DescribeOssDownloadsResponse) { - response = &DescribeOssDownloadsResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_oss_downloads_for_sql_server.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_oss_downloads_for_sql_server.go deleted file mode 100644 index 3dff8cd4384..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_oss_downloads_for_sql_server.go +++ /dev/null @@ -1,106 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeOssDownloadsForSQLServer invokes the rds.DescribeOssDownloadsForSQLServer API synchronously -func (client *Client) DescribeOssDownloadsForSQLServer(request *DescribeOssDownloadsForSQLServerRequest) (response *DescribeOssDownloadsForSQLServerResponse, err error) { - response = CreateDescribeOssDownloadsForSQLServerResponse() - err = client.DoAction(request, response) - return -} - -// DescribeOssDownloadsForSQLServerWithChan invokes the rds.DescribeOssDownloadsForSQLServer API asynchronously -func (client *Client) DescribeOssDownloadsForSQLServerWithChan(request *DescribeOssDownloadsForSQLServerRequest) (<-chan *DescribeOssDownloadsForSQLServerResponse, <-chan error) { - responseChan := make(chan *DescribeOssDownloadsForSQLServerResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeOssDownloadsForSQLServer(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeOssDownloadsForSQLServerWithCallback invokes the rds.DescribeOssDownloadsForSQLServer API asynchronously -func (client *Client) DescribeOssDownloadsForSQLServerWithCallback(request *DescribeOssDownloadsForSQLServerRequest, callback func(response *DescribeOssDownloadsForSQLServerResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeOssDownloadsForSQLServerResponse - var err error - defer close(result) - response, err = client.DescribeOssDownloadsForSQLServer(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeOssDownloadsForSQLServerRequest is the request struct for api DescribeOssDownloadsForSQLServer -type DescribeOssDownloadsForSQLServerRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - MigrateTaskId string `position:"Query" name:"MigrateTaskId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// DescribeOssDownloadsForSQLServerResponse is the response struct for api DescribeOssDownloadsForSQLServer -type DescribeOssDownloadsForSQLServerResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceName string `json:"DBInstanceName" xml:"DBInstanceName"` - MigrateIaskId string `json:"MigrateIaskId" xml:"MigrateIaskId"` - Items ItemsInDescribeOssDownloadsForSQLServer `json:"Items" xml:"Items"` -} - -// CreateDescribeOssDownloadsForSQLServerRequest creates a request to invoke DescribeOssDownloadsForSQLServer API -func CreateDescribeOssDownloadsForSQLServerRequest() (request *DescribeOssDownloadsForSQLServerRequest) { - request = &DescribeOssDownloadsForSQLServerRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeOssDownloadsForSQLServer", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeOssDownloadsForSQLServerResponse creates a response to parse from DescribeOssDownloadsForSQLServer response -func CreateDescribeOssDownloadsForSQLServerResponse() (response *DescribeOssDownloadsForSQLServerResponse) { - response = &DescribeOssDownloadsForSQLServerResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_parameter_group.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_parameter_group.go deleted file mode 100644 index 6c4e5585fb0..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_parameter_group.go +++ /dev/null @@ -1,103 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeParameterGroup invokes the rds.DescribeParameterGroup API synchronously -func (client *Client) DescribeParameterGroup(request *DescribeParameterGroupRequest) (response *DescribeParameterGroupResponse, err error) { - response = CreateDescribeParameterGroupResponse() - err = client.DoAction(request, response) - return -} - -// DescribeParameterGroupWithChan invokes the rds.DescribeParameterGroup API asynchronously -func (client *Client) DescribeParameterGroupWithChan(request *DescribeParameterGroupRequest) (<-chan *DescribeParameterGroupResponse, <-chan error) { - responseChan := make(chan *DescribeParameterGroupResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeParameterGroup(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeParameterGroupWithCallback invokes the rds.DescribeParameterGroup API asynchronously -func (client *Client) DescribeParameterGroupWithCallback(request *DescribeParameterGroupRequest, callback func(response *DescribeParameterGroupResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeParameterGroupResponse - var err error - defer close(result) - response, err = client.DescribeParameterGroup(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeParameterGroupRequest is the request struct for api DescribeParameterGroup -type DescribeParameterGroupRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - ParameterGroupId string `position:"Query" name:"ParameterGroupId"` -} - -// DescribeParameterGroupResponse is the response struct for api DescribeParameterGroup -type DescribeParameterGroupResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - ParamGroup ParamGroup `json:"ParamGroup" xml:"ParamGroup"` -} - -// CreateDescribeParameterGroupRequest creates a request to invoke DescribeParameterGroup API -func CreateDescribeParameterGroupRequest() (request *DescribeParameterGroupRequest) { - request = &DescribeParameterGroupRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeParameterGroup", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeParameterGroupResponse creates a response to parse from DescribeParameterGroup response -func CreateDescribeParameterGroupResponse() (response *DescribeParameterGroupResponse) { - response = &DescribeParameterGroupResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_parameter_groups.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_parameter_groups.go deleted file mode 100644 index b3af84938ba..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_parameter_groups.go +++ /dev/null @@ -1,103 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeParameterGroups invokes the rds.DescribeParameterGroups API synchronously -func (client *Client) DescribeParameterGroups(request *DescribeParameterGroupsRequest) (response *DescribeParameterGroupsResponse, err error) { - response = CreateDescribeParameterGroupsResponse() - err = client.DoAction(request, response) - return -} - -// DescribeParameterGroupsWithChan invokes the rds.DescribeParameterGroups API asynchronously -func (client *Client) DescribeParameterGroupsWithChan(request *DescribeParameterGroupsRequest) (<-chan *DescribeParameterGroupsResponse, <-chan error) { - responseChan := make(chan *DescribeParameterGroupsResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeParameterGroups(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeParameterGroupsWithCallback invokes the rds.DescribeParameterGroups API asynchronously -func (client *Client) DescribeParameterGroupsWithCallback(request *DescribeParameterGroupsRequest, callback func(response *DescribeParameterGroupsResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeParameterGroupsResponse - var err error - defer close(result) - response, err = client.DescribeParameterGroups(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeParameterGroupsRequest is the request struct for api DescribeParameterGroups -type DescribeParameterGroupsRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// DescribeParameterGroupsResponse is the response struct for api DescribeParameterGroups -type DescribeParameterGroupsResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - SignalForOptimizeParams bool `json:"SignalForOptimizeParams" xml:"SignalForOptimizeParams"` - ParameterGroups ParameterGroups `json:"ParameterGroups" xml:"ParameterGroups"` -} - -// CreateDescribeParameterGroupsRequest creates a request to invoke DescribeParameterGroups API -func CreateDescribeParameterGroupsRequest() (request *DescribeParameterGroupsRequest) { - request = &DescribeParameterGroupsRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeParameterGroups", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeParameterGroupsResponse creates a response to parse from DescribeParameterGroups response -func CreateDescribeParameterGroupsResponse() (response *DescribeParameterGroupsResponse) { - response = &DescribeParameterGroupsResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_parameter_templates.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_parameter_templates.go deleted file mode 100644 index af5421f6caf..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_parameter_templates.go +++ /dev/null @@ -1,111 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeParameterTemplates invokes the rds.DescribeParameterTemplates API synchronously -func (client *Client) DescribeParameterTemplates(request *DescribeParameterTemplatesRequest) (response *DescribeParameterTemplatesResponse, err error) { - response = CreateDescribeParameterTemplatesResponse() - err = client.DoAction(request, response) - return -} - -// DescribeParameterTemplatesWithChan invokes the rds.DescribeParameterTemplates API asynchronously -func (client *Client) DescribeParameterTemplatesWithChan(request *DescribeParameterTemplatesRequest) (<-chan *DescribeParameterTemplatesResponse, <-chan error) { - responseChan := make(chan *DescribeParameterTemplatesResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeParameterTemplates(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeParameterTemplatesWithCallback invokes the rds.DescribeParameterTemplates API asynchronously -func (client *Client) DescribeParameterTemplatesWithCallback(request *DescribeParameterTemplatesRequest, callback func(response *DescribeParameterTemplatesResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeParameterTemplatesResponse - var err error - defer close(result) - response, err = client.DescribeParameterTemplates(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeParameterTemplatesRequest is the request struct for api DescribeParameterTemplates -type DescribeParameterTemplatesRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ClientToken string `position:"Query" name:"ClientToken"` - EngineVersion string `position:"Query" name:"EngineVersion"` - Engine string `position:"Query" name:"Engine"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - Category string `position:"Query" name:"Category"` -} - -// DescribeParameterTemplatesResponse is the response struct for api DescribeParameterTemplates -type DescribeParameterTemplatesResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Engine string `json:"Engine" xml:"Engine"` - EngineVersion string `json:"EngineVersion" xml:"EngineVersion"` - ParameterCount string `json:"ParameterCount" xml:"ParameterCount"` - Parameters Parameters `json:"Parameters" xml:"Parameters"` -} - -// CreateDescribeParameterTemplatesRequest creates a request to invoke DescribeParameterTemplates API -func CreateDescribeParameterTemplatesRequest() (request *DescribeParameterTemplatesRequest) { - request = &DescribeParameterTemplatesRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeParameterTemplates", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeParameterTemplatesResponse creates a response to parse from DescribeParameterTemplates response -func CreateDescribeParameterTemplatesResponse() (response *DescribeParameterTemplatesResponse) { - response = &DescribeParameterTemplatesResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_parameters.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_parameters.go deleted file mode 100644 index ccc7e82f599..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_parameters.go +++ /dev/null @@ -1,108 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeParameters invokes the rds.DescribeParameters API synchronously -func (client *Client) DescribeParameters(request *DescribeParametersRequest) (response *DescribeParametersResponse, err error) { - response = CreateDescribeParametersResponse() - err = client.DoAction(request, response) - return -} - -// DescribeParametersWithChan invokes the rds.DescribeParameters API asynchronously -func (client *Client) DescribeParametersWithChan(request *DescribeParametersRequest) (<-chan *DescribeParametersResponse, <-chan error) { - responseChan := make(chan *DescribeParametersResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeParameters(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeParametersWithCallback invokes the rds.DescribeParameters API asynchronously -func (client *Client) DescribeParametersWithCallback(request *DescribeParametersRequest, callback func(response *DescribeParametersResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeParametersResponse - var err error - defer close(result) - response, err = client.DescribeParameters(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeParametersRequest is the request struct for api DescribeParameters -type DescribeParametersRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - ClientToken string `position:"Query" name:"ClientToken"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// DescribeParametersResponse is the response struct for api DescribeParameters -type DescribeParametersResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Engine string `json:"Engine" xml:"Engine"` - EngineVersion string `json:"EngineVersion" xml:"EngineVersion"` - ConfigParameters ConfigParameters `json:"ConfigParameters" xml:"ConfigParameters"` - RunningParameters RunningParameters `json:"RunningParameters" xml:"RunningParameters"` -} - -// CreateDescribeParametersRequest creates a request to invoke DescribeParameters API -func CreateDescribeParametersRequest() (request *DescribeParametersRequest) { - request = &DescribeParametersRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeParameters", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeParametersResponse creates a response to parse from DescribeParameters response -func CreateDescribeParametersResponse() (response *DescribeParametersResponse) { - response = &DescribeParametersResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_price.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_price.go deleted file mode 100644 index 649f4acb53a..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_price.go +++ /dev/null @@ -1,119 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribePrice invokes the rds.DescribePrice API synchronously -func (client *Client) DescribePrice(request *DescribePriceRequest) (response *DescribePriceResponse, err error) { - response = CreateDescribePriceResponse() - err = client.DoAction(request, response) - return -} - -// DescribePriceWithChan invokes the rds.DescribePrice API asynchronously -func (client *Client) DescribePriceWithChan(request *DescribePriceRequest) (<-chan *DescribePriceResponse, <-chan error) { - responseChan := make(chan *DescribePriceResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribePrice(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribePriceWithCallback invokes the rds.DescribePrice API asynchronously -func (client *Client) DescribePriceWithCallback(request *DescribePriceRequest, callback func(response *DescribePriceResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribePriceResponse - var err error - defer close(result) - response, err = client.DescribePrice(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribePriceRequest is the request struct for api DescribePrice -type DescribePriceRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - DBInstanceStorage requests.Integer `position:"Query" name:"DBInstanceStorage"` - ClientToken string `position:"Query" name:"ClientToken"` - EngineVersion string `position:"Query" name:"EngineVersion"` - Engine string `position:"Query" name:"Engine"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - DBInstanceStorageType string `position:"Query" name:"DBInstanceStorageType"` - Quantity requests.Integer `position:"Query" name:"Quantity"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - CommodityCode string `position:"Query" name:"CommodityCode"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - UsedTime requests.Integer `position:"Query" name:"UsedTime"` - DBInstanceClass string `position:"Query" name:"DBInstanceClass"` - InstanceUsedType requests.Integer `position:"Query" name:"InstanceUsedType"` - ZoneId string `position:"Query" name:"ZoneId"` - TimeType string `position:"Query" name:"TimeType"` - PayType string `position:"Query" name:"PayType"` - OrderType string `position:"Query" name:"OrderType"` -} - -// DescribePriceResponse is the response struct for api DescribePrice -type DescribePriceResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - PriceInfo PriceInfo `json:"PriceInfo" xml:"PriceInfo"` - Rules RulesInDescribePrice `json:"Rules" xml:"Rules"` -} - -// CreateDescribePriceRequest creates a request to invoke DescribePrice API -func CreateDescribePriceRequest() (request *DescribePriceRequest) { - request = &DescribePriceRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribePrice", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribePriceResponse creates a response to parse from DescribePrice response -func CreateDescribePriceResponse() (response *DescribePriceResponse) { - response = &DescribePriceResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_rds_resource_settings.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_rds_resource_settings.go deleted file mode 100644 index 9e5f8f17b51..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_rds_resource_settings.go +++ /dev/null @@ -1,103 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeRdsResourceSettings invokes the rds.DescribeRdsResourceSettings API synchronously -func (client *Client) DescribeRdsResourceSettings(request *DescribeRdsResourceSettingsRequest) (response *DescribeRdsResourceSettingsResponse, err error) { - response = CreateDescribeRdsResourceSettingsResponse() - err = client.DoAction(request, response) - return -} - -// DescribeRdsResourceSettingsWithChan invokes the rds.DescribeRdsResourceSettings API asynchronously -func (client *Client) DescribeRdsResourceSettingsWithChan(request *DescribeRdsResourceSettingsRequest) (<-chan *DescribeRdsResourceSettingsResponse, <-chan error) { - responseChan := make(chan *DescribeRdsResourceSettingsResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeRdsResourceSettings(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeRdsResourceSettingsWithCallback invokes the rds.DescribeRdsResourceSettings API asynchronously -func (client *Client) DescribeRdsResourceSettingsWithCallback(request *DescribeRdsResourceSettingsRequest, callback func(response *DescribeRdsResourceSettingsResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeRdsResourceSettingsResponse - var err error - defer close(result) - response, err = client.DescribeRdsResourceSettings(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeRdsResourceSettingsRequest is the request struct for api DescribeRdsResourceSettings -type DescribeRdsResourceSettingsRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - ResourceNiche string `position:"Query" name:"ResourceNiche"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// DescribeRdsResourceSettingsResponse is the response struct for api DescribeRdsResourceSettings -type DescribeRdsResourceSettingsResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - RdsInstanceResourceSettings RdsInstanceResourceSettings `json:"RdsInstanceResourceSettings" xml:"RdsInstanceResourceSettings"` -} - -// CreateDescribeRdsResourceSettingsRequest creates a request to invoke DescribeRdsResourceSettings API -func CreateDescribeRdsResourceSettingsRequest() (request *DescribeRdsResourceSettingsRequest) { - request = &DescribeRdsResourceSettingsRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeRdsResourceSettings", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeRdsResourceSettingsResponse creates a response to parse from DescribeRdsResourceSettings response -func CreateDescribeRdsResourceSettingsResponse() (response *DescribeRdsResourceSettingsResponse) { - response = &DescribeRdsResourceSettingsResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_read_db_instance_delay.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_read_db_instance_delay.go deleted file mode 100644 index ae69c4d3151..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_read_db_instance_delay.go +++ /dev/null @@ -1,109 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeReadDBInstanceDelay invokes the rds.DescribeReadDBInstanceDelay API synchronously -func (client *Client) DescribeReadDBInstanceDelay(request *DescribeReadDBInstanceDelayRequest) (response *DescribeReadDBInstanceDelayResponse, err error) { - response = CreateDescribeReadDBInstanceDelayResponse() - err = client.DoAction(request, response) - return -} - -// DescribeReadDBInstanceDelayWithChan invokes the rds.DescribeReadDBInstanceDelay API asynchronously -func (client *Client) DescribeReadDBInstanceDelayWithChan(request *DescribeReadDBInstanceDelayRequest) (<-chan *DescribeReadDBInstanceDelayResponse, <-chan error) { - responseChan := make(chan *DescribeReadDBInstanceDelayResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeReadDBInstanceDelay(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeReadDBInstanceDelayWithCallback invokes the rds.DescribeReadDBInstanceDelay API asynchronously -func (client *Client) DescribeReadDBInstanceDelayWithCallback(request *DescribeReadDBInstanceDelayRequest, callback func(response *DescribeReadDBInstanceDelayResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeReadDBInstanceDelayResponse - var err error - defer close(result) - response, err = client.DescribeReadDBInstanceDelay(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeReadDBInstanceDelayRequest is the request struct for api DescribeReadDBInstanceDelay -type DescribeReadDBInstanceDelayRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - SecurityToken string `position:"Query" name:"SecurityToken"` - ReadInstanceId string `position:"Query" name:"ReadInstanceId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// DescribeReadDBInstanceDelayResponse is the response struct for api DescribeReadDBInstanceDelay -type DescribeReadDBInstanceDelayResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - ReadDBInstanceId string `json:"ReadDBInstanceId" xml:"ReadDBInstanceId"` - DelayTime int `json:"DelayTime" xml:"DelayTime"` - Items ItemsInDescribeReadDBInstanceDelay `json:"Items" xml:"Items"` -} - -// CreateDescribeReadDBInstanceDelayRequest creates a request to invoke DescribeReadDBInstanceDelay API -func CreateDescribeReadDBInstanceDelayRequest() (request *DescribeReadDBInstanceDelayRequest) { - request = &DescribeReadDBInstanceDelayRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeReadDBInstanceDelay", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeReadDBInstanceDelayResponse creates a response to parse from DescribeReadDBInstanceDelay response -func CreateDescribeReadDBInstanceDelayResponse() (response *DescribeReadDBInstanceDelayResponse) { - response = &DescribeReadDBInstanceDelayResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_regions.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_regions.go deleted file mode 100644 index 599b9239ab9..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_regions.go +++ /dev/null @@ -1,104 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeRegions invokes the rds.DescribeRegions API synchronously -func (client *Client) DescribeRegions(request *DescribeRegionsRequest) (response *DescribeRegionsResponse, err error) { - response = CreateDescribeRegionsResponse() - err = client.DoAction(request, response) - return -} - -// DescribeRegionsWithChan invokes the rds.DescribeRegions API asynchronously -func (client *Client) DescribeRegionsWithChan(request *DescribeRegionsRequest) (<-chan *DescribeRegionsResponse, <-chan error) { - responseChan := make(chan *DescribeRegionsResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeRegions(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeRegionsWithCallback invokes the rds.DescribeRegions API asynchronously -func (client *Client) DescribeRegionsWithCallback(request *DescribeRegionsRequest, callback func(response *DescribeRegionsResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeRegionsResponse - var err error - defer close(result) - response, err = client.DescribeRegions(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeRegionsRequest is the request struct for api DescribeRegions -type DescribeRegionsRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - ClientToken string `position:"Query" name:"ClientToken"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// DescribeRegionsResponse is the response struct for api DescribeRegions -type DescribeRegionsResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Regions RegionsInDescribeRegions `json:"Regions" xml:"Regions"` -} - -// CreateDescribeRegionsRequest creates a request to invoke DescribeRegions API -func CreateDescribeRegionsRequest() (request *DescribeRegionsRequest) { - request = &DescribeRegionsRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeRegions", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeRegionsResponse creates a response to parse from DescribeRegions response -func CreateDescribeRegionsResponse() (response *DescribeRegionsResponse) { - response = &DescribeRegionsResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_renewal_price.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_renewal_price.go deleted file mode 100644 index 6e8c88df2c5..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_renewal_price.go +++ /dev/null @@ -1,115 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeRenewalPrice invokes the rds.DescribeRenewalPrice API synchronously -func (client *Client) DescribeRenewalPrice(request *DescribeRenewalPriceRequest) (response *DescribeRenewalPriceResponse, err error) { - response = CreateDescribeRenewalPriceResponse() - err = client.DoAction(request, response) - return -} - -// DescribeRenewalPriceWithChan invokes the rds.DescribeRenewalPrice API asynchronously -func (client *Client) DescribeRenewalPriceWithChan(request *DescribeRenewalPriceRequest) (<-chan *DescribeRenewalPriceResponse, <-chan error) { - responseChan := make(chan *DescribeRenewalPriceResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeRenewalPrice(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeRenewalPriceWithCallback invokes the rds.DescribeRenewalPrice API asynchronously -func (client *Client) DescribeRenewalPriceWithCallback(request *DescribeRenewalPriceRequest, callback func(response *DescribeRenewalPriceResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeRenewalPriceResponse - var err error - defer close(result) - response, err = client.DescribeRenewalPrice(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeRenewalPriceRequest is the request struct for api DescribeRenewalPrice -type DescribeRenewalPriceRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ClientToken string `position:"Query" name:"ClientToken"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - BusinessInfo string `position:"Query" name:"BusinessInfo"` - Quantity requests.Integer `position:"Query" name:"Quantity"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - CommodityCode string `position:"Query" name:"CommodityCode"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - UsedTime requests.Integer `position:"Query" name:"UsedTime"` - DBInstanceClass string `position:"Query" name:"DBInstanceClass"` - PromotionCode string `position:"Query" name:"PromotionCode"` - TimeType string `position:"Query" name:"TimeType"` - PayType string `position:"Query" name:"PayType"` - OrderType string `position:"Query" name:"OrderType"` -} - -// DescribeRenewalPriceResponse is the response struct for api DescribeRenewalPrice -type DescribeRenewalPriceResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - PriceInfo PriceInfo `json:"PriceInfo" xml:"PriceInfo"` - Rules RulesInDescribeRenewalPrice `json:"Rules" xml:"Rules"` -} - -// CreateDescribeRenewalPriceRequest creates a request to invoke DescribeRenewalPrice API -func CreateDescribeRenewalPriceRequest() (request *DescribeRenewalPriceRequest) { - request = &DescribeRenewalPriceRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeRenewalPrice", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeRenewalPriceResponse creates a response to parse from DescribeRenewalPrice response -func CreateDescribeRenewalPriceResponse() (response *DescribeRenewalPriceResponse) { - response = &DescribeRenewalPriceResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_resource_usage.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_resource_usage.go deleted file mode 100644 index 9e9fbb34a97..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_resource_usage.go +++ /dev/null @@ -1,118 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeResourceUsage invokes the rds.DescribeResourceUsage API synchronously -func (client *Client) DescribeResourceUsage(request *DescribeResourceUsageRequest) (response *DescribeResourceUsageResponse, err error) { - response = CreateDescribeResourceUsageResponse() - err = client.DoAction(request, response) - return -} - -// DescribeResourceUsageWithChan invokes the rds.DescribeResourceUsage API asynchronously -func (client *Client) DescribeResourceUsageWithChan(request *DescribeResourceUsageRequest) (<-chan *DescribeResourceUsageResponse, <-chan error) { - responseChan := make(chan *DescribeResourceUsageResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeResourceUsage(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeResourceUsageWithCallback invokes the rds.DescribeResourceUsage API asynchronously -func (client *Client) DescribeResourceUsageWithCallback(request *DescribeResourceUsageRequest, callback func(response *DescribeResourceUsageResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeResourceUsageResponse - var err error - defer close(result) - response, err = client.DescribeResourceUsage(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeResourceUsageRequest is the request struct for api DescribeResourceUsage -type DescribeResourceUsageRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - ClientToken string `position:"Query" name:"ClientToken"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// DescribeResourceUsageResponse is the response struct for api DescribeResourceUsage -type DescribeResourceUsageResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - Engine string `json:"Engine" xml:"Engine"` - DiskUsed int64 `json:"DiskUsed" xml:"DiskUsed"` - DataSize int64 `json:"DataSize" xml:"DataSize"` - LogSize int64 `json:"LogSize" xml:"LogSize"` - BackupSize int64 `json:"BackupSize" xml:"BackupSize"` - BackupOssDataSize int64 `json:"BackupOssDataSize" xml:"BackupOssDataSize"` - BackupOssLogSize int64 `json:"BackupOssLogSize" xml:"BackupOssLogSize"` - SQLSize int64 `json:"SQLSize" xml:"SQLSize"` - ColdBackupSize int64 `json:"ColdBackupSize" xml:"ColdBackupSize"` - BackupDataSize int64 `json:"BackupDataSize" xml:"BackupDataSize"` - BackupLogSize int64 `json:"BackupLogSize" xml:"BackupLogSize"` - PaidBackupSize int64 `json:"PaidBackupSize" xml:"PaidBackupSize"` - ArchiveBackupSize int64 `json:"ArchiveBackupSize" xml:"ArchiveBackupSize"` -} - -// CreateDescribeResourceUsageRequest creates a request to invoke DescribeResourceUsage API -func CreateDescribeResourceUsageRequest() (request *DescribeResourceUsageRequest) { - request = &DescribeResourceUsageRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeResourceUsage", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeResourceUsageResponse creates a response to parse from DescribeResourceUsage response -func CreateDescribeResourceUsageResponse() (response *DescribeResourceUsageResponse) { - response = &DescribeResourceUsageResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_security_group_configuration.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_security_group_configuration.go deleted file mode 100644 index 371f59d35aa..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_security_group_configuration.go +++ /dev/null @@ -1,104 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeSecurityGroupConfiguration invokes the rds.DescribeSecurityGroupConfiguration API synchronously -func (client *Client) DescribeSecurityGroupConfiguration(request *DescribeSecurityGroupConfigurationRequest) (response *DescribeSecurityGroupConfigurationResponse, err error) { - response = CreateDescribeSecurityGroupConfigurationResponse() - err = client.DoAction(request, response) - return -} - -// DescribeSecurityGroupConfigurationWithChan invokes the rds.DescribeSecurityGroupConfiguration API asynchronously -func (client *Client) DescribeSecurityGroupConfigurationWithChan(request *DescribeSecurityGroupConfigurationRequest) (<-chan *DescribeSecurityGroupConfigurationResponse, <-chan error) { - responseChan := make(chan *DescribeSecurityGroupConfigurationResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeSecurityGroupConfiguration(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeSecurityGroupConfigurationWithCallback invokes the rds.DescribeSecurityGroupConfiguration API asynchronously -func (client *Client) DescribeSecurityGroupConfigurationWithCallback(request *DescribeSecurityGroupConfigurationRequest, callback func(response *DescribeSecurityGroupConfigurationResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeSecurityGroupConfigurationResponse - var err error - defer close(result) - response, err = client.DescribeSecurityGroupConfiguration(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeSecurityGroupConfigurationRequest is the request struct for api DescribeSecurityGroupConfiguration -type DescribeSecurityGroupConfigurationRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// DescribeSecurityGroupConfigurationResponse is the response struct for api DescribeSecurityGroupConfiguration -type DescribeSecurityGroupConfigurationResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceName string `json:"DBInstanceName" xml:"DBInstanceName"` - Items ItemsInDescribeSecurityGroupConfiguration `json:"Items" xml:"Items"` -} - -// CreateDescribeSecurityGroupConfigurationRequest creates a request to invoke DescribeSecurityGroupConfiguration API -func CreateDescribeSecurityGroupConfigurationRequest() (request *DescribeSecurityGroupConfigurationRequest) { - request = &DescribeSecurityGroupConfigurationRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeSecurityGroupConfiguration", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeSecurityGroupConfigurationResponse creates a response to parse from DescribeSecurityGroupConfiguration response -func CreateDescribeSecurityGroupConfigurationResponse() (response *DescribeSecurityGroupConfigurationResponse) { - response = &DescribeSecurityGroupConfigurationResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_slow_log_records.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_slow_log_records.go deleted file mode 100644 index 3262261304b..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_slow_log_records.go +++ /dev/null @@ -1,123 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeSlowLogRecords invokes the rds.DescribeSlowLogRecords API synchronously -func (client *Client) DescribeSlowLogRecords(request *DescribeSlowLogRecordsRequest) (response *DescribeSlowLogRecordsResponse, err error) { - response = CreateDescribeSlowLogRecordsResponse() - err = client.DoAction(request, response) - return -} - -// DescribeSlowLogRecordsWithChan invokes the rds.DescribeSlowLogRecords API asynchronously -func (client *Client) DescribeSlowLogRecordsWithChan(request *DescribeSlowLogRecordsRequest) (<-chan *DescribeSlowLogRecordsResponse, <-chan error) { - responseChan := make(chan *DescribeSlowLogRecordsResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeSlowLogRecords(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeSlowLogRecordsWithCallback invokes the rds.DescribeSlowLogRecords API asynchronously -func (client *Client) DescribeSlowLogRecordsWithCallback(request *DescribeSlowLogRecordsRequest, callback func(response *DescribeSlowLogRecordsResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeSlowLogRecordsResponse - var err error - defer close(result) - response, err = client.DescribeSlowLogRecords(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeSlowLogRecordsRequest is the request struct for api DescribeSlowLogRecords -type DescribeSlowLogRecordsRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - StartTime string `position:"Query" name:"StartTime"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - EndTime string `position:"Query" name:"EndTime"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBName string `position:"Query" name:"DBName"` - SQLHASH string `position:"Query" name:"SQLHASH"` -} - -// DescribeSlowLogRecordsResponse is the response struct for api DescribeSlowLogRecords -type DescribeSlowLogRecordsResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - Engine string `json:"Engine" xml:"Engine"` - TotalRecordCount int `json:"TotalRecordCount" xml:"TotalRecordCount"` - PageNumber int `json:"PageNumber" xml:"PageNumber"` - PageRecordCount int `json:"PageRecordCount" xml:"PageRecordCount"` - SQLHash string `json:"SQLHash" xml:"SQLHash"` - CPUTime int64 `json:"CPUTime" xml:"CPUTime"` - LogicalIORead int64 `json:"LogicalIORead" xml:"LogicalIORead"` - PhysicalIORead int64 `json:"PhysicalIORead" xml:"PhysicalIORead"` - WritesIOCount int64 `json:"WritesIOCount" xml:"WritesIOCount"` - RowsAffectedCount int64 `json:"RowsAffectedCount" xml:"RowsAffectedCount"` - LastRowsAffectedCount int64 `json:"LastRowsAffectedCount" xml:"LastRowsAffectedCount"` - UserName string `json:"UserName" xml:"UserName"` - Items ItemsInDescribeSlowLogRecords `json:"Items" xml:"Items"` -} - -// CreateDescribeSlowLogRecordsRequest creates a request to invoke DescribeSlowLogRecords API -func CreateDescribeSlowLogRecordsRequest() (request *DescribeSlowLogRecordsRequest) { - request = &DescribeSlowLogRecordsRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeSlowLogRecords", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeSlowLogRecordsResponse creates a response to parse from DescribeSlowLogRecords response -func CreateDescribeSlowLogRecordsResponse() (response *DescribeSlowLogRecordsResponse) { - response = &DescribeSlowLogRecordsResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_slow_logs.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_slow_logs.go deleted file mode 100644 index 7eab1591ab0..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_slow_logs.go +++ /dev/null @@ -1,117 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeSlowLogs invokes the rds.DescribeSlowLogs API synchronously -func (client *Client) DescribeSlowLogs(request *DescribeSlowLogsRequest) (response *DescribeSlowLogsResponse, err error) { - response = CreateDescribeSlowLogsResponse() - err = client.DoAction(request, response) - return -} - -// DescribeSlowLogsWithChan invokes the rds.DescribeSlowLogs API asynchronously -func (client *Client) DescribeSlowLogsWithChan(request *DescribeSlowLogsRequest) (<-chan *DescribeSlowLogsResponse, <-chan error) { - responseChan := make(chan *DescribeSlowLogsResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeSlowLogs(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeSlowLogsWithCallback invokes the rds.DescribeSlowLogs API asynchronously -func (client *Client) DescribeSlowLogsWithCallback(request *DescribeSlowLogsRequest, callback func(response *DescribeSlowLogsResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeSlowLogsResponse - var err error - defer close(result) - response, err = client.DescribeSlowLogs(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeSlowLogsRequest is the request struct for api DescribeSlowLogs -type DescribeSlowLogsRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - StartTime string `position:"Query" name:"StartTime"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - SortKey string `position:"Query" name:"SortKey"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - EndTime string `position:"Query" name:"EndTime"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBName string `position:"Query" name:"DBName"` -} - -// DescribeSlowLogsResponse is the response struct for api DescribeSlowLogs -type DescribeSlowLogsResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - Engine string `json:"Engine" xml:"Engine"` - StartTime string `json:"StartTime" xml:"StartTime"` - EndTime string `json:"EndTime" xml:"EndTime"` - TotalRecordCount int `json:"TotalRecordCount" xml:"TotalRecordCount"` - PageNumber int `json:"PageNumber" xml:"PageNumber"` - PageRecordCount int `json:"PageRecordCount" xml:"PageRecordCount"` - Items ItemsInDescribeSlowLogs `json:"Items" xml:"Items"` -} - -// CreateDescribeSlowLogsRequest creates a request to invoke DescribeSlowLogs API -func CreateDescribeSlowLogsRequest() (request *DescribeSlowLogsRequest) { - request = &DescribeSlowLogsRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeSlowLogs", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeSlowLogsResponse creates a response to parse from DescribeSlowLogs response -func CreateDescribeSlowLogsResponse() (response *DescribeSlowLogsResponse) { - response = &DescribeSlowLogsResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_sql_collector_policy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_sql_collector_policy.go deleted file mode 100644 index 4ea5c45fca2..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_sql_collector_policy.go +++ /dev/null @@ -1,107 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeSQLCollectorPolicy invokes the rds.DescribeSQLCollectorPolicy API synchronously -func (client *Client) DescribeSQLCollectorPolicy(request *DescribeSQLCollectorPolicyRequest) (response *DescribeSQLCollectorPolicyResponse, err error) { - response = CreateDescribeSQLCollectorPolicyResponse() - err = client.DoAction(request, response) - return -} - -// DescribeSQLCollectorPolicyWithChan invokes the rds.DescribeSQLCollectorPolicy API asynchronously -func (client *Client) DescribeSQLCollectorPolicyWithChan(request *DescribeSQLCollectorPolicyRequest) (<-chan *DescribeSQLCollectorPolicyResponse, <-chan error) { - responseChan := make(chan *DescribeSQLCollectorPolicyResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeSQLCollectorPolicy(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeSQLCollectorPolicyWithCallback invokes the rds.DescribeSQLCollectorPolicy API asynchronously -func (client *Client) DescribeSQLCollectorPolicyWithCallback(request *DescribeSQLCollectorPolicyRequest, callback func(response *DescribeSQLCollectorPolicyResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeSQLCollectorPolicyResponse - var err error - defer close(result) - response, err = client.DescribeSQLCollectorPolicy(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeSQLCollectorPolicyRequest is the request struct for api DescribeSQLCollectorPolicy -type DescribeSQLCollectorPolicyRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ClientToken string `position:"Query" name:"ClientToken"` - ResourceGroupId string `position:"Query" name:"ResourceGroupId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// DescribeSQLCollectorPolicyResponse is the response struct for api DescribeSQLCollectorPolicy -type DescribeSQLCollectorPolicyResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - SQLCollectorStatus string `json:"SQLCollectorStatus" xml:"SQLCollectorStatus"` - StoragePeriod int `json:"StoragePeriod" xml:"StoragePeriod"` -} - -// CreateDescribeSQLCollectorPolicyRequest creates a request to invoke DescribeSQLCollectorPolicy API -func CreateDescribeSQLCollectorPolicyRequest() (request *DescribeSQLCollectorPolicyRequest) { - request = &DescribeSQLCollectorPolicyRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeSQLCollectorPolicy", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeSQLCollectorPolicyResponse creates a response to parse from DescribeSQLCollectorPolicy response -func CreateDescribeSQLCollectorPolicyResponse() (response *DescribeSQLCollectorPolicyResponse) { - response = &DescribeSQLCollectorPolicyResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_sql_collector_retention.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_sql_collector_retention.go deleted file mode 100644 index 5b41461df4e..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_sql_collector_retention.go +++ /dev/null @@ -1,106 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeSQLCollectorRetention invokes the rds.DescribeSQLCollectorRetention API synchronously -func (client *Client) DescribeSQLCollectorRetention(request *DescribeSQLCollectorRetentionRequest) (response *DescribeSQLCollectorRetentionResponse, err error) { - response = CreateDescribeSQLCollectorRetentionResponse() - err = client.DoAction(request, response) - return -} - -// DescribeSQLCollectorRetentionWithChan invokes the rds.DescribeSQLCollectorRetention API asynchronously -func (client *Client) DescribeSQLCollectorRetentionWithChan(request *DescribeSQLCollectorRetentionRequest) (<-chan *DescribeSQLCollectorRetentionResponse, <-chan error) { - responseChan := make(chan *DescribeSQLCollectorRetentionResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeSQLCollectorRetention(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeSQLCollectorRetentionWithCallback invokes the rds.DescribeSQLCollectorRetention API asynchronously -func (client *Client) DescribeSQLCollectorRetentionWithCallback(request *DescribeSQLCollectorRetentionRequest, callback func(response *DescribeSQLCollectorRetentionResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeSQLCollectorRetentionResponse - var err error - defer close(result) - response, err = client.DescribeSQLCollectorRetention(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeSQLCollectorRetentionRequest is the request struct for api DescribeSQLCollectorRetention -type DescribeSQLCollectorRetentionRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceGroupId string `position:"Query" name:"ResourceGroupId"` - SecurityToken string `position:"Query" name:"SecurityToken"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// DescribeSQLCollectorRetentionResponse is the response struct for api DescribeSQLCollectorRetention -type DescribeSQLCollectorRetentionResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - ConfigValue string `json:"ConfigValue" xml:"ConfigValue"` -} - -// CreateDescribeSQLCollectorRetentionRequest creates a request to invoke DescribeSQLCollectorRetention API -func CreateDescribeSQLCollectorRetentionRequest() (request *DescribeSQLCollectorRetentionRequest) { - request = &DescribeSQLCollectorRetentionRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeSQLCollectorRetention", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeSQLCollectorRetentionResponse creates a response to parse from DescribeSQLCollectorRetention response -func CreateDescribeSQLCollectorRetentionResponse() (response *DescribeSQLCollectorRetentionResponse) { - response = &DescribeSQLCollectorRetentionResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_sql_log_files.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_sql_log_files.go deleted file mode 100644 index 6f946fd83ed..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_sql_log_files.go +++ /dev/null @@ -1,110 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeSQLLogFiles invokes the rds.DescribeSQLLogFiles API synchronously -func (client *Client) DescribeSQLLogFiles(request *DescribeSQLLogFilesRequest) (response *DescribeSQLLogFilesResponse, err error) { - response = CreateDescribeSQLLogFilesResponse() - err = client.DoAction(request, response) - return -} - -// DescribeSQLLogFilesWithChan invokes the rds.DescribeSQLLogFiles API asynchronously -func (client *Client) DescribeSQLLogFilesWithChan(request *DescribeSQLLogFilesRequest) (<-chan *DescribeSQLLogFilesResponse, <-chan error) { - responseChan := make(chan *DescribeSQLLogFilesResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeSQLLogFiles(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeSQLLogFilesWithCallback invokes the rds.DescribeSQLLogFiles API asynchronously -func (client *Client) DescribeSQLLogFilesWithCallback(request *DescribeSQLLogFilesRequest, callback func(response *DescribeSQLLogFilesResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeSQLLogFilesResponse - var err error - defer close(result) - response, err = client.DescribeSQLLogFiles(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeSQLLogFilesRequest is the request struct for api DescribeSQLLogFiles -type DescribeSQLLogFilesRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - FileName string `position:"Query" name:"FileName"` -} - -// DescribeSQLLogFilesResponse is the response struct for api DescribeSQLLogFiles -type DescribeSQLLogFilesResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - TotalRecordCount int `json:"TotalRecordCount" xml:"TotalRecordCount"` - PageNumber int `json:"PageNumber" xml:"PageNumber"` - PageRecordCount int `json:"PageRecordCount" xml:"PageRecordCount"` - Items ItemsInDescribeSQLLogFiles `json:"Items" xml:"Items"` -} - -// CreateDescribeSQLLogFilesRequest creates a request to invoke DescribeSQLLogFiles API -func CreateDescribeSQLLogFilesRequest() (request *DescribeSQLLogFilesRequest) { - request = &DescribeSQLLogFilesRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeSQLLogFiles", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeSQLLogFilesResponse creates a response to parse from DescribeSQLLogFiles response -func CreateDescribeSQLLogFilesResponse() (response *DescribeSQLLogFilesResponse) { - response = &DescribeSQLLogFilesResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_sql_log_records.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_sql_log_records.go deleted file mode 100644 index a508f5e98d9..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_sql_log_records.go +++ /dev/null @@ -1,117 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeSQLLogRecords invokes the rds.DescribeSQLLogRecords API synchronously -func (client *Client) DescribeSQLLogRecords(request *DescribeSQLLogRecordsRequest) (response *DescribeSQLLogRecordsResponse, err error) { - response = CreateDescribeSQLLogRecordsResponse() - err = client.DoAction(request, response) - return -} - -// DescribeSQLLogRecordsWithChan invokes the rds.DescribeSQLLogRecords API asynchronously -func (client *Client) DescribeSQLLogRecordsWithChan(request *DescribeSQLLogRecordsRequest) (<-chan *DescribeSQLLogRecordsResponse, <-chan error) { - responseChan := make(chan *DescribeSQLLogRecordsResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeSQLLogRecords(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeSQLLogRecordsWithCallback invokes the rds.DescribeSQLLogRecords API asynchronously -func (client *Client) DescribeSQLLogRecordsWithCallback(request *DescribeSQLLogRecordsRequest, callback func(response *DescribeSQLLogRecordsResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeSQLLogRecordsResponse - var err error - defer close(result) - response, err = client.DescribeSQLLogRecords(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeSQLLogRecordsRequest is the request struct for api DescribeSQLLogRecords -type DescribeSQLLogRecordsRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ClientToken string `position:"Query" name:"ClientToken"` - StartTime string `position:"Query" name:"StartTime"` - QueryKeywords string `position:"Query" name:"QueryKeywords"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - Database string `position:"Query" name:"Database"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - SQLId requests.Integer `position:"Query" name:"SQLId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - EndTime string `position:"Query" name:"EndTime"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - Form string `position:"Query" name:"Form"` - User string `position:"Query" name:"User"` -} - -// DescribeSQLLogRecordsResponse is the response struct for api DescribeSQLLogRecords -type DescribeSQLLogRecordsResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - TotalRecordCount int64 `json:"TotalRecordCount" xml:"TotalRecordCount"` - PageNumber int `json:"PageNumber" xml:"PageNumber"` - PageRecordCount int `json:"PageRecordCount" xml:"PageRecordCount"` - Items ItemsInDescribeSQLLogRecords `json:"Items" xml:"Items"` -} - -// CreateDescribeSQLLogRecordsRequest creates a request to invoke DescribeSQLLogRecords API -func CreateDescribeSQLLogRecordsRequest() (request *DescribeSQLLogRecordsRequest) { - request = &DescribeSQLLogRecordsRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeSQLLogRecords", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeSQLLogRecordsResponse creates a response to parse from DescribeSQLLogRecords response -func CreateDescribeSQLLogRecordsResponse() (response *DescribeSQLLogRecordsResponse) { - response = &DescribeSQLLogRecordsResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_sql_log_report_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_sql_log_report_list.go deleted file mode 100644 index eb95b65d6ae..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_sql_log_report_list.go +++ /dev/null @@ -1,111 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeSQLLogReportList invokes the rds.DescribeSQLLogReportList API synchronously -func (client *Client) DescribeSQLLogReportList(request *DescribeSQLLogReportListRequest) (response *DescribeSQLLogReportListResponse, err error) { - response = CreateDescribeSQLLogReportListResponse() - err = client.DoAction(request, response) - return -} - -// DescribeSQLLogReportListWithChan invokes the rds.DescribeSQLLogReportList API asynchronously -func (client *Client) DescribeSQLLogReportListWithChan(request *DescribeSQLLogReportListRequest) (<-chan *DescribeSQLLogReportListResponse, <-chan error) { - responseChan := make(chan *DescribeSQLLogReportListResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeSQLLogReportList(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeSQLLogReportListWithCallback invokes the rds.DescribeSQLLogReportList API asynchronously -func (client *Client) DescribeSQLLogReportListWithCallback(request *DescribeSQLLogReportListRequest, callback func(response *DescribeSQLLogReportListResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeSQLLogReportListResponse - var err error - defer close(result) - response, err = client.DescribeSQLLogReportList(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeSQLLogReportListRequest is the request struct for api DescribeSQLLogReportList -type DescribeSQLLogReportListRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - StartTime string `position:"Query" name:"StartTime"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - EndTime string `position:"Query" name:"EndTime"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// DescribeSQLLogReportListResponse is the response struct for api DescribeSQLLogReportList -type DescribeSQLLogReportListResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - TotalRecordCount int `json:"TotalRecordCount" xml:"TotalRecordCount"` - PageNumber int `json:"PageNumber" xml:"PageNumber"` - PageRecordCount int `json:"PageRecordCount" xml:"PageRecordCount"` - Items ItemsInDescribeSQLLogReportList `json:"Items" xml:"Items"` -} - -// CreateDescribeSQLLogReportListRequest creates a request to invoke DescribeSQLLogReportList API -func CreateDescribeSQLLogReportListRequest() (request *DescribeSQLLogReportListRequest) { - request = &DescribeSQLLogReportListRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeSQLLogReportList", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeSQLLogReportListResponse creates a response to parse from DescribeSQLLogReportList response -func CreateDescribeSQLLogReportListResponse() (response *DescribeSQLLogReportListResponse) { - response = &DescribeSQLLogReportListResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_sql_log_reports.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_sql_log_reports.go deleted file mode 100644 index 4ac0aa1ad03..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_sql_log_reports.go +++ /dev/null @@ -1,111 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeSQLLogReports invokes the rds.DescribeSQLLogReports API synchronously -func (client *Client) DescribeSQLLogReports(request *DescribeSQLLogReportsRequest) (response *DescribeSQLLogReportsResponse, err error) { - response = CreateDescribeSQLLogReportsResponse() - err = client.DoAction(request, response) - return -} - -// DescribeSQLLogReportsWithChan invokes the rds.DescribeSQLLogReports API asynchronously -func (client *Client) DescribeSQLLogReportsWithChan(request *DescribeSQLLogReportsRequest) (<-chan *DescribeSQLLogReportsResponse, <-chan error) { - responseChan := make(chan *DescribeSQLLogReportsResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeSQLLogReports(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeSQLLogReportsWithCallback invokes the rds.DescribeSQLLogReports API asynchronously -func (client *Client) DescribeSQLLogReportsWithCallback(request *DescribeSQLLogReportsRequest, callback func(response *DescribeSQLLogReportsResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeSQLLogReportsResponse - var err error - defer close(result) - response, err = client.DescribeSQLLogReports(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeSQLLogReportsRequest is the request struct for api DescribeSQLLogReports -type DescribeSQLLogReportsRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - StartTime string `position:"Query" name:"StartTime"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - EndTime string `position:"Query" name:"EndTime"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// DescribeSQLLogReportsResponse is the response struct for api DescribeSQLLogReports -type DescribeSQLLogReportsResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - TotalRecordCount int `json:"TotalRecordCount" xml:"TotalRecordCount"` - PageNumber int `json:"PageNumber" xml:"PageNumber"` - PageRecordCount int `json:"PageRecordCount" xml:"PageRecordCount"` - Items ItemsInDescribeSQLLogReports `json:"Items" xml:"Items"` -} - -// CreateDescribeSQLLogReportsRequest creates a request to invoke DescribeSQLLogReports API -func CreateDescribeSQLLogReportsRequest() (request *DescribeSQLLogReportsRequest) { - request = &DescribeSQLLogReportsRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeSQLLogReports", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeSQLLogReportsResponse creates a response to parse from DescribeSQLLogReports response -func CreateDescribeSQLLogReportsResponse() (response *DescribeSQLLogReportsResponse) { - response = &DescribeSQLLogReportsResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_tags.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_tags.go deleted file mode 100644 index 5755bd73545..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_tags.go +++ /dev/null @@ -1,107 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeTags invokes the rds.DescribeTags API synchronously -func (client *Client) DescribeTags(request *DescribeTagsRequest) (response *DescribeTagsResponse, err error) { - response = CreateDescribeTagsResponse() - err = client.DoAction(request, response) - return -} - -// DescribeTagsWithChan invokes the rds.DescribeTags API asynchronously -func (client *Client) DescribeTagsWithChan(request *DescribeTagsRequest) (<-chan *DescribeTagsResponse, <-chan error) { - responseChan := make(chan *DescribeTagsResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeTags(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeTagsWithCallback invokes the rds.DescribeTags API asynchronously -func (client *Client) DescribeTagsWithCallback(request *DescribeTagsRequest, callback func(response *DescribeTagsResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeTagsResponse - var err error - defer close(result) - response, err = client.DescribeTags(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeTagsRequest is the request struct for api DescribeTags -type DescribeTagsRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ClientToken string `position:"Query" name:"ClientToken"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ProxyId string `position:"Query" name:"proxyId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - Tags string `position:"Query" name:"Tags"` -} - -// DescribeTagsResponse is the response struct for api DescribeTags -type DescribeTagsResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Items ItemsInDescribeTags `json:"Items" xml:"Items"` -} - -// CreateDescribeTagsRequest creates a request to invoke DescribeTags API -func CreateDescribeTagsRequest() (request *DescribeTagsRequest) { - request = &DescribeTagsRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeTags", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeTagsResponse creates a response to parse from DescribeTags response -func CreateDescribeTagsResponse() (response *DescribeTagsResponse) { - response = &DescribeTagsResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_tasks.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_tasks.go deleted file mode 100644 index e01e37aa53e..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/describe_tasks.go +++ /dev/null @@ -1,113 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeTasks invokes the rds.DescribeTasks API synchronously -func (client *Client) DescribeTasks(request *DescribeTasksRequest) (response *DescribeTasksResponse, err error) { - response = CreateDescribeTasksResponse() - err = client.DoAction(request, response) - return -} - -// DescribeTasksWithChan invokes the rds.DescribeTasks API asynchronously -func (client *Client) DescribeTasksWithChan(request *DescribeTasksRequest) (<-chan *DescribeTasksResponse, <-chan error) { - responseChan := make(chan *DescribeTasksResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeTasks(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeTasksWithCallback invokes the rds.DescribeTasks API asynchronously -func (client *Client) DescribeTasksWithCallback(request *DescribeTasksRequest, callback func(response *DescribeTasksResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeTasksResponse - var err error - defer close(result) - response, err = client.DescribeTasks(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeTasksRequest is the request struct for api DescribeTasks -type DescribeTasksRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - StartTime string `position:"Query" name:"StartTime"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - EndTime string `position:"Query" name:"EndTime"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - TaskAction string `position:"Query" name:"TaskAction"` - Status string `position:"Query" name:"Status"` -} - -// DescribeTasksResponse is the response struct for api DescribeTasks -type DescribeTasksResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - TotalRecordCount int `json:"TotalRecordCount" xml:"TotalRecordCount"` - PageNumber int `json:"PageNumber" xml:"PageNumber"` - PageRecordCount int `json:"PageRecordCount" xml:"PageRecordCount"` - Items ItemsInDescribeTasks `json:"Items" xml:"Items"` -} - -// CreateDescribeTasksRequest creates a request to invoke DescribeTasks API -func CreateDescribeTasksRequest() (request *DescribeTasksRequest) { - request = &DescribeTasksRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DescribeTasks", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeTasksResponse creates a response to parse from DescribeTasks response -func CreateDescribeTasksResponse() (response *DescribeTasksResponse) { - response = &DescribeTasksResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/destroy_db_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/destroy_db_instance.go deleted file mode 100644 index 692b9569c84..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/destroy_db_instance.go +++ /dev/null @@ -1,104 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DestroyDBInstance invokes the rds.DestroyDBInstance API synchronously -func (client *Client) DestroyDBInstance(request *DestroyDBInstanceRequest) (response *DestroyDBInstanceResponse, err error) { - response = CreateDestroyDBInstanceResponse() - err = client.DoAction(request, response) - return -} - -// DestroyDBInstanceWithChan invokes the rds.DestroyDBInstance API asynchronously -func (client *Client) DestroyDBInstanceWithChan(request *DestroyDBInstanceRequest) (<-chan *DestroyDBInstanceResponse, <-chan error) { - responseChan := make(chan *DestroyDBInstanceResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DestroyDBInstance(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DestroyDBInstanceWithCallback invokes the rds.DestroyDBInstance API asynchronously -func (client *Client) DestroyDBInstanceWithCallback(request *DestroyDBInstanceRequest, callback func(response *DestroyDBInstanceResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DestroyDBInstanceResponse - var err error - defer close(result) - response, err = client.DestroyDBInstance(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DestroyDBInstanceRequest is the request struct for api DestroyDBInstance -type DestroyDBInstanceRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - ClientToken string `position:"Query" name:"ClientToken"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// DestroyDBInstanceResponse is the response struct for api DestroyDBInstance -type DestroyDBInstanceResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateDestroyDBInstanceRequest creates a request to invoke DestroyDBInstance API -func CreateDestroyDBInstanceRequest() (request *DestroyDBInstanceRequest) { - request = &DestroyDBInstanceRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "DestroyDBInstance", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateDestroyDBInstanceResponse creates a response to parse from DestroyDBInstance response -func CreateDestroyDBInstanceResponse() (response *DestroyDBInstanceResponse) { - response = &DestroyDBInstanceResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/endpoint.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/endpoint.go deleted file mode 100644 index 988e2752d82..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/endpoint.go +++ /dev/null @@ -1,66 +0,0 @@ -package rds - -// EndpointMap Endpoint Data -var EndpointMap map[string]string - -// EndpointType regional or central -var EndpointType = "regional" - -// GetEndpointMap Get Endpoint Data Map -func GetEndpointMap() map[string]string { - if EndpointMap == nil { - EndpointMap = map[string]string{ - "cn-shanghai-internal-test-1": "rds.aliyuncs.com", - "cn-beijing-gov-1": "rds.aliyuncs.com", - "cn-shenzhen-su18-b01": "rds.aliyuncs.com", - "cn-beijing": "rds.aliyuncs.com", - "cn-shanghai-inner": "rds.aliyuncs.com", - "cn-shenzhen-st4-d01": "rds.aliyuncs.com", - "cn-haidian-cm12-c01": "rds.aliyuncs.com", - "cn-hangzhou-internal-prod-1": "rds.aliyuncs.com", - "cn-north-2-gov-1": "rds.aliyuncs.com", - "cn-yushanfang": "rds.aliyuncs.com", - "cn-qingdao": "rds.aliyuncs.com", - "cn-hongkong-finance-pop": "rds.aliyuncs.com", - "cn-qingdao-nebula": "rds.aliyuncs.com", - "cn-shanghai": "rds.aliyuncs.com", - "cn-shanghai-finance-1": "rds.aliyuncs.com", - "cn-hongkong": "rds.aliyuncs.com", - "cn-heyuan": "rds.aliyuncs.com", - "cn-beijing-finance-pop": "rds.aliyuncs.com", - "cn-wuhan": "rds.aliyuncs.com", - "us-west-1": "rds.aliyuncs.com", - "cn-zhangbei": "rds.aliyuncs.com", - "cn-shenzhen": "rds.aliyuncs.com", - "cn-zhengzhou-nebula-1": "rds.aliyuncs.com", - "rus-west-1-pop": "rds.aliyuncs.com", - "cn-shanghai-et15-b01": "rds.aliyuncs.com", - "cn-hangzhou-bj-b01": "rds.aliyuncs.com", - "cn-hangzhou-internal-test-1": "rds.aliyuncs.com", - "eu-west-1-oxs": "rds.aliyuncs.com", - "cn-zhangbei-na61-b01": "rds.aliyuncs.com", - "cn-beijing-finance-1": "rds.aliyuncs.com", - "cn-hangzhou-internal-test-3": "rds.aliyuncs.com", - "cn-shenzhen-finance-1": "rds.aliyuncs.com", - "cn-hangzhou-internal-test-2": "rds.aliyuncs.com", - "cn-hangzhou-test-306": "rds.aliyuncs.com", - "cn-shanghai-et2-b01": "rds.aliyuncs.com", - "cn-hangzhou-finance": "rds.aliyuncs.com", - "ap-southeast-1": "rds.aliyuncs.com", - "cn-beijing-nu16-b01": "rds.aliyuncs.com", - "cn-edge-1": "rds.aliyuncs.com", - "us-east-1": "rds.aliyuncs.com", - "cn-fujian": "rds.aliyuncs.com", - "ap-northeast-2-pop": "rds.aliyuncs.com", - "cn-shenzhen-inner": "rds.aliyuncs.com", - "cn-zhangjiakou-na62-a01": "rds.aliyuncs.com", - "cn-hangzhou": "rds.aliyuncs.com", - } - } - return EndpointMap -} - -// GetEndpointType Get Endpoint Type Value -func GetEndpointType() string { - return EndpointType -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/get_db_proxy_instance_ssl.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/get_db_proxy_instance_ssl.go deleted file mode 100644 index 5ff402a3345..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/get_db_proxy_instance_ssl.go +++ /dev/null @@ -1,100 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// GetDbProxyInstanceSsl invokes the rds.GetDbProxyInstanceSsl API synchronously -func (client *Client) GetDbProxyInstanceSsl(request *GetDbProxyInstanceSslRequest) (response *GetDbProxyInstanceSslResponse, err error) { - response = CreateGetDbProxyInstanceSslResponse() - err = client.DoAction(request, response) - return -} - -// GetDbProxyInstanceSslWithChan invokes the rds.GetDbProxyInstanceSsl API asynchronously -func (client *Client) GetDbProxyInstanceSslWithChan(request *GetDbProxyInstanceSslRequest) (<-chan *GetDbProxyInstanceSslResponse, <-chan error) { - responseChan := make(chan *GetDbProxyInstanceSslResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.GetDbProxyInstanceSsl(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// GetDbProxyInstanceSslWithCallback invokes the rds.GetDbProxyInstanceSsl API asynchronously -func (client *Client) GetDbProxyInstanceSslWithCallback(request *GetDbProxyInstanceSslRequest, callback func(response *GetDbProxyInstanceSslResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *GetDbProxyInstanceSslResponse - var err error - defer close(result) - response, err = client.GetDbProxyInstanceSsl(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// GetDbProxyInstanceSslRequest is the request struct for api GetDbProxyInstanceSsl -type GetDbProxyInstanceSslRequest struct { - *requests.RpcRequest - DbInstanceId string `position:"Query" name:"DbInstanceId"` -} - -// GetDbProxyInstanceSslResponse is the response struct for api GetDbProxyInstanceSsl -type GetDbProxyInstanceSslResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DbProxyCertListItems DbProxyCertListItems `json:"DbProxyCertListItems" xml:"DbProxyCertListItems"` -} - -// CreateGetDbProxyInstanceSslRequest creates a request to invoke GetDbProxyInstanceSsl API -func CreateGetDbProxyInstanceSslRequest() (request *GetDbProxyInstanceSslRequest) { - request = &GetDbProxyInstanceSslRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "GetDbProxyInstanceSsl", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateGetDbProxyInstanceSslResponse creates a response to parse from GetDbProxyInstanceSsl response -func CreateGetDbProxyInstanceSslResponse() (response *GetDbProxyInstanceSslResponse) { - response = &GetDbProxyInstanceSslResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/grant_account_privilege.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/grant_account_privilege.go deleted file mode 100644 index 8bad120082a..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/grant_account_privilege.go +++ /dev/null @@ -1,106 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// GrantAccountPrivilege invokes the rds.GrantAccountPrivilege API synchronously -func (client *Client) GrantAccountPrivilege(request *GrantAccountPrivilegeRequest) (response *GrantAccountPrivilegeResponse, err error) { - response = CreateGrantAccountPrivilegeResponse() - err = client.DoAction(request, response) - return -} - -// GrantAccountPrivilegeWithChan invokes the rds.GrantAccountPrivilege API asynchronously -func (client *Client) GrantAccountPrivilegeWithChan(request *GrantAccountPrivilegeRequest) (<-chan *GrantAccountPrivilegeResponse, <-chan error) { - responseChan := make(chan *GrantAccountPrivilegeResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.GrantAccountPrivilege(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// GrantAccountPrivilegeWithCallback invokes the rds.GrantAccountPrivilege API asynchronously -func (client *Client) GrantAccountPrivilegeWithCallback(request *GrantAccountPrivilegeRequest, callback func(response *GrantAccountPrivilegeResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *GrantAccountPrivilegeResponse - var err error - defer close(result) - response, err = client.GrantAccountPrivilege(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// GrantAccountPrivilegeRequest is the request struct for api GrantAccountPrivilege -type GrantAccountPrivilegeRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - AccountPrivilege string `position:"Query" name:"AccountPrivilege"` - AccountName string `position:"Query" name:"AccountName"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBName string `position:"Query" name:"DBName"` -} - -// GrantAccountPrivilegeResponse is the response struct for api GrantAccountPrivilege -type GrantAccountPrivilegeResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateGrantAccountPrivilegeRequest creates a request to invoke GrantAccountPrivilege API -func CreateGrantAccountPrivilegeRequest() (request *GrantAccountPrivilegeRequest) { - request = &GrantAccountPrivilegeRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "GrantAccountPrivilege", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateGrantAccountPrivilegeResponse creates a response to parse from GrantAccountPrivilege response -func CreateGrantAccountPrivilegeResponse() (response *GrantAccountPrivilegeResponse) { - response = &GrantAccountPrivilegeResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/grant_operator_permission.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/grant_operator_permission.go deleted file mode 100644 index d5e64e2dd1a..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/grant_operator_permission.go +++ /dev/null @@ -1,105 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// GrantOperatorPermission invokes the rds.GrantOperatorPermission API synchronously -func (client *Client) GrantOperatorPermission(request *GrantOperatorPermissionRequest) (response *GrantOperatorPermissionResponse, err error) { - response = CreateGrantOperatorPermissionResponse() - err = client.DoAction(request, response) - return -} - -// GrantOperatorPermissionWithChan invokes the rds.GrantOperatorPermission API asynchronously -func (client *Client) GrantOperatorPermissionWithChan(request *GrantOperatorPermissionRequest) (<-chan *GrantOperatorPermissionResponse, <-chan error) { - responseChan := make(chan *GrantOperatorPermissionResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.GrantOperatorPermission(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// GrantOperatorPermissionWithCallback invokes the rds.GrantOperatorPermission API asynchronously -func (client *Client) GrantOperatorPermissionWithCallback(request *GrantOperatorPermissionRequest, callback func(response *GrantOperatorPermissionResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *GrantOperatorPermissionResponse - var err error - defer close(result) - response, err = client.GrantOperatorPermission(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// GrantOperatorPermissionRequest is the request struct for api GrantOperatorPermission -type GrantOperatorPermissionRequest struct { - *requests.RpcRequest - Privileges string `position:"Query" name:"Privileges"` - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - ExpiredTime string `position:"Query" name:"ExpiredTime"` -} - -// GrantOperatorPermissionResponse is the response struct for api GrantOperatorPermission -type GrantOperatorPermissionResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateGrantOperatorPermissionRequest creates a request to invoke GrantOperatorPermission API -func CreateGrantOperatorPermissionRequest() (request *GrantOperatorPermissionRequest) { - request = &GrantOperatorPermissionRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "GrantOperatorPermission", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateGrantOperatorPermissionResponse creates a response to parse from GrantOperatorPermission response -func CreateGrantOperatorPermissionResponse() (response *GrantOperatorPermissionResponse) { - response = &GrantOperatorPermissionResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/import_database_between_instances.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/import_database_between_instances.go deleted file mode 100644 index a1ecab4f65d..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/import_database_between_instances.go +++ /dev/null @@ -1,106 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ImportDatabaseBetweenInstances invokes the rds.ImportDatabaseBetweenInstances API synchronously -func (client *Client) ImportDatabaseBetweenInstances(request *ImportDatabaseBetweenInstancesRequest) (response *ImportDatabaseBetweenInstancesResponse, err error) { - response = CreateImportDatabaseBetweenInstancesResponse() - err = client.DoAction(request, response) - return -} - -// ImportDatabaseBetweenInstancesWithChan invokes the rds.ImportDatabaseBetweenInstances API asynchronously -func (client *Client) ImportDatabaseBetweenInstancesWithChan(request *ImportDatabaseBetweenInstancesRequest) (<-chan *ImportDatabaseBetweenInstancesResponse, <-chan error) { - responseChan := make(chan *ImportDatabaseBetweenInstancesResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ImportDatabaseBetweenInstances(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ImportDatabaseBetweenInstancesWithCallback invokes the rds.ImportDatabaseBetweenInstances API asynchronously -func (client *Client) ImportDatabaseBetweenInstancesWithCallback(request *ImportDatabaseBetweenInstancesRequest, callback func(response *ImportDatabaseBetweenInstancesResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ImportDatabaseBetweenInstancesResponse - var err error - defer close(result) - response, err = client.ImportDatabaseBetweenInstances(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ImportDatabaseBetweenInstancesRequest is the request struct for api ImportDatabaseBetweenInstances -type ImportDatabaseBetweenInstancesRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - DBInfo string `position:"Query" name:"DBInfo"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - SourceDBInstanceId string `position:"Query" name:"SourceDBInstanceId"` -} - -// ImportDatabaseBetweenInstancesResponse is the response struct for api ImportDatabaseBetweenInstances -type ImportDatabaseBetweenInstancesResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - ImportId string `json:"ImportId" xml:"ImportId"` -} - -// CreateImportDatabaseBetweenInstancesRequest creates a request to invoke ImportDatabaseBetweenInstances API -func CreateImportDatabaseBetweenInstancesRequest() (request *ImportDatabaseBetweenInstancesRequest) { - request = &ImportDatabaseBetweenInstancesRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ImportDatabaseBetweenInstances", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateImportDatabaseBetweenInstancesResponse creates a response to parse from ImportDatabaseBetweenInstances response -func CreateImportDatabaseBetweenInstancesResponse() (response *ImportDatabaseBetweenInstancesResponse) { - response = &ImportDatabaseBetweenInstancesResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/list_tag_resources.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/list_tag_resources.go deleted file mode 100644 index 2397698180a..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/list_tag_resources.go +++ /dev/null @@ -1,113 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ListTagResources invokes the rds.ListTagResources API synchronously -func (client *Client) ListTagResources(request *ListTagResourcesRequest) (response *ListTagResourcesResponse, err error) { - response = CreateListTagResourcesResponse() - err = client.DoAction(request, response) - return -} - -// ListTagResourcesWithChan invokes the rds.ListTagResources API asynchronously -func (client *Client) ListTagResourcesWithChan(request *ListTagResourcesRequest) (<-chan *ListTagResourcesResponse, <-chan error) { - responseChan := make(chan *ListTagResourcesResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ListTagResources(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ListTagResourcesWithCallback invokes the rds.ListTagResources API asynchronously -func (client *Client) ListTagResourcesWithCallback(request *ListTagResourcesRequest, callback func(response *ListTagResourcesResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ListTagResourcesResponse - var err error - defer close(result) - response, err = client.ListTagResources(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ListTagResourcesRequest is the request struct for api ListTagResources -type ListTagResourcesRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceId *[]string `position:"Query" name:"ResourceId" type:"Repeated"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - ResourceType string `position:"Query" name:"ResourceType"` - NextToken string `position:"Query" name:"NextToken"` - Tag *[]ListTagResourcesTag `position:"Query" name:"Tag" type:"Repeated"` -} - -// ListTagResourcesTag is a repeated param struct in ListTagResourcesRequest -type ListTagResourcesTag struct { - Value string `name:"Value"` - Key string `name:"Key"` -} - -// ListTagResourcesResponse is the response struct for api ListTagResources -type ListTagResourcesResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - NextToken string `json:"NextToken" xml:"NextToken"` - TagResources TagResources `json:"TagResources" xml:"TagResources"` -} - -// CreateListTagResourcesRequest creates a request to invoke ListTagResources API -func CreateListTagResourcesRequest() (request *ListTagResourcesRequest) { - request = &ListTagResourcesRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ListTagResources", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateListTagResourcesResponse creates a response to parse from ListTagResources response -func CreateListTagResourcesResponse() (response *ListTagResourcesResponse) { - response = &ListTagResourcesResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/lock_account.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/lock_account.go deleted file mode 100644 index e8033b57aaa..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/lock_account.go +++ /dev/null @@ -1,103 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// LockAccount invokes the rds.LockAccount API synchronously -func (client *Client) LockAccount(request *LockAccountRequest) (response *LockAccountResponse, err error) { - response = CreateLockAccountResponse() - err = client.DoAction(request, response) - return -} - -// LockAccountWithChan invokes the rds.LockAccount API asynchronously -func (client *Client) LockAccountWithChan(request *LockAccountRequest) (<-chan *LockAccountResponse, <-chan error) { - responseChan := make(chan *LockAccountResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.LockAccount(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// LockAccountWithCallback invokes the rds.LockAccount API asynchronously -func (client *Client) LockAccountWithCallback(request *LockAccountRequest, callback func(response *LockAccountResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *LockAccountResponse - var err error - defer close(result) - response, err = client.LockAccount(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// LockAccountRequest is the request struct for api LockAccount -type LockAccountRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - AccountName string `position:"Query" name:"AccountName"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// LockAccountResponse is the response struct for api LockAccount -type LockAccountResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateLockAccountRequest creates a request to invoke LockAccount API -func CreateLockAccountRequest() (request *LockAccountRequest) { - request = &LockAccountRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "LockAccount", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateLockAccountResponse creates a response to parse from LockAccount response -func CreateLockAccountResponse() (response *LockAccountResponse) { - response = &LockAccountResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/migrate_db_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/migrate_db_instance.go deleted file mode 100644 index d3d81bd3741..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/migrate_db_instance.go +++ /dev/null @@ -1,120 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// MigrateDBInstance invokes the rds.MigrateDBInstance API synchronously -func (client *Client) MigrateDBInstance(request *MigrateDBInstanceRequest) (response *MigrateDBInstanceResponse, err error) { - response = CreateMigrateDBInstanceResponse() - err = client.DoAction(request, response) - return -} - -// MigrateDBInstanceWithChan invokes the rds.MigrateDBInstance API asynchronously -func (client *Client) MigrateDBInstanceWithChan(request *MigrateDBInstanceRequest) (<-chan *MigrateDBInstanceResponse, <-chan error) { - responseChan := make(chan *MigrateDBInstanceResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.MigrateDBInstance(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// MigrateDBInstanceWithCallback invokes the rds.MigrateDBInstance API asynchronously -func (client *Client) MigrateDBInstanceWithCallback(request *MigrateDBInstanceRequest, callback func(response *MigrateDBInstanceResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *MigrateDBInstanceResponse - var err error - defer close(result) - response, err = client.MigrateDBInstance(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// MigrateDBInstanceRequest is the request struct for api MigrateDBInstance -type MigrateDBInstanceRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - SpecifiedTime string `position:"Query" name:"SpecifiedTime"` - TargetDedicatedHostIdForSlave string `position:"Query" name:"TargetDedicatedHostIdForSlave"` - ZoneIdSlave1 string `position:"Query" name:"ZoneIdSlave1"` - ZoneIdSlave2 string `position:"Query" name:"ZoneIdSlave2"` - EngineVersion string `position:"Query" name:"EngineVersion"` - Storage requests.Integer `position:"Query" name:"Storage"` - ZoneIdForFollower string `position:"Query" name:"ZoneIdForFollower"` - EffectiveTime string `position:"Query" name:"EffectiveTime"` - DBInstanceTransType requests.Integer `position:"Query" name:"DBInstanceTransType"` - TargetDedicatedHostIdForMaster string `position:"Query" name:"TargetDedicatedHostIdForMaster"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - DedicatedHostGroupId string `position:"Query" name:"DedicatedHostGroupId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - ZoneIdForLog string `position:"Query" name:"ZoneIdForLog"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - TargetDBInstanceClass string `position:"Query" name:"TargetDBInstanceClass"` - VSwitchId string `position:"Query" name:"VSwitchId"` - TargetDedicatedHostIdForLog string `position:"Query" name:"TargetDedicatedHostIdForLog"` - ZoneId string `position:"Query" name:"ZoneId"` -} - -// MigrateDBInstanceResponse is the response struct for api MigrateDBInstance -type MigrateDBInstanceResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - TaskId int `json:"TaskId" xml:"TaskId"` - MigrationId int `json:"MigrationId" xml:"MigrationId"` -} - -// CreateMigrateDBInstanceRequest creates a request to invoke MigrateDBInstance API -func CreateMigrateDBInstanceRequest() (request *MigrateDBInstanceRequest) { - request = &MigrateDBInstanceRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "MigrateDBInstance", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateMigrateDBInstanceResponse creates a response to parse from MigrateDBInstance response -func CreateMigrateDBInstanceResponse() (response *MigrateDBInstanceResponse) { - response = &MigrateDBInstanceResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/migrate_security_ip_mode.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/migrate_security_ip_mode.go deleted file mode 100644 index 5d5774c20f8..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/migrate_security_ip_mode.go +++ /dev/null @@ -1,104 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// MigrateSecurityIPMode invokes the rds.MigrateSecurityIPMode API synchronously -func (client *Client) MigrateSecurityIPMode(request *MigrateSecurityIPModeRequest) (response *MigrateSecurityIPModeResponse, err error) { - response = CreateMigrateSecurityIPModeResponse() - err = client.DoAction(request, response) - return -} - -// MigrateSecurityIPModeWithChan invokes the rds.MigrateSecurityIPMode API asynchronously -func (client *Client) MigrateSecurityIPModeWithChan(request *MigrateSecurityIPModeRequest) (<-chan *MigrateSecurityIPModeResponse, <-chan error) { - responseChan := make(chan *MigrateSecurityIPModeResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.MigrateSecurityIPMode(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// MigrateSecurityIPModeWithCallback invokes the rds.MigrateSecurityIPMode API asynchronously -func (client *Client) MigrateSecurityIPModeWithCallback(request *MigrateSecurityIPModeRequest, callback func(response *MigrateSecurityIPModeResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *MigrateSecurityIPModeResponse - var err error - defer close(result) - response, err = client.MigrateSecurityIPMode(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// MigrateSecurityIPModeRequest is the request struct for api MigrateSecurityIPMode -type MigrateSecurityIPModeRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// MigrateSecurityIPModeResponse is the response struct for api MigrateSecurityIPMode -type MigrateSecurityIPModeResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - SecurityIPMode string `json:"SecurityIPMode" xml:"SecurityIPMode"` -} - -// CreateMigrateSecurityIPModeRequest creates a request to invoke MigrateSecurityIPMode API -func CreateMigrateSecurityIPModeRequest() (request *MigrateSecurityIPModeRequest) { - request = &MigrateSecurityIPModeRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "MigrateSecurityIPMode", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateMigrateSecurityIPModeResponse creates a response to parse from MigrateSecurityIPMode response -func CreateMigrateSecurityIPModeResponse() (response *MigrateSecurityIPModeResponse) { - response = &MigrateSecurityIPModeResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/migrate_to_other_zone.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/migrate_to_other_zone.go deleted file mode 100644 index c2ec6c1403a..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/migrate_to_other_zone.go +++ /dev/null @@ -1,110 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// MigrateToOtherZone invokes the rds.MigrateToOtherZone API synchronously -func (client *Client) MigrateToOtherZone(request *MigrateToOtherZoneRequest) (response *MigrateToOtherZoneResponse, err error) { - response = CreateMigrateToOtherZoneResponse() - err = client.DoAction(request, response) - return -} - -// MigrateToOtherZoneWithChan invokes the rds.MigrateToOtherZone API asynchronously -func (client *Client) MigrateToOtherZoneWithChan(request *MigrateToOtherZoneRequest) (<-chan *MigrateToOtherZoneResponse, <-chan error) { - responseChan := make(chan *MigrateToOtherZoneResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.MigrateToOtherZone(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// MigrateToOtherZoneWithCallback invokes the rds.MigrateToOtherZone API asynchronously -func (client *Client) MigrateToOtherZoneWithCallback(request *MigrateToOtherZoneRequest, callback func(response *MigrateToOtherZoneResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *MigrateToOtherZoneResponse - var err error - defer close(result) - response, err = client.MigrateToOtherZone(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// MigrateToOtherZoneRequest is the request struct for api MigrateToOtherZone -type MigrateToOtherZoneRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ZoneIdSlave1 string `position:"Query" name:"ZoneIdSlave1"` - ZoneIdSlave2 string `position:"Query" name:"ZoneIdSlave2"` - EffectiveTime string `position:"Query" name:"EffectiveTime"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - VSwitchId string `position:"Query" name:"VSwitchId"` - VPCId string `position:"Query" name:"VPCId"` - ZoneId string `position:"Query" name:"ZoneId"` - Category string `position:"Query" name:"Category"` -} - -// MigrateToOtherZoneResponse is the response struct for api MigrateToOtherZone -type MigrateToOtherZoneResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateMigrateToOtherZoneRequest creates a request to invoke MigrateToOtherZone API -func CreateMigrateToOtherZoneRequest() (request *MigrateToOtherZoneRequest) { - request = &MigrateToOtherZoneRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "MigrateToOtherZone", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateMigrateToOtherZoneResponse creates a response to parse from MigrateToOtherZone response -func CreateMigrateToOtherZoneResponse() (response *MigrateToOtherZoneResponse) { - response = &MigrateToOtherZoneResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_account_description.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_account_description.go deleted file mode 100644 index 608994f7188..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_account_description.go +++ /dev/null @@ -1,105 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyAccountDescription invokes the rds.ModifyAccountDescription API synchronously -func (client *Client) ModifyAccountDescription(request *ModifyAccountDescriptionRequest) (response *ModifyAccountDescriptionResponse, err error) { - response = CreateModifyAccountDescriptionResponse() - err = client.DoAction(request, response) - return -} - -// ModifyAccountDescriptionWithChan invokes the rds.ModifyAccountDescription API asynchronously -func (client *Client) ModifyAccountDescriptionWithChan(request *ModifyAccountDescriptionRequest) (<-chan *ModifyAccountDescriptionResponse, <-chan error) { - responseChan := make(chan *ModifyAccountDescriptionResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyAccountDescription(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyAccountDescriptionWithCallback invokes the rds.ModifyAccountDescription API asynchronously -func (client *Client) ModifyAccountDescriptionWithCallback(request *ModifyAccountDescriptionRequest, callback func(response *ModifyAccountDescriptionResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyAccountDescriptionResponse - var err error - defer close(result) - response, err = client.ModifyAccountDescription(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyAccountDescriptionRequest is the request struct for api ModifyAccountDescription -type ModifyAccountDescriptionRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - AccountDescription string `position:"Query" name:"AccountDescription"` - AccountName string `position:"Query" name:"AccountName"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// ModifyAccountDescriptionResponse is the response struct for api ModifyAccountDescription -type ModifyAccountDescriptionResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateModifyAccountDescriptionRequest creates a request to invoke ModifyAccountDescription API -func CreateModifyAccountDescriptionRequest() (request *ModifyAccountDescriptionRequest) { - request = &ModifyAccountDescriptionRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyAccountDescription", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyAccountDescriptionResponse creates a response to parse from ModifyAccountDescription response -func CreateModifyAccountDescriptionResponse() (response *ModifyAccountDescriptionResponse) { - response = &ModifyAccountDescriptionResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_action_event_policy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_action_event_policy.go deleted file mode 100644 index 17ba0f21ff3..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_action_event_policy.go +++ /dev/null @@ -1,104 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyActionEventPolicy invokes the rds.ModifyActionEventPolicy API synchronously -func (client *Client) ModifyActionEventPolicy(request *ModifyActionEventPolicyRequest) (response *ModifyActionEventPolicyResponse, err error) { - response = CreateModifyActionEventPolicyResponse() - err = client.DoAction(request, response) - return -} - -// ModifyActionEventPolicyWithChan invokes the rds.ModifyActionEventPolicy API asynchronously -func (client *Client) ModifyActionEventPolicyWithChan(request *ModifyActionEventPolicyRequest) (<-chan *ModifyActionEventPolicyResponse, <-chan error) { - responseChan := make(chan *ModifyActionEventPolicyResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyActionEventPolicy(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyActionEventPolicyWithCallback invokes the rds.ModifyActionEventPolicy API asynchronously -func (client *Client) ModifyActionEventPolicyWithCallback(request *ModifyActionEventPolicyRequest, callback func(response *ModifyActionEventPolicyResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyActionEventPolicyResponse - var err error - defer close(result) - response, err = client.ModifyActionEventPolicy(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyActionEventPolicyRequest is the request struct for api ModifyActionEventPolicy -type ModifyActionEventPolicyRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - EnableEventLog string `position:"Query" name:"EnableEventLog"` -} - -// ModifyActionEventPolicyResponse is the response struct for api ModifyActionEventPolicy -type ModifyActionEventPolicyResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - RegionId string `json:"RegionId" xml:"RegionId"` - EnableEventLog string `json:"EnableEventLog" xml:"EnableEventLog"` -} - -// CreateModifyActionEventPolicyRequest creates a request to invoke ModifyActionEventPolicy API -func CreateModifyActionEventPolicyRequest() (request *ModifyActionEventPolicyRequest) { - request = &ModifyActionEventPolicyRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyActionEventPolicy", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyActionEventPolicyResponse creates a response to parse from ModifyActionEventPolicy response -func CreateModifyActionEventPolicyResponse() (response *ModifyActionEventPolicyResponse) { - response = &ModifyActionEventPolicyResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_backup_policy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_backup_policy.go deleted file mode 100644 index e1412e38485..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_backup_policy.go +++ /dev/null @@ -1,133 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyBackupPolicy invokes the rds.ModifyBackupPolicy API synchronously -func (client *Client) ModifyBackupPolicy(request *ModifyBackupPolicyRequest) (response *ModifyBackupPolicyResponse, err error) { - response = CreateModifyBackupPolicyResponse() - err = client.DoAction(request, response) - return -} - -// ModifyBackupPolicyWithChan invokes the rds.ModifyBackupPolicy API asynchronously -func (client *Client) ModifyBackupPolicyWithChan(request *ModifyBackupPolicyRequest) (<-chan *ModifyBackupPolicyResponse, <-chan error) { - responseChan := make(chan *ModifyBackupPolicyResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyBackupPolicy(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyBackupPolicyWithCallback invokes the rds.ModifyBackupPolicy API asynchronously -func (client *Client) ModifyBackupPolicyWithCallback(request *ModifyBackupPolicyRequest, callback func(response *ModifyBackupPolicyResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyBackupPolicyResponse - var err error - defer close(result) - response, err = client.ModifyBackupPolicy(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyBackupPolicyRequest is the request struct for api ModifyBackupPolicy -type ModifyBackupPolicyRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - LocalLogRetentionHours string `position:"Query" name:"LocalLogRetentionHours"` - LogBackupFrequency string `position:"Query" name:"LogBackupFrequency"` - ArchiveBackupKeepCount requests.Integer `position:"Query" name:"ArchiveBackupKeepCount"` - BackupLog string `position:"Query" name:"BackupLog"` - BackupInterval string `position:"Query" name:"BackupInterval"` - DuplicationContent string `position:"Query" name:"DuplicationContent"` - HighSpaceUsageProtection string `position:"Query" name:"HighSpaceUsageProtection"` - LogBackupLocalRetentionNumber requests.Integer `position:"Query" name:"LogBackupLocalRetentionNumber"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - EnableBackupLog string `position:"Query" name:"EnableBackupLog"` - BackupPolicyMode string `position:"Query" name:"BackupPolicyMode"` - PreferredBackupPeriod string `position:"Query" name:"PreferredBackupPeriod"` - ReleasedKeepPolicy string `position:"Query" name:"ReleasedKeepPolicy"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - CompressType string `position:"Query" name:"CompressType"` - LocalLogRetentionSpace string `position:"Query" name:"LocalLogRetentionSpace"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - ArchiveBackupKeepPolicy string `position:"Query" name:"ArchiveBackupKeepPolicy"` - Duplication string `position:"Query" name:"Duplication"` - PreferredBackupTime string `position:"Query" name:"PreferredBackupTime"` - BackupRetentionPeriod string `position:"Query" name:"BackupRetentionPeriod"` - BackupMethod string `position:"Query" name:"BackupMethod"` - DuplicationLocation string `position:"Query" name:"DuplicationLocation"` - ArchiveBackupRetentionPeriod string `position:"Query" name:"ArchiveBackupRetentionPeriod"` - Category string `position:"Query" name:"Category"` - LogBackupRetentionPeriod string `position:"Query" name:"LogBackupRetentionPeriod"` -} - -// ModifyBackupPolicyResponse is the response struct for api ModifyBackupPolicy -type ModifyBackupPolicyResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceID string `json:"DBInstanceID" xml:"DBInstanceID"` - EnableBackupLog string `json:"EnableBackupLog" xml:"EnableBackupLog"` - LocalLogRetentionHours int `json:"LocalLogRetentionHours" xml:"LocalLogRetentionHours"` - LocalLogRetentionSpace string `json:"LocalLogRetentionSpace" xml:"LocalLogRetentionSpace"` - HighSpaceUsageProtection string `json:"HighSpaceUsageProtection" xml:"HighSpaceUsageProtection"` - CompressType string `json:"CompressType" xml:"CompressType"` - LogBackupLocalRetentionNumber int `json:"LogBackupLocalRetentionNumber" xml:"LogBackupLocalRetentionNumber"` -} - -// CreateModifyBackupPolicyRequest creates a request to invoke ModifyBackupPolicy API -func CreateModifyBackupPolicyRequest() (request *ModifyBackupPolicyRequest) { - request = &ModifyBackupPolicyRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyBackupPolicy", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyBackupPolicyResponse creates a response to parse from ModifyBackupPolicy response -func CreateModifyBackupPolicyResponse() (response *ModifyBackupPolicyResponse) { - response = &ModifyBackupPolicyResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_collation_time_zone.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_collation_time_zone.go deleted file mode 100644 index 2aad267c8f1..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_collation_time_zone.go +++ /dev/null @@ -1,108 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyCollationTimeZone invokes the rds.ModifyCollationTimeZone API synchronously -func (client *Client) ModifyCollationTimeZone(request *ModifyCollationTimeZoneRequest) (response *ModifyCollationTimeZoneResponse, err error) { - response = CreateModifyCollationTimeZoneResponse() - err = client.DoAction(request, response) - return -} - -// ModifyCollationTimeZoneWithChan invokes the rds.ModifyCollationTimeZone API asynchronously -func (client *Client) ModifyCollationTimeZoneWithChan(request *ModifyCollationTimeZoneRequest) (<-chan *ModifyCollationTimeZoneResponse, <-chan error) { - responseChan := make(chan *ModifyCollationTimeZoneResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyCollationTimeZone(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyCollationTimeZoneWithCallback invokes the rds.ModifyCollationTimeZone API asynchronously -func (client *Client) ModifyCollationTimeZoneWithCallback(request *ModifyCollationTimeZoneRequest, callback func(response *ModifyCollationTimeZoneResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyCollationTimeZoneResponse - var err error - defer close(result) - response, err = client.ModifyCollationTimeZone(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyCollationTimeZoneRequest is the request struct for api ModifyCollationTimeZone -type ModifyCollationTimeZoneRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - Timezone string `position:"Query" name:"Timezone"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - Collation string `position:"Query" name:"Collation"` -} - -// ModifyCollationTimeZoneResponse is the response struct for api ModifyCollationTimeZone -type ModifyCollationTimeZoneResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - TaskId string `json:"TaskId" xml:"TaskId"` - Timezone string `json:"Timezone" xml:"Timezone"` - Collation string `json:"Collation" xml:"Collation"` -} - -// CreateModifyCollationTimeZoneRequest creates a request to invoke ModifyCollationTimeZone API -func CreateModifyCollationTimeZoneRequest() (request *ModifyCollationTimeZoneRequest) { - request = &ModifyCollationTimeZoneRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyCollationTimeZone", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyCollationTimeZoneResponse creates a response to parse from ModifyCollationTimeZone response -func CreateModifyCollationTimeZoneResponse() (response *ModifyCollationTimeZoneResponse) { - response = &ModifyCollationTimeZoneResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_das_instance_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_das_instance_config.go deleted file mode 100644 index 04f50e221da..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_das_instance_config.go +++ /dev/null @@ -1,106 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyDasInstanceConfig invokes the rds.ModifyDasInstanceConfig API synchronously -func (client *Client) ModifyDasInstanceConfig(request *ModifyDasInstanceConfigRequest) (response *ModifyDasInstanceConfigResponse, err error) { - response = CreateModifyDasInstanceConfigResponse() - err = client.DoAction(request, response) - return -} - -// ModifyDasInstanceConfigWithChan invokes the rds.ModifyDasInstanceConfig API asynchronously -func (client *Client) ModifyDasInstanceConfigWithChan(request *ModifyDasInstanceConfigRequest) (<-chan *ModifyDasInstanceConfigResponse, <-chan error) { - responseChan := make(chan *ModifyDasInstanceConfigResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyDasInstanceConfig(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyDasInstanceConfigWithCallback invokes the rds.ModifyDasInstanceConfig API asynchronously -func (client *Client) ModifyDasInstanceConfigWithCallback(request *ModifyDasInstanceConfigRequest, callback func(response *ModifyDasInstanceConfigResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyDasInstanceConfigResponse - var err error - defer close(result) - response, err = client.ModifyDasInstanceConfig(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyDasInstanceConfigRequest is the request struct for api ModifyDasInstanceConfig -type ModifyDasInstanceConfigRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ClientToken string `position:"Query" name:"ClientToken"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - StorageUpperBound requests.Integer `position:"Query" name:"StorageUpperBound"` - StorageThreshold requests.Integer `position:"Query" name:"StorageThreshold"` - StorageAutoScale string `position:"Query" name:"StorageAutoScale"` -} - -// ModifyDasInstanceConfigResponse is the response struct for api ModifyDasInstanceConfig -type ModifyDasInstanceConfigResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateModifyDasInstanceConfigRequest creates a request to invoke ModifyDasInstanceConfig API -func CreateModifyDasInstanceConfigRequest() (request *ModifyDasInstanceConfigRequest) { - request = &ModifyDasInstanceConfigRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyDasInstanceConfig", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyDasInstanceConfigResponse creates a response to parse from ModifyDasInstanceConfig response -func CreateModifyDasInstanceConfigResponse() (response *ModifyDasInstanceConfigResponse) { - response = &ModifyDasInstanceConfigResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_description.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_description.go deleted file mode 100644 index 5db2c2d25c1..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_description.go +++ /dev/null @@ -1,105 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyDBDescription invokes the rds.ModifyDBDescription API synchronously -func (client *Client) ModifyDBDescription(request *ModifyDBDescriptionRequest) (response *ModifyDBDescriptionResponse, err error) { - response = CreateModifyDBDescriptionResponse() - err = client.DoAction(request, response) - return -} - -// ModifyDBDescriptionWithChan invokes the rds.ModifyDBDescription API asynchronously -func (client *Client) ModifyDBDescriptionWithChan(request *ModifyDBDescriptionRequest) (<-chan *ModifyDBDescriptionResponse, <-chan error) { - responseChan := make(chan *ModifyDBDescriptionResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyDBDescription(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyDBDescriptionWithCallback invokes the rds.ModifyDBDescription API asynchronously -func (client *Client) ModifyDBDescriptionWithCallback(request *ModifyDBDescriptionRequest, callback func(response *ModifyDBDescriptionResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyDBDescriptionResponse - var err error - defer close(result) - response, err = client.ModifyDBDescription(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyDBDescriptionRequest is the request struct for api ModifyDBDescription -type ModifyDBDescriptionRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - DBDescription string `position:"Query" name:"DBDescription"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBName string `position:"Query" name:"DBName"` -} - -// ModifyDBDescriptionResponse is the response struct for api ModifyDBDescription -type ModifyDBDescriptionResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateModifyDBDescriptionRequest creates a request to invoke ModifyDBDescription API -func CreateModifyDBDescriptionRequest() (request *ModifyDBDescriptionRequest) { - request = &ModifyDBDescriptionRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyDBDescription", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyDBDescriptionResponse creates a response to parse from ModifyDBDescription response -func CreateModifyDBDescriptionResponse() (response *ModifyDBDescriptionResponse) { - response = &ModifyDBDescriptionResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_auto_upgrade_minor_version.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_auto_upgrade_minor_version.go deleted file mode 100644 index becee749c51..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_auto_upgrade_minor_version.go +++ /dev/null @@ -1,104 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyDBInstanceAutoUpgradeMinorVersion invokes the rds.ModifyDBInstanceAutoUpgradeMinorVersion API synchronously -func (client *Client) ModifyDBInstanceAutoUpgradeMinorVersion(request *ModifyDBInstanceAutoUpgradeMinorVersionRequest) (response *ModifyDBInstanceAutoUpgradeMinorVersionResponse, err error) { - response = CreateModifyDBInstanceAutoUpgradeMinorVersionResponse() - err = client.DoAction(request, response) - return -} - -// ModifyDBInstanceAutoUpgradeMinorVersionWithChan invokes the rds.ModifyDBInstanceAutoUpgradeMinorVersion API asynchronously -func (client *Client) ModifyDBInstanceAutoUpgradeMinorVersionWithChan(request *ModifyDBInstanceAutoUpgradeMinorVersionRequest) (<-chan *ModifyDBInstanceAutoUpgradeMinorVersionResponse, <-chan error) { - responseChan := make(chan *ModifyDBInstanceAutoUpgradeMinorVersionResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyDBInstanceAutoUpgradeMinorVersion(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyDBInstanceAutoUpgradeMinorVersionWithCallback invokes the rds.ModifyDBInstanceAutoUpgradeMinorVersion API asynchronously -func (client *Client) ModifyDBInstanceAutoUpgradeMinorVersionWithCallback(request *ModifyDBInstanceAutoUpgradeMinorVersionRequest, callback func(response *ModifyDBInstanceAutoUpgradeMinorVersionResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyDBInstanceAutoUpgradeMinorVersionResponse - var err error - defer close(result) - response, err = client.ModifyDBInstanceAutoUpgradeMinorVersion(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyDBInstanceAutoUpgradeMinorVersionRequest is the request struct for api ModifyDBInstanceAutoUpgradeMinorVersion -type ModifyDBInstanceAutoUpgradeMinorVersionRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - ClientToken string `position:"Query" name:"ClientToken"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - AutoUpgradeMinorVersion string `position:"Query" name:"AutoUpgradeMinorVersion"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// ModifyDBInstanceAutoUpgradeMinorVersionResponse is the response struct for api ModifyDBInstanceAutoUpgradeMinorVersion -type ModifyDBInstanceAutoUpgradeMinorVersionResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateModifyDBInstanceAutoUpgradeMinorVersionRequest creates a request to invoke ModifyDBInstanceAutoUpgradeMinorVersion API -func CreateModifyDBInstanceAutoUpgradeMinorVersionRequest() (request *ModifyDBInstanceAutoUpgradeMinorVersionRequest) { - request = &ModifyDBInstanceAutoUpgradeMinorVersionRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyDBInstanceAutoUpgradeMinorVersion", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyDBInstanceAutoUpgradeMinorVersionResponse creates a response to parse from ModifyDBInstanceAutoUpgradeMinorVersion response -func CreateModifyDBInstanceAutoUpgradeMinorVersionResponse() (response *ModifyDBInstanceAutoUpgradeMinorVersionResponse) { - response = &ModifyDBInstanceAutoUpgradeMinorVersionResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_connection_mode.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_connection_mode.go deleted file mode 100644 index d4c2dd70f71..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_connection_mode.go +++ /dev/null @@ -1,104 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyDBInstanceConnectionMode invokes the rds.ModifyDBInstanceConnectionMode API synchronously -func (client *Client) ModifyDBInstanceConnectionMode(request *ModifyDBInstanceConnectionModeRequest) (response *ModifyDBInstanceConnectionModeResponse, err error) { - response = CreateModifyDBInstanceConnectionModeResponse() - err = client.DoAction(request, response) - return -} - -// ModifyDBInstanceConnectionModeWithChan invokes the rds.ModifyDBInstanceConnectionMode API asynchronously -func (client *Client) ModifyDBInstanceConnectionModeWithChan(request *ModifyDBInstanceConnectionModeRequest) (<-chan *ModifyDBInstanceConnectionModeResponse, <-chan error) { - responseChan := make(chan *ModifyDBInstanceConnectionModeResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyDBInstanceConnectionMode(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyDBInstanceConnectionModeWithCallback invokes the rds.ModifyDBInstanceConnectionMode API asynchronously -func (client *Client) ModifyDBInstanceConnectionModeWithCallback(request *ModifyDBInstanceConnectionModeRequest, callback func(response *ModifyDBInstanceConnectionModeResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyDBInstanceConnectionModeResponse - var err error - defer close(result) - response, err = client.ModifyDBInstanceConnectionMode(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyDBInstanceConnectionModeRequest is the request struct for api ModifyDBInstanceConnectionMode -type ModifyDBInstanceConnectionModeRequest struct { - *requests.RpcRequest - ConnectionMode string `position:"Query" name:"ConnectionMode"` - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// ModifyDBInstanceConnectionModeResponse is the response struct for api ModifyDBInstanceConnectionMode -type ModifyDBInstanceConnectionModeResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateModifyDBInstanceConnectionModeRequest creates a request to invoke ModifyDBInstanceConnectionMode API -func CreateModifyDBInstanceConnectionModeRequest() (request *ModifyDBInstanceConnectionModeRequest) { - request = &ModifyDBInstanceConnectionModeRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyDBInstanceConnectionMode", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyDBInstanceConnectionModeResponse creates a response to parse from ModifyDBInstanceConnectionMode response -func CreateModifyDBInstanceConnectionModeResponse() (response *ModifyDBInstanceConnectionModeResponse) { - response = &ModifyDBInstanceConnectionModeResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_connection_string.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_connection_string.go deleted file mode 100644 index 953f77a411d..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_connection_string.go +++ /dev/null @@ -1,106 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyDBInstanceConnectionString invokes the rds.ModifyDBInstanceConnectionString API synchronously -func (client *Client) ModifyDBInstanceConnectionString(request *ModifyDBInstanceConnectionStringRequest) (response *ModifyDBInstanceConnectionStringResponse, err error) { - response = CreateModifyDBInstanceConnectionStringResponse() - err = client.DoAction(request, response) - return -} - -// ModifyDBInstanceConnectionStringWithChan invokes the rds.ModifyDBInstanceConnectionString API asynchronously -func (client *Client) ModifyDBInstanceConnectionStringWithChan(request *ModifyDBInstanceConnectionStringRequest) (<-chan *ModifyDBInstanceConnectionStringResponse, <-chan error) { - responseChan := make(chan *ModifyDBInstanceConnectionStringResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyDBInstanceConnectionString(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyDBInstanceConnectionStringWithCallback invokes the rds.ModifyDBInstanceConnectionString API asynchronously -func (client *Client) ModifyDBInstanceConnectionStringWithCallback(request *ModifyDBInstanceConnectionStringRequest, callback func(response *ModifyDBInstanceConnectionStringResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyDBInstanceConnectionStringResponse - var err error - defer close(result) - response, err = client.ModifyDBInstanceConnectionString(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyDBInstanceConnectionStringRequest is the request struct for api ModifyDBInstanceConnectionString -type ModifyDBInstanceConnectionStringRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ConnectionStringPrefix string `position:"Query" name:"ConnectionStringPrefix"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - CurrentConnectionString string `position:"Query" name:"CurrentConnectionString"` - Port string `position:"Query" name:"Port"` -} - -// ModifyDBInstanceConnectionStringResponse is the response struct for api ModifyDBInstanceConnectionString -type ModifyDBInstanceConnectionStringResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateModifyDBInstanceConnectionStringRequest creates a request to invoke ModifyDBInstanceConnectionString API -func CreateModifyDBInstanceConnectionStringRequest() (request *ModifyDBInstanceConnectionStringRequest) { - request = &ModifyDBInstanceConnectionStringRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyDBInstanceConnectionString", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyDBInstanceConnectionStringResponse creates a response to parse from ModifyDBInstanceConnectionString response -func CreateModifyDBInstanceConnectionStringResponse() (response *ModifyDBInstanceConnectionStringResponse) { - response = &ModifyDBInstanceConnectionStringResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_description.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_description.go deleted file mode 100644 index 7c10b29b35d..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_description.go +++ /dev/null @@ -1,105 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyDBInstanceDescription invokes the rds.ModifyDBInstanceDescription API synchronously -func (client *Client) ModifyDBInstanceDescription(request *ModifyDBInstanceDescriptionRequest) (response *ModifyDBInstanceDescriptionResponse, err error) { - response = CreateModifyDBInstanceDescriptionResponse() - err = client.DoAction(request, response) - return -} - -// ModifyDBInstanceDescriptionWithChan invokes the rds.ModifyDBInstanceDescription API asynchronously -func (client *Client) ModifyDBInstanceDescriptionWithChan(request *ModifyDBInstanceDescriptionRequest) (<-chan *ModifyDBInstanceDescriptionResponse, <-chan error) { - responseChan := make(chan *ModifyDBInstanceDescriptionResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyDBInstanceDescription(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyDBInstanceDescriptionWithCallback invokes the rds.ModifyDBInstanceDescription API asynchronously -func (client *Client) ModifyDBInstanceDescriptionWithCallback(request *ModifyDBInstanceDescriptionRequest, callback func(response *ModifyDBInstanceDescriptionResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyDBInstanceDescriptionResponse - var err error - defer close(result) - response, err = client.ModifyDBInstanceDescription(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyDBInstanceDescriptionRequest is the request struct for api ModifyDBInstanceDescription -type ModifyDBInstanceDescriptionRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ClientToken string `position:"Query" name:"ClientToken"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - DBInstanceDescription string `position:"Query" name:"DBInstanceDescription"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// ModifyDBInstanceDescriptionResponse is the response struct for api ModifyDBInstanceDescription -type ModifyDBInstanceDescriptionResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateModifyDBInstanceDescriptionRequest creates a request to invoke ModifyDBInstanceDescription API -func CreateModifyDBInstanceDescriptionRequest() (request *ModifyDBInstanceDescriptionRequest) { - request = &ModifyDBInstanceDescriptionRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyDBInstanceDescription", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyDBInstanceDescriptionResponse creates a response to parse from ModifyDBInstanceDescription response -func CreateModifyDBInstanceDescriptionResponse() (response *ModifyDBInstanceDescriptionResponse) { - response = &ModifyDBInstanceDescriptionResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_ha_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_ha_config.go deleted file mode 100644 index 5058e760145..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_ha_config.go +++ /dev/null @@ -1,105 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyDBInstanceHAConfig invokes the rds.ModifyDBInstanceHAConfig API synchronously -func (client *Client) ModifyDBInstanceHAConfig(request *ModifyDBInstanceHAConfigRequest) (response *ModifyDBInstanceHAConfigResponse, err error) { - response = CreateModifyDBInstanceHAConfigResponse() - err = client.DoAction(request, response) - return -} - -// ModifyDBInstanceHAConfigWithChan invokes the rds.ModifyDBInstanceHAConfig API asynchronously -func (client *Client) ModifyDBInstanceHAConfigWithChan(request *ModifyDBInstanceHAConfigRequest) (<-chan *ModifyDBInstanceHAConfigResponse, <-chan error) { - responseChan := make(chan *ModifyDBInstanceHAConfigResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyDBInstanceHAConfig(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyDBInstanceHAConfigWithCallback invokes the rds.ModifyDBInstanceHAConfig API asynchronously -func (client *Client) ModifyDBInstanceHAConfigWithCallback(request *ModifyDBInstanceHAConfigRequest, callback func(response *ModifyDBInstanceHAConfigResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyDBInstanceHAConfigResponse - var err error - defer close(result) - response, err = client.ModifyDBInstanceHAConfig(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyDBInstanceHAConfigRequest is the request struct for api ModifyDBInstanceHAConfig -type ModifyDBInstanceHAConfigRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - DbInstanceId string `position:"Query" name:"DbInstanceId"` - HAMode string `position:"Query" name:"HAMode"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - SyncMode string `position:"Query" name:"SyncMode"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// ModifyDBInstanceHAConfigResponse is the response struct for api ModifyDBInstanceHAConfig -type ModifyDBInstanceHAConfigResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateModifyDBInstanceHAConfigRequest creates a request to invoke ModifyDBInstanceHAConfig API -func CreateModifyDBInstanceHAConfigRequest() (request *ModifyDBInstanceHAConfigRequest) { - request = &ModifyDBInstanceHAConfigRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyDBInstanceHAConfig", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyDBInstanceHAConfigResponse creates a response to parse from ModifyDBInstanceHAConfig response -func CreateModifyDBInstanceHAConfigResponse() (response *ModifyDBInstanceHAConfigResponse) { - response = &ModifyDBInstanceHAConfigResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_maintain_time.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_maintain_time.go deleted file mode 100644 index 48d85f77110..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_maintain_time.go +++ /dev/null @@ -1,105 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyDBInstanceMaintainTime invokes the rds.ModifyDBInstanceMaintainTime API synchronously -func (client *Client) ModifyDBInstanceMaintainTime(request *ModifyDBInstanceMaintainTimeRequest) (response *ModifyDBInstanceMaintainTimeResponse, err error) { - response = CreateModifyDBInstanceMaintainTimeResponse() - err = client.DoAction(request, response) - return -} - -// ModifyDBInstanceMaintainTimeWithChan invokes the rds.ModifyDBInstanceMaintainTime API asynchronously -func (client *Client) ModifyDBInstanceMaintainTimeWithChan(request *ModifyDBInstanceMaintainTimeRequest) (<-chan *ModifyDBInstanceMaintainTimeResponse, <-chan error) { - responseChan := make(chan *ModifyDBInstanceMaintainTimeResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyDBInstanceMaintainTime(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyDBInstanceMaintainTimeWithCallback invokes the rds.ModifyDBInstanceMaintainTime API asynchronously -func (client *Client) ModifyDBInstanceMaintainTimeWithCallback(request *ModifyDBInstanceMaintainTimeRequest, callback func(response *ModifyDBInstanceMaintainTimeResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyDBInstanceMaintainTimeResponse - var err error - defer close(result) - response, err = client.ModifyDBInstanceMaintainTime(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyDBInstanceMaintainTimeRequest is the request struct for api ModifyDBInstanceMaintainTime -type ModifyDBInstanceMaintainTimeRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ClientToken string `position:"Query" name:"ClientToken"` - MaintainTime string `position:"Query" name:"MaintainTime"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// ModifyDBInstanceMaintainTimeResponse is the response struct for api ModifyDBInstanceMaintainTime -type ModifyDBInstanceMaintainTimeResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateModifyDBInstanceMaintainTimeRequest creates a request to invoke ModifyDBInstanceMaintainTime API -func CreateModifyDBInstanceMaintainTimeRequest() (request *ModifyDBInstanceMaintainTimeRequest) { - request = &ModifyDBInstanceMaintainTimeRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyDBInstanceMaintainTime", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyDBInstanceMaintainTimeResponse creates a response to parse from ModifyDBInstanceMaintainTime response -func CreateModifyDBInstanceMaintainTimeResponse() (response *ModifyDBInstanceMaintainTimeResponse) { - response = &ModifyDBInstanceMaintainTimeResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_monitor.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_monitor.go deleted file mode 100644 index 6edc85c0a35..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_monitor.go +++ /dev/null @@ -1,105 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyDBInstanceMonitor invokes the rds.ModifyDBInstanceMonitor API synchronously -func (client *Client) ModifyDBInstanceMonitor(request *ModifyDBInstanceMonitorRequest) (response *ModifyDBInstanceMonitorResponse, err error) { - response = CreateModifyDBInstanceMonitorResponse() - err = client.DoAction(request, response) - return -} - -// ModifyDBInstanceMonitorWithChan invokes the rds.ModifyDBInstanceMonitor API asynchronously -func (client *Client) ModifyDBInstanceMonitorWithChan(request *ModifyDBInstanceMonitorRequest) (<-chan *ModifyDBInstanceMonitorResponse, <-chan error) { - responseChan := make(chan *ModifyDBInstanceMonitorResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyDBInstanceMonitor(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyDBInstanceMonitorWithCallback invokes the rds.ModifyDBInstanceMonitor API asynchronously -func (client *Client) ModifyDBInstanceMonitorWithCallback(request *ModifyDBInstanceMonitorRequest, callback func(response *ModifyDBInstanceMonitorResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyDBInstanceMonitorResponse - var err error - defer close(result) - response, err = client.ModifyDBInstanceMonitor(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyDBInstanceMonitorRequest is the request struct for api ModifyDBInstanceMonitor -type ModifyDBInstanceMonitorRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - Period string `position:"Query" name:"Period"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - ClientToken string `position:"Query" name:"ClientToken"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// ModifyDBInstanceMonitorResponse is the response struct for api ModifyDBInstanceMonitor -type ModifyDBInstanceMonitorResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateModifyDBInstanceMonitorRequest creates a request to invoke ModifyDBInstanceMonitor API -func CreateModifyDBInstanceMonitorRequest() (request *ModifyDBInstanceMonitorRequest) { - request = &ModifyDBInstanceMonitorRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyDBInstanceMonitor", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyDBInstanceMonitorResponse creates a response to parse from ModifyDBInstanceMonitor response -func CreateModifyDBInstanceMonitorResponse() (response *ModifyDBInstanceMonitorResponse) { - response = &ModifyDBInstanceMonitorResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_network_expire_time.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_network_expire_time.go deleted file mode 100644 index 048740e6b15..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_network_expire_time.go +++ /dev/null @@ -1,105 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyDBInstanceNetworkExpireTime invokes the rds.ModifyDBInstanceNetworkExpireTime API synchronously -func (client *Client) ModifyDBInstanceNetworkExpireTime(request *ModifyDBInstanceNetworkExpireTimeRequest) (response *ModifyDBInstanceNetworkExpireTimeResponse, err error) { - response = CreateModifyDBInstanceNetworkExpireTimeResponse() - err = client.DoAction(request, response) - return -} - -// ModifyDBInstanceNetworkExpireTimeWithChan invokes the rds.ModifyDBInstanceNetworkExpireTime API asynchronously -func (client *Client) ModifyDBInstanceNetworkExpireTimeWithChan(request *ModifyDBInstanceNetworkExpireTimeRequest) (<-chan *ModifyDBInstanceNetworkExpireTimeResponse, <-chan error) { - responseChan := make(chan *ModifyDBInstanceNetworkExpireTimeResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyDBInstanceNetworkExpireTime(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyDBInstanceNetworkExpireTimeWithCallback invokes the rds.ModifyDBInstanceNetworkExpireTime API asynchronously -func (client *Client) ModifyDBInstanceNetworkExpireTimeWithCallback(request *ModifyDBInstanceNetworkExpireTimeRequest, callback func(response *ModifyDBInstanceNetworkExpireTimeResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyDBInstanceNetworkExpireTimeResponse - var err error - defer close(result) - response, err = client.ModifyDBInstanceNetworkExpireTime(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyDBInstanceNetworkExpireTimeRequest is the request struct for api ModifyDBInstanceNetworkExpireTime -type ModifyDBInstanceNetworkExpireTimeRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ConnectionString string `position:"Query" name:"ConnectionString"` - ClassicExpiredDays requests.Integer `position:"Query" name:"ClassicExpiredDays"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// ModifyDBInstanceNetworkExpireTimeResponse is the response struct for api ModifyDBInstanceNetworkExpireTime -type ModifyDBInstanceNetworkExpireTimeResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateModifyDBInstanceNetworkExpireTimeRequest creates a request to invoke ModifyDBInstanceNetworkExpireTime API -func CreateModifyDBInstanceNetworkExpireTimeRequest() (request *ModifyDBInstanceNetworkExpireTimeRequest) { - request = &ModifyDBInstanceNetworkExpireTimeRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyDBInstanceNetworkExpireTime", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyDBInstanceNetworkExpireTimeResponse creates a response to parse from ModifyDBInstanceNetworkExpireTime response -func CreateModifyDBInstanceNetworkExpireTimeResponse() (response *ModifyDBInstanceNetworkExpireTimeResponse) { - response = &ModifyDBInstanceNetworkExpireTimeResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_network_type.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_network_type.go deleted file mode 100644 index b48aa62b046..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_network_type.go +++ /dev/null @@ -1,113 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyDBInstanceNetworkType invokes the rds.ModifyDBInstanceNetworkType API synchronously -func (client *Client) ModifyDBInstanceNetworkType(request *ModifyDBInstanceNetworkTypeRequest) (response *ModifyDBInstanceNetworkTypeResponse, err error) { - response = CreateModifyDBInstanceNetworkTypeResponse() - err = client.DoAction(request, response) - return -} - -// ModifyDBInstanceNetworkTypeWithChan invokes the rds.ModifyDBInstanceNetworkType API asynchronously -func (client *Client) ModifyDBInstanceNetworkTypeWithChan(request *ModifyDBInstanceNetworkTypeRequest) (<-chan *ModifyDBInstanceNetworkTypeResponse, <-chan error) { - responseChan := make(chan *ModifyDBInstanceNetworkTypeResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyDBInstanceNetworkType(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyDBInstanceNetworkTypeWithCallback invokes the rds.ModifyDBInstanceNetworkType API asynchronously -func (client *Client) ModifyDBInstanceNetworkTypeWithCallback(request *ModifyDBInstanceNetworkTypeRequest, callback func(response *ModifyDBInstanceNetworkTypeResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyDBInstanceNetworkTypeResponse - var err error - defer close(result) - response, err = client.ModifyDBInstanceNetworkType(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyDBInstanceNetworkTypeRequest is the request struct for api ModifyDBInstanceNetworkType -type ModifyDBInstanceNetworkTypeRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ClassicExpiredDays string `position:"Query" name:"ClassicExpiredDays"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ReadWriteSplittingPrivateIpAddress string `position:"Query" name:"ReadWriteSplittingPrivateIpAddress"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - VSwitchId string `position:"Query" name:"VSwitchId"` - PrivateIpAddress string `position:"Query" name:"PrivateIpAddress"` - RetainClassic string `position:"Query" name:"RetainClassic"` - VPCId string `position:"Query" name:"VPCId"` - InstanceNetworkType string `position:"Query" name:"InstanceNetworkType"` - ReadWriteSplittingClassicExpiredDays requests.Integer `position:"Query" name:"ReadWriteSplittingClassicExpiredDays"` -} - -// ModifyDBInstanceNetworkTypeResponse is the response struct for api ModifyDBInstanceNetworkType -type ModifyDBInstanceNetworkTypeResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - TaskId string `json:"TaskId" xml:"TaskId"` - ConnectionString string `json:"ConnectionString" xml:"ConnectionString"` -} - -// CreateModifyDBInstanceNetworkTypeRequest creates a request to invoke ModifyDBInstanceNetworkType API -func CreateModifyDBInstanceNetworkTypeRequest() (request *ModifyDBInstanceNetworkTypeRequest) { - request = &ModifyDBInstanceNetworkTypeRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyDBInstanceNetworkType", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyDBInstanceNetworkTypeResponse creates a response to parse from ModifyDBInstanceNetworkType response -func CreateModifyDBInstanceNetworkTypeResponse() (response *ModifyDBInstanceNetworkTypeResponse) { - response = &ModifyDBInstanceNetworkTypeResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_pay_type.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_pay_type.go deleted file mode 100644 index 53c9003380e..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_pay_type.go +++ /dev/null @@ -1,113 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyDBInstancePayType invokes the rds.ModifyDBInstancePayType API synchronously -func (client *Client) ModifyDBInstancePayType(request *ModifyDBInstancePayTypeRequest) (response *ModifyDBInstancePayTypeResponse, err error) { - response = CreateModifyDBInstancePayTypeResponse() - err = client.DoAction(request, response) - return -} - -// ModifyDBInstancePayTypeWithChan invokes the rds.ModifyDBInstancePayType API asynchronously -func (client *Client) ModifyDBInstancePayTypeWithChan(request *ModifyDBInstancePayTypeRequest) (<-chan *ModifyDBInstancePayTypeResponse, <-chan error) { - responseChan := make(chan *ModifyDBInstancePayTypeResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyDBInstancePayType(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyDBInstancePayTypeWithCallback invokes the rds.ModifyDBInstancePayType API asynchronously -func (client *Client) ModifyDBInstancePayTypeWithCallback(request *ModifyDBInstancePayTypeRequest, callback func(response *ModifyDBInstancePayTypeResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyDBInstancePayTypeResponse - var err error - defer close(result) - response, err = client.ModifyDBInstancePayType(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyDBInstancePayTypeRequest is the request struct for api ModifyDBInstancePayType -type ModifyDBInstancePayTypeRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ClientToken string `position:"Query" name:"ClientToken"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - BusinessInfo string `position:"Query" name:"BusinessInfo"` - Period string `position:"Query" name:"Period"` - AgentId string `position:"Query" name:"AgentId"` - AutoPay requests.Boolean `position:"Query" name:"AutoPay"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - Resource string `position:"Query" name:"Resource"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - UsedTime requests.Integer `position:"Query" name:"UsedTime"` - PayType string `position:"Query" name:"PayType"` -} - -// ModifyDBInstancePayTypeResponse is the response struct for api ModifyDBInstancePayType -type ModifyDBInstancePayTypeResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - OrderId int64 `json:"OrderId" xml:"OrderId"` -} - -// CreateModifyDBInstancePayTypeRequest creates a request to invoke ModifyDBInstancePayType API -func CreateModifyDBInstancePayTypeRequest() (request *ModifyDBInstancePayTypeRequest) { - request = &ModifyDBInstancePayTypeRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyDBInstancePayType", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyDBInstancePayTypeResponse creates a response to parse from ModifyDBInstancePayType response -func CreateModifyDBInstancePayTypeResponse() (response *ModifyDBInstancePayTypeResponse) { - response = &ModifyDBInstancePayTypeResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_proxy_configuration.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_proxy_configuration.go deleted file mode 100644 index ae144c2ca51..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_proxy_configuration.go +++ /dev/null @@ -1,104 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyDBInstanceProxyConfiguration invokes the rds.ModifyDBInstanceProxyConfiguration API synchronously -func (client *Client) ModifyDBInstanceProxyConfiguration(request *ModifyDBInstanceProxyConfigurationRequest) (response *ModifyDBInstanceProxyConfigurationResponse, err error) { - response = CreateModifyDBInstanceProxyConfigurationResponse() - err = client.DoAction(request, response) - return -} - -// ModifyDBInstanceProxyConfigurationWithChan invokes the rds.ModifyDBInstanceProxyConfiguration API asynchronously -func (client *Client) ModifyDBInstanceProxyConfigurationWithChan(request *ModifyDBInstanceProxyConfigurationRequest) (<-chan *ModifyDBInstanceProxyConfigurationResponse, <-chan error) { - responseChan := make(chan *ModifyDBInstanceProxyConfigurationResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyDBInstanceProxyConfiguration(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyDBInstanceProxyConfigurationWithCallback invokes the rds.ModifyDBInstanceProxyConfiguration API asynchronously -func (client *Client) ModifyDBInstanceProxyConfigurationWithCallback(request *ModifyDBInstanceProxyConfigurationRequest, callback func(response *ModifyDBInstanceProxyConfigurationResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyDBInstanceProxyConfigurationResponse - var err error - defer close(result) - response, err = client.ModifyDBInstanceProxyConfiguration(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyDBInstanceProxyConfigurationRequest is the request struct for api ModifyDBInstanceProxyConfiguration -type ModifyDBInstanceProxyConfigurationRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - ProxyConfigurationValue string `position:"Query" name:"ProxyConfigurationValue"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - ProxyConfigurationKey string `position:"Query" name:"ProxyConfigurationKey"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// ModifyDBInstanceProxyConfigurationResponse is the response struct for api ModifyDBInstanceProxyConfiguration -type ModifyDBInstanceProxyConfigurationResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateModifyDBInstanceProxyConfigurationRequest creates a request to invoke ModifyDBInstanceProxyConfiguration API -func CreateModifyDBInstanceProxyConfigurationRequest() (request *ModifyDBInstanceProxyConfigurationRequest) { - request = &ModifyDBInstanceProxyConfigurationRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyDBInstanceProxyConfiguration", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyDBInstanceProxyConfigurationResponse creates a response to parse from ModifyDBInstanceProxyConfiguration response -func CreateModifyDBInstanceProxyConfigurationResponse() (response *ModifyDBInstanceProxyConfigurationResponse) { - response = &ModifyDBInstanceProxyConfigurationResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_spec.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_spec.go deleted file mode 100644 index 05836f2c4f6..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_spec.go +++ /dev/null @@ -1,116 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyDBInstanceSpec invokes the rds.ModifyDBInstanceSpec API synchronously -func (client *Client) ModifyDBInstanceSpec(request *ModifyDBInstanceSpecRequest) (response *ModifyDBInstanceSpecResponse, err error) { - response = CreateModifyDBInstanceSpecResponse() - err = client.DoAction(request, response) - return -} - -// ModifyDBInstanceSpecWithChan invokes the rds.ModifyDBInstanceSpec API asynchronously -func (client *Client) ModifyDBInstanceSpecWithChan(request *ModifyDBInstanceSpecRequest) (<-chan *ModifyDBInstanceSpecResponse, <-chan error) { - responseChan := make(chan *ModifyDBInstanceSpecResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyDBInstanceSpec(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyDBInstanceSpecWithCallback invokes the rds.ModifyDBInstanceSpec API asynchronously -func (client *Client) ModifyDBInstanceSpecWithCallback(request *ModifyDBInstanceSpecRequest, callback func(response *ModifyDBInstanceSpecResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyDBInstanceSpecResponse - var err error - defer close(result) - response, err = client.ModifyDBInstanceSpec(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyDBInstanceSpecRequest is the request struct for api ModifyDBInstanceSpec -type ModifyDBInstanceSpecRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - DBInstanceStorage requests.Integer `position:"Query" name:"DBInstanceStorage"` - ClientToken string `position:"Query" name:"ClientToken"` - EngineVersion string `position:"Query" name:"EngineVersion"` - EffectiveTime string `position:"Query" name:"EffectiveTime"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - DBInstanceStorageType string `position:"Query" name:"DBInstanceStorageType"` - SourceBiz string `position:"Query" name:"SourceBiz"` - DedicatedHostGroupId string `position:"Query" name:"DedicatedHostGroupId"` - Direction string `position:"Query" name:"Direction"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceClass string `position:"Query" name:"DBInstanceClass"` - ZoneId string `position:"Query" name:"ZoneId"` - PayType string `position:"Query" name:"PayType"` -} - -// ModifyDBInstanceSpecResponse is the response struct for api ModifyDBInstanceSpec -type ModifyDBInstanceSpecResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - OrderId int64 `json:"OrderId" xml:"OrderId"` -} - -// CreateModifyDBInstanceSpecRequest creates a request to invoke ModifyDBInstanceSpec API -func CreateModifyDBInstanceSpecRequest() (request *ModifyDBInstanceSpecRequest) { - request = &ModifyDBInstanceSpecRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyDBInstanceSpec", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyDBInstanceSpecResponse creates a response to parse from ModifyDBInstanceSpec response -func CreateModifyDBInstanceSpecResponse() (response *ModifyDBInstanceSpecResponse) { - response = &ModifyDBInstanceSpecResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_ssl.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_ssl.go deleted file mode 100644 index 83bb1a99e1f..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_ssl.go +++ /dev/null @@ -1,105 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyDBInstanceSSL invokes the rds.ModifyDBInstanceSSL API synchronously -func (client *Client) ModifyDBInstanceSSL(request *ModifyDBInstanceSSLRequest) (response *ModifyDBInstanceSSLResponse, err error) { - response = CreateModifyDBInstanceSSLResponse() - err = client.DoAction(request, response) - return -} - -// ModifyDBInstanceSSLWithChan invokes the rds.ModifyDBInstanceSSL API asynchronously -func (client *Client) ModifyDBInstanceSSLWithChan(request *ModifyDBInstanceSSLRequest) (<-chan *ModifyDBInstanceSSLResponse, <-chan error) { - responseChan := make(chan *ModifyDBInstanceSSLResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyDBInstanceSSL(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyDBInstanceSSLWithCallback invokes the rds.ModifyDBInstanceSSL API asynchronously -func (client *Client) ModifyDBInstanceSSLWithCallback(request *ModifyDBInstanceSSLRequest, callback func(response *ModifyDBInstanceSSLResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyDBInstanceSSLResponse - var err error - defer close(result) - response, err = client.ModifyDBInstanceSSL(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyDBInstanceSSLRequest is the request struct for api ModifyDBInstanceSSL -type ModifyDBInstanceSSLRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ConnectionString string `position:"Query" name:"ConnectionString"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - SSLEnabled requests.Integer `position:"Query" name:"SSLEnabled"` -} - -// ModifyDBInstanceSSLResponse is the response struct for api ModifyDBInstanceSSL -type ModifyDBInstanceSSLResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateModifyDBInstanceSSLRequest creates a request to invoke ModifyDBInstanceSSL API -func CreateModifyDBInstanceSSLRequest() (request *ModifyDBInstanceSSLRequest) { - request = &ModifyDBInstanceSSLRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyDBInstanceSSL", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyDBInstanceSSLResponse creates a response to parse from ModifyDBInstanceSSL response -func CreateModifyDBInstanceSSLResponse() (response *ModifyDBInstanceSSLResponse) { - response = &ModifyDBInstanceSSLResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_tde.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_tde.go deleted file mode 100644 index e229fbe7f86..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_instance_tde.go +++ /dev/null @@ -1,107 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyDBInstanceTDE invokes the rds.ModifyDBInstanceTDE API synchronously -func (client *Client) ModifyDBInstanceTDE(request *ModifyDBInstanceTDERequest) (response *ModifyDBInstanceTDEResponse, err error) { - response = CreateModifyDBInstanceTDEResponse() - err = client.DoAction(request, response) - return -} - -// ModifyDBInstanceTDEWithChan invokes the rds.ModifyDBInstanceTDE API asynchronously -func (client *Client) ModifyDBInstanceTDEWithChan(request *ModifyDBInstanceTDERequest) (<-chan *ModifyDBInstanceTDEResponse, <-chan error) { - responseChan := make(chan *ModifyDBInstanceTDEResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyDBInstanceTDE(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyDBInstanceTDEWithCallback invokes the rds.ModifyDBInstanceTDE API asynchronously -func (client *Client) ModifyDBInstanceTDEWithCallback(request *ModifyDBInstanceTDERequest, callback func(response *ModifyDBInstanceTDEResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyDBInstanceTDEResponse - var err error - defer close(result) - response, err = client.ModifyDBInstanceTDE(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyDBInstanceTDERequest is the request struct for api ModifyDBInstanceTDE -type ModifyDBInstanceTDERequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - EncryptionKey string `position:"Query" name:"EncryptionKey"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBName string `position:"Query" name:"DBName"` - RoleArn string `position:"Query" name:"RoleArn"` - TDEStatus string `position:"Query" name:"TDEStatus"` -} - -// ModifyDBInstanceTDEResponse is the response struct for api ModifyDBInstanceTDE -type ModifyDBInstanceTDEResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateModifyDBInstanceTDERequest creates a request to invoke ModifyDBInstanceTDE API -func CreateModifyDBInstanceTDERequest() (request *ModifyDBInstanceTDERequest) { - request = &ModifyDBInstanceTDERequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyDBInstanceTDE", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyDBInstanceTDEResponse creates a response to parse from ModifyDBInstanceTDE response -func CreateModifyDBInstanceTDEResponse() (response *ModifyDBInstanceTDEResponse) { - response = &ModifyDBInstanceTDEResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_proxy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_proxy.go deleted file mode 100644 index a425986a86c..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_proxy.go +++ /dev/null @@ -1,107 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyDBProxy invokes the rds.ModifyDBProxy API synchronously -func (client *Client) ModifyDBProxy(request *ModifyDBProxyRequest) (response *ModifyDBProxyResponse, err error) { - response = CreateModifyDBProxyResponse() - err = client.DoAction(request, response) - return -} - -// ModifyDBProxyWithChan invokes the rds.ModifyDBProxy API asynchronously -func (client *Client) ModifyDBProxyWithChan(request *ModifyDBProxyRequest) (<-chan *ModifyDBProxyResponse, <-chan error) { - responseChan := make(chan *ModifyDBProxyResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyDBProxy(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyDBProxyWithCallback invokes the rds.ModifyDBProxy API asynchronously -func (client *Client) ModifyDBProxyWithCallback(request *ModifyDBProxyRequest, callback func(response *ModifyDBProxyResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyDBProxyResponse - var err error - defer close(result) - response, err = client.ModifyDBProxy(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyDBProxyRequest is the request struct for api ModifyDBProxy -type ModifyDBProxyRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBProxyInstanceNum string `position:"Query" name:"DBProxyInstanceNum"` - ConfigDBProxyService string `position:"Query" name:"ConfigDBProxyService"` - VSwitchId string `position:"Query" name:"VSwitchId"` - VPCId string `position:"Query" name:"VPCId"` - InstanceNetworkType string `position:"Query" name:"InstanceNetworkType"` -} - -// ModifyDBProxyResponse is the response struct for api ModifyDBProxy -type ModifyDBProxyResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateModifyDBProxyRequest creates a request to invoke ModifyDBProxy API -func CreateModifyDBProxyRequest() (request *ModifyDBProxyRequest) { - request = &ModifyDBProxyRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyDBProxy", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyDBProxyResponse creates a response to parse from ModifyDBProxy response -func CreateModifyDBProxyResponse() (response *ModifyDBProxyResponse) { - response = &ModifyDBProxyResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_proxy_endpoint.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_proxy_endpoint.go deleted file mode 100644 index 9c40e3083a5..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_proxy_endpoint.go +++ /dev/null @@ -1,111 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyDBProxyEndpoint invokes the rds.ModifyDBProxyEndpoint API synchronously -func (client *Client) ModifyDBProxyEndpoint(request *ModifyDBProxyEndpointRequest) (response *ModifyDBProxyEndpointResponse, err error) { - response = CreateModifyDBProxyEndpointResponse() - err = client.DoAction(request, response) - return -} - -// ModifyDBProxyEndpointWithChan invokes the rds.ModifyDBProxyEndpoint API asynchronously -func (client *Client) ModifyDBProxyEndpointWithChan(request *ModifyDBProxyEndpointRequest) (<-chan *ModifyDBProxyEndpointResponse, <-chan error) { - responseChan := make(chan *ModifyDBProxyEndpointResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyDBProxyEndpoint(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyDBProxyEndpointWithCallback invokes the rds.ModifyDBProxyEndpoint API asynchronously -func (client *Client) ModifyDBProxyEndpointWithCallback(request *ModifyDBProxyEndpointRequest, callback func(response *ModifyDBProxyEndpointResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyDBProxyEndpointResponse - var err error - defer close(result) - response, err = client.ModifyDBProxyEndpoint(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyDBProxyEndpointRequest is the request struct for api ModifyDBProxyEndpoint -type ModifyDBProxyEndpointRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ConfigDBProxyFeatures string `position:"Query" name:"ConfigDBProxyFeatures"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ReadOnlyInstanceWeight string `position:"Query" name:"ReadOnlyInstanceWeight"` - ReadOnlyInstanceMaxDelayTime string `position:"Query" name:"ReadOnlyInstanceMaxDelayTime"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - DbEndpointAliases string `position:"Query" name:"DbEndpointAliases"` - DbEndpointOperator string `position:"Query" name:"DbEndpointOperator"` - DbEndpointType string `position:"Query" name:"DbEndpointType"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DbEndpointReadWriteMode string `position:"Query" name:"DbEndpointReadWriteMode"` - DBProxyEndpointId string `position:"Query" name:"DBProxyEndpointId"` - ReadOnlyInstanceDistributionType string `position:"Query" name:"ReadOnlyInstanceDistributionType"` -} - -// ModifyDBProxyEndpointResponse is the response struct for api ModifyDBProxyEndpoint -type ModifyDBProxyEndpointResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateModifyDBProxyEndpointRequest creates a request to invoke ModifyDBProxyEndpoint API -func CreateModifyDBProxyEndpointRequest() (request *ModifyDBProxyEndpointRequest) { - request = &ModifyDBProxyEndpointRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyDBProxyEndpoint", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyDBProxyEndpointResponse creates a response to parse from ModifyDBProxyEndpoint response -func CreateModifyDBProxyEndpointResponse() (response *ModifyDBProxyEndpointResponse) { - response = &ModifyDBProxyEndpointResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_proxy_endpoint_address.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_proxy_endpoint_address.go deleted file mode 100644 index 2749384d8b9..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_proxy_endpoint_address.go +++ /dev/null @@ -1,106 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyDBProxyEndpointAddress invokes the rds.ModifyDBProxyEndpointAddress API synchronously -func (client *Client) ModifyDBProxyEndpointAddress(request *ModifyDBProxyEndpointAddressRequest) (response *ModifyDBProxyEndpointAddressResponse, err error) { - response = CreateModifyDBProxyEndpointAddressResponse() - err = client.DoAction(request, response) - return -} - -// ModifyDBProxyEndpointAddressWithChan invokes the rds.ModifyDBProxyEndpointAddress API asynchronously -func (client *Client) ModifyDBProxyEndpointAddressWithChan(request *ModifyDBProxyEndpointAddressRequest) (<-chan *ModifyDBProxyEndpointAddressResponse, <-chan error) { - responseChan := make(chan *ModifyDBProxyEndpointAddressResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyDBProxyEndpointAddress(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyDBProxyEndpointAddressWithCallback invokes the rds.ModifyDBProxyEndpointAddress API asynchronously -func (client *Client) ModifyDBProxyEndpointAddressWithCallback(request *ModifyDBProxyEndpointAddressRequest, callback func(response *ModifyDBProxyEndpointAddressResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyDBProxyEndpointAddressResponse - var err error - defer close(result) - response, err = client.ModifyDBProxyEndpointAddress(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyDBProxyEndpointAddressRequest is the request struct for api ModifyDBProxyEndpointAddress -type ModifyDBProxyEndpointAddressRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - DBProxyConnectStringNetType string `position:"Query" name:"DBProxyConnectStringNetType"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - DBProxyNewConnectStringPort string `position:"Query" name:"DBProxyNewConnectStringPort"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBProxyEndpointId string `position:"Query" name:"DBProxyEndpointId"` - DBProxyNewConnectString string `position:"Query" name:"DBProxyNewConnectString"` -} - -// ModifyDBProxyEndpointAddressResponse is the response struct for api ModifyDBProxyEndpointAddress -type ModifyDBProxyEndpointAddressResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateModifyDBProxyEndpointAddressRequest creates a request to invoke ModifyDBProxyEndpointAddress API -func CreateModifyDBProxyEndpointAddressRequest() (request *ModifyDBProxyEndpointAddressRequest) { - request = &ModifyDBProxyEndpointAddressRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyDBProxyEndpointAddress", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyDBProxyEndpointAddressResponse creates a response to parse from ModifyDBProxyEndpointAddress response -func CreateModifyDBProxyEndpointAddressResponse() (response *ModifyDBProxyEndpointAddressResponse) { - response = &ModifyDBProxyEndpointAddressResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_proxy_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_proxy_instance.go deleted file mode 100644 index 64082949cb5..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_proxy_instance.go +++ /dev/null @@ -1,106 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyDBProxyInstance invokes the rds.ModifyDBProxyInstance API synchronously -func (client *Client) ModifyDBProxyInstance(request *ModifyDBProxyInstanceRequest) (response *ModifyDBProxyInstanceResponse, err error) { - response = CreateModifyDBProxyInstanceResponse() - err = client.DoAction(request, response) - return -} - -// ModifyDBProxyInstanceWithChan invokes the rds.ModifyDBProxyInstance API asynchronously -func (client *Client) ModifyDBProxyInstanceWithChan(request *ModifyDBProxyInstanceRequest) (<-chan *ModifyDBProxyInstanceResponse, <-chan error) { - responseChan := make(chan *ModifyDBProxyInstanceResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyDBProxyInstance(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyDBProxyInstanceWithCallback invokes the rds.ModifyDBProxyInstance API asynchronously -func (client *Client) ModifyDBProxyInstanceWithCallback(request *ModifyDBProxyInstanceRequest, callback func(response *ModifyDBProxyInstanceResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyDBProxyInstanceResponse - var err error - defer close(result) - response, err = client.ModifyDBProxyInstance(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyDBProxyInstanceRequest is the request struct for api ModifyDBProxyInstance -type ModifyDBProxyInstanceRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - EffectiveTime string `position:"Query" name:"EffectiveTime"` - EffectiveSpecificTime string `position:"Query" name:"EffectiveSpecificTime"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBProxyInstanceNum string `position:"Query" name:"DBProxyInstanceNum"` - DBProxyInstanceType string `position:"Query" name:"DBProxyInstanceType"` -} - -// ModifyDBProxyInstanceResponse is the response struct for api ModifyDBProxyInstance -type ModifyDBProxyInstanceResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateModifyDBProxyInstanceRequest creates a request to invoke ModifyDBProxyInstance API -func CreateModifyDBProxyInstanceRequest() (request *ModifyDBProxyInstanceRequest) { - request = &ModifyDBProxyInstanceRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyDBProxyInstance", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyDBProxyInstanceResponse creates a response to parse from ModifyDBProxyInstance response -func CreateModifyDBProxyInstanceResponse() (response *ModifyDBProxyInstanceResponse) { - response = &ModifyDBProxyInstanceResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_proxy_instance_ssl.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_proxy_instance_ssl.go deleted file mode 100644 index 831d224e986..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_db_proxy_instance_ssl.go +++ /dev/null @@ -1,102 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyDbProxyInstanceSsl invokes the rds.ModifyDbProxyInstanceSsl API synchronously -func (client *Client) ModifyDbProxyInstanceSsl(request *ModifyDbProxyInstanceSslRequest) (response *ModifyDbProxyInstanceSslResponse, err error) { - response = CreateModifyDbProxyInstanceSslResponse() - err = client.DoAction(request, response) - return -} - -// ModifyDbProxyInstanceSslWithChan invokes the rds.ModifyDbProxyInstanceSsl API asynchronously -func (client *Client) ModifyDbProxyInstanceSslWithChan(request *ModifyDbProxyInstanceSslRequest) (<-chan *ModifyDbProxyInstanceSslResponse, <-chan error) { - responseChan := make(chan *ModifyDbProxyInstanceSslResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyDbProxyInstanceSsl(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyDbProxyInstanceSslWithCallback invokes the rds.ModifyDbProxyInstanceSsl API asynchronously -func (client *Client) ModifyDbProxyInstanceSslWithCallback(request *ModifyDbProxyInstanceSslRequest, callback func(response *ModifyDbProxyInstanceSslResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyDbProxyInstanceSslResponse - var err error - defer close(result) - response, err = client.ModifyDbProxyInstanceSsl(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyDbProxyInstanceSslRequest is the request struct for api ModifyDbProxyInstanceSsl -type ModifyDbProxyInstanceSslRequest struct { - *requests.RpcRequest - DbProxySslEnabled string `position:"Query" name:"DbProxySslEnabled"` - DbProxyConnectString string `position:"Query" name:"DbProxyConnectString"` - DbInstanceId string `position:"Query" name:"DbInstanceId"` - DbProxyEndpointId string `position:"Query" name:"DbProxyEndpointId"` -} - -// ModifyDbProxyInstanceSslResponse is the response struct for api ModifyDbProxyInstanceSsl -type ModifyDbProxyInstanceSslResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateModifyDbProxyInstanceSslRequest creates a request to invoke ModifyDbProxyInstanceSsl API -func CreateModifyDbProxyInstanceSslRequest() (request *ModifyDbProxyInstanceSslRequest) { - request = &ModifyDbProxyInstanceSslRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyDbProxyInstanceSsl", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyDbProxyInstanceSslResponse creates a response to parse from ModifyDbProxyInstanceSsl response -func CreateModifyDbProxyInstanceSslResponse() (response *ModifyDbProxyInstanceSslResponse) { - response = &ModifyDbProxyInstanceSslResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_dtc_security_ip_hosts_for_sql_server.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_dtc_security_ip_hosts_for_sql_server.go deleted file mode 100644 index 53bc2ace49a..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_dtc_security_ip_hosts_for_sql_server.go +++ /dev/null @@ -1,109 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyDTCSecurityIpHostsForSQLServer invokes the rds.ModifyDTCSecurityIpHostsForSQLServer API synchronously -func (client *Client) ModifyDTCSecurityIpHostsForSQLServer(request *ModifyDTCSecurityIpHostsForSQLServerRequest) (response *ModifyDTCSecurityIpHostsForSQLServerResponse, err error) { - response = CreateModifyDTCSecurityIpHostsForSQLServerResponse() - err = client.DoAction(request, response) - return -} - -// ModifyDTCSecurityIpHostsForSQLServerWithChan invokes the rds.ModifyDTCSecurityIpHostsForSQLServer API asynchronously -func (client *Client) ModifyDTCSecurityIpHostsForSQLServerWithChan(request *ModifyDTCSecurityIpHostsForSQLServerRequest) (<-chan *ModifyDTCSecurityIpHostsForSQLServerResponse, <-chan error) { - responseChan := make(chan *ModifyDTCSecurityIpHostsForSQLServerResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyDTCSecurityIpHostsForSQLServer(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyDTCSecurityIpHostsForSQLServerWithCallback invokes the rds.ModifyDTCSecurityIpHostsForSQLServer API asynchronously -func (client *Client) ModifyDTCSecurityIpHostsForSQLServerWithCallback(request *ModifyDTCSecurityIpHostsForSQLServerRequest, callback func(response *ModifyDTCSecurityIpHostsForSQLServerResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyDTCSecurityIpHostsForSQLServerResponse - var err error - defer close(result) - response, err = client.ModifyDTCSecurityIpHostsForSQLServer(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyDTCSecurityIpHostsForSQLServerRequest is the request struct for api ModifyDTCSecurityIpHostsForSQLServer -type ModifyDTCSecurityIpHostsForSQLServerRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - WhiteListGroupName string `position:"Query" name:"WhiteListGroupName"` - SecurityIpHosts string `position:"Query" name:"SecurityIpHosts"` - SecurityToken string `position:"Query" name:"SecurityToken"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// ModifyDTCSecurityIpHostsForSQLServerResponse is the response struct for api ModifyDTCSecurityIpHostsForSQLServer -type ModifyDTCSecurityIpHostsForSQLServerResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - DTCSetResult string `json:"DTCSetResult" xml:"DTCSetResult"` - TaskId string `json:"TaskId" xml:"TaskId"` -} - -// CreateModifyDTCSecurityIpHostsForSQLServerRequest creates a request to invoke ModifyDTCSecurityIpHostsForSQLServer API -func CreateModifyDTCSecurityIpHostsForSQLServerRequest() (request *ModifyDTCSecurityIpHostsForSQLServerRequest) { - request = &ModifyDTCSecurityIpHostsForSQLServerRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyDTCSecurityIpHostsForSQLServer", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyDTCSecurityIpHostsForSQLServerResponse creates a response to parse from ModifyDTCSecurityIpHostsForSQLServer response -func CreateModifyDTCSecurityIpHostsForSQLServerResponse() (response *ModifyDTCSecurityIpHostsForSQLServerResponse) { - response = &ModifyDTCSecurityIpHostsForSQLServerResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_ha_diagnose_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_ha_diagnose_config.go deleted file mode 100644 index da1e02f395c..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_ha_diagnose_config.go +++ /dev/null @@ -1,103 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyHADiagnoseConfig invokes the rds.ModifyHADiagnoseConfig API synchronously -func (client *Client) ModifyHADiagnoseConfig(request *ModifyHADiagnoseConfigRequest) (response *ModifyHADiagnoseConfigResponse, err error) { - response = CreateModifyHADiagnoseConfigResponse() - err = client.DoAction(request, response) - return -} - -// ModifyHADiagnoseConfigWithChan invokes the rds.ModifyHADiagnoseConfig API asynchronously -func (client *Client) ModifyHADiagnoseConfigWithChan(request *ModifyHADiagnoseConfigRequest) (<-chan *ModifyHADiagnoseConfigResponse, <-chan error) { - responseChan := make(chan *ModifyHADiagnoseConfigResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyHADiagnoseConfig(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyHADiagnoseConfigWithCallback invokes the rds.ModifyHADiagnoseConfig API asynchronously -func (client *Client) ModifyHADiagnoseConfigWithCallback(request *ModifyHADiagnoseConfigRequest, callback func(response *ModifyHADiagnoseConfigResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyHADiagnoseConfigResponse - var err error - defer close(result) - response, err = client.ModifyHADiagnoseConfig(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyHADiagnoseConfigRequest is the request struct for api ModifyHADiagnoseConfig -type ModifyHADiagnoseConfigRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - TcpConnectionType string `position:"Query" name:"TcpConnectionType"` -} - -// ModifyHADiagnoseConfigResponse is the response struct for api ModifyHADiagnoseConfig -type ModifyHADiagnoseConfigResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateModifyHADiagnoseConfigRequest creates a request to invoke ModifyHADiagnoseConfig API -func CreateModifyHADiagnoseConfigRequest() (request *ModifyHADiagnoseConfigRequest) { - request = &ModifyHADiagnoseConfigRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyHADiagnoseConfig", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyHADiagnoseConfigResponse creates a response to parse from ModifyHADiagnoseConfig response -func CreateModifyHADiagnoseConfigResponse() (response *ModifyHADiagnoseConfigResponse) { - response = &ModifyHADiagnoseConfigResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_ha_switch_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_ha_switch_config.go deleted file mode 100644 index f4ed65fe739..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_ha_switch_config.go +++ /dev/null @@ -1,104 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyHASwitchConfig invokes the rds.ModifyHASwitchConfig API synchronously -func (client *Client) ModifyHASwitchConfig(request *ModifyHASwitchConfigRequest) (response *ModifyHASwitchConfigResponse, err error) { - response = CreateModifyHASwitchConfigResponse() - err = client.DoAction(request, response) - return -} - -// ModifyHASwitchConfigWithChan invokes the rds.ModifyHASwitchConfig API asynchronously -func (client *Client) ModifyHASwitchConfigWithChan(request *ModifyHASwitchConfigRequest) (<-chan *ModifyHASwitchConfigResponse, <-chan error) { - responseChan := make(chan *ModifyHASwitchConfigResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyHASwitchConfig(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyHASwitchConfigWithCallback invokes the rds.ModifyHASwitchConfig API asynchronously -func (client *Client) ModifyHASwitchConfigWithCallback(request *ModifyHASwitchConfigRequest, callback func(response *ModifyHASwitchConfigResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyHASwitchConfigResponse - var err error - defer close(result) - response, err = client.ModifyHASwitchConfig(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyHASwitchConfigRequest is the request struct for api ModifyHASwitchConfig -type ModifyHASwitchConfigRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - HAConfig string `position:"Query" name:"HAConfig"` - ManualHATime string `position:"Query" name:"ManualHATime"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// ModifyHASwitchConfigResponse is the response struct for api ModifyHASwitchConfig -type ModifyHASwitchConfigResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateModifyHASwitchConfigRequest creates a request to invoke ModifyHASwitchConfig API -func CreateModifyHASwitchConfigRequest() (request *ModifyHASwitchConfigRequest) { - request = &ModifyHASwitchConfigRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyHASwitchConfig", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyHASwitchConfigResponse creates a response to parse from ModifyHASwitchConfig response -func CreateModifyHASwitchConfigResponse() (response *ModifyHASwitchConfigResponse) { - response = &ModifyHASwitchConfigResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_instance_auto_renewal_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_instance_auto_renewal_attribute.go deleted file mode 100644 index 5093892b73c..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_instance_auto_renewal_attribute.go +++ /dev/null @@ -1,106 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyInstanceAutoRenewalAttribute invokes the rds.ModifyInstanceAutoRenewalAttribute API synchronously -func (client *Client) ModifyInstanceAutoRenewalAttribute(request *ModifyInstanceAutoRenewalAttributeRequest) (response *ModifyInstanceAutoRenewalAttributeResponse, err error) { - response = CreateModifyInstanceAutoRenewalAttributeResponse() - err = client.DoAction(request, response) - return -} - -// ModifyInstanceAutoRenewalAttributeWithChan invokes the rds.ModifyInstanceAutoRenewalAttribute API asynchronously -func (client *Client) ModifyInstanceAutoRenewalAttributeWithChan(request *ModifyInstanceAutoRenewalAttributeRequest) (<-chan *ModifyInstanceAutoRenewalAttributeResponse, <-chan error) { - responseChan := make(chan *ModifyInstanceAutoRenewalAttributeResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyInstanceAutoRenewalAttribute(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyInstanceAutoRenewalAttributeWithCallback invokes the rds.ModifyInstanceAutoRenewalAttribute API asynchronously -func (client *Client) ModifyInstanceAutoRenewalAttributeWithCallback(request *ModifyInstanceAutoRenewalAttributeRequest, callback func(response *ModifyInstanceAutoRenewalAttributeResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyInstanceAutoRenewalAttributeResponse - var err error - defer close(result) - response, err = client.ModifyInstanceAutoRenewalAttribute(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyInstanceAutoRenewalAttributeRequest is the request struct for api ModifyInstanceAutoRenewalAttribute -type ModifyInstanceAutoRenewalAttributeRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ClientToken string `position:"Query" name:"ClientToken"` - Duration string `position:"Query" name:"Duration"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - AutoRenew string `position:"Query" name:"AutoRenew"` -} - -// ModifyInstanceAutoRenewalAttributeResponse is the response struct for api ModifyInstanceAutoRenewalAttribute -type ModifyInstanceAutoRenewalAttributeResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateModifyInstanceAutoRenewalAttributeRequest creates a request to invoke ModifyInstanceAutoRenewalAttribute API -func CreateModifyInstanceAutoRenewalAttributeRequest() (request *ModifyInstanceAutoRenewalAttributeRequest) { - request = &ModifyInstanceAutoRenewalAttributeRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyInstanceAutoRenewalAttribute", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyInstanceAutoRenewalAttributeResponse creates a response to parse from ModifyInstanceAutoRenewalAttribute response -func CreateModifyInstanceAutoRenewalAttributeResponse() (response *ModifyInstanceAutoRenewalAttributeResponse) { - response = &ModifyInstanceAutoRenewalAttributeResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_instance_cross_backup_policy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_instance_cross_backup_policy.go deleted file mode 100644 index e9b5a2a011d..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_instance_cross_backup_policy.go +++ /dev/null @@ -1,123 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyInstanceCrossBackupPolicy invokes the rds.ModifyInstanceCrossBackupPolicy API synchronously -func (client *Client) ModifyInstanceCrossBackupPolicy(request *ModifyInstanceCrossBackupPolicyRequest) (response *ModifyInstanceCrossBackupPolicyResponse, err error) { - response = CreateModifyInstanceCrossBackupPolicyResponse() - err = client.DoAction(request, response) - return -} - -// ModifyInstanceCrossBackupPolicyWithChan invokes the rds.ModifyInstanceCrossBackupPolicy API asynchronously -func (client *Client) ModifyInstanceCrossBackupPolicyWithChan(request *ModifyInstanceCrossBackupPolicyRequest) (<-chan *ModifyInstanceCrossBackupPolicyResponse, <-chan error) { - responseChan := make(chan *ModifyInstanceCrossBackupPolicyResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyInstanceCrossBackupPolicy(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyInstanceCrossBackupPolicyWithCallback invokes the rds.ModifyInstanceCrossBackupPolicy API asynchronously -func (client *Client) ModifyInstanceCrossBackupPolicyWithCallback(request *ModifyInstanceCrossBackupPolicyRequest, callback func(response *ModifyInstanceCrossBackupPolicyResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyInstanceCrossBackupPolicyResponse - var err error - defer close(result) - response, err = client.ModifyInstanceCrossBackupPolicy(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyInstanceCrossBackupPolicyRequest is the request struct for api ModifyInstanceCrossBackupPolicy -type ModifyInstanceCrossBackupPolicyRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - RetentType requests.Integer `position:"Query" name:"RetentType"` - BackupEnabled string `position:"Query" name:"BackupEnabled"` - RelService string `position:"Query" name:"RelService"` - StorageType string `position:"Query" name:"StorageType"` - Endpoint string `position:"Query" name:"Endpoint"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - Retention requests.Integer `position:"Query" name:"Retention"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - CrossBackupType string `position:"Query" name:"CrossBackupType"` - LogBackupEnabled string `position:"Query" name:"LogBackupEnabled"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - CrossBackupRegion string `position:"Query" name:"CrossBackupRegion"` - StorageOwner string `position:"Query" name:"StorageOwner"` -} - -// ModifyInstanceCrossBackupPolicyResponse is the response struct for api ModifyInstanceCrossBackupPolicy -type ModifyInstanceCrossBackupPolicyResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - RegionId string `json:"RegionId" xml:"RegionId"` - CrossBackupRegion string `json:"CrossBackupRegion" xml:"CrossBackupRegion"` - CrossBackupType string `json:"CrossBackupType" xml:"CrossBackupType"` - BackupEnabled string `json:"BackupEnabled" xml:"BackupEnabled"` - LogBackupEnabled string `json:"LogBackupEnabled" xml:"LogBackupEnabled"` - StorageOwner string `json:"StorageOwner" xml:"StorageOwner"` - StorageType string `json:"StorageType" xml:"StorageType"` - Endpoint string `json:"Endpoint" xml:"Endpoint"` - RetentType int `json:"RetentType" xml:"RetentType"` - Retention int `json:"Retention" xml:"Retention"` -} - -// CreateModifyInstanceCrossBackupPolicyRequest creates a request to invoke ModifyInstanceCrossBackupPolicy API -func CreateModifyInstanceCrossBackupPolicyRequest() (request *ModifyInstanceCrossBackupPolicyRequest) { - request = &ModifyInstanceCrossBackupPolicyRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyInstanceCrossBackupPolicy", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyInstanceCrossBackupPolicyResponse creates a response to parse from ModifyInstanceCrossBackupPolicy response -func CreateModifyInstanceCrossBackupPolicyResponse() (response *ModifyInstanceCrossBackupPolicyResponse) { - response = &ModifyInstanceCrossBackupPolicyResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_parameter.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_parameter.go deleted file mode 100644 index c30134fb75b..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_parameter.go +++ /dev/null @@ -1,107 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyParameter invokes the rds.ModifyParameter API synchronously -func (client *Client) ModifyParameter(request *ModifyParameterRequest) (response *ModifyParameterResponse, err error) { - response = CreateModifyParameterResponse() - err = client.DoAction(request, response) - return -} - -// ModifyParameterWithChan invokes the rds.ModifyParameter API asynchronously -func (client *Client) ModifyParameterWithChan(request *ModifyParameterRequest) (<-chan *ModifyParameterResponse, <-chan error) { - responseChan := make(chan *ModifyParameterResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyParameter(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyParameterWithCallback invokes the rds.ModifyParameter API asynchronously -func (client *Client) ModifyParameterWithCallback(request *ModifyParameterRequest, callback func(response *ModifyParameterResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyParameterResponse - var err error - defer close(result) - response, err = client.ModifyParameter(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyParameterRequest is the request struct for api ModifyParameter -type ModifyParameterRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ClientToken string `position:"Query" name:"ClientToken"` - ParameterGroupId string `position:"Query" name:"ParameterGroupId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - Forcerestart requests.Boolean `position:"Query" name:"Forcerestart"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - Parameters string `position:"Query" name:"Parameters"` -} - -// ModifyParameterResponse is the response struct for api ModifyParameter -type ModifyParameterResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateModifyParameterRequest creates a request to invoke ModifyParameter API -func CreateModifyParameterRequest() (request *ModifyParameterRequest) { - request = &ModifyParameterRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyParameter", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyParameterResponse creates a response to parse from ModifyParameter response -func CreateModifyParameterResponse() (response *ModifyParameterResponse) { - response = &ModifyParameterResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_parameter_group.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_parameter_group.go deleted file mode 100644 index 6889c3980a5..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_parameter_group.go +++ /dev/null @@ -1,106 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyParameterGroup invokes the rds.ModifyParameterGroup API synchronously -func (client *Client) ModifyParameterGroup(request *ModifyParameterGroupRequest) (response *ModifyParameterGroupResponse, err error) { - response = CreateModifyParameterGroupResponse() - err = client.DoAction(request, response) - return -} - -// ModifyParameterGroupWithChan invokes the rds.ModifyParameterGroup API asynchronously -func (client *Client) ModifyParameterGroupWithChan(request *ModifyParameterGroupRequest) (<-chan *ModifyParameterGroupResponse, <-chan error) { - responseChan := make(chan *ModifyParameterGroupResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyParameterGroup(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyParameterGroupWithCallback invokes the rds.ModifyParameterGroup API asynchronously -func (client *Client) ModifyParameterGroupWithCallback(request *ModifyParameterGroupRequest, callback func(response *ModifyParameterGroupResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyParameterGroupResponse - var err error - defer close(result) - response, err = client.ModifyParameterGroup(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyParameterGroupRequest is the request struct for api ModifyParameterGroup -type ModifyParameterGroupRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ParameterGroupId string `position:"Query" name:"ParameterGroupId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - ParameterGroupName string `position:"Query" name:"ParameterGroupName"` - Parameters string `position:"Query" name:"Parameters"` - ParameterGroupDesc string `position:"Query" name:"ParameterGroupDesc"` -} - -// ModifyParameterGroupResponse is the response struct for api ModifyParameterGroup -type ModifyParameterGroupResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - ParameterGroupId string `json:"ParameterGroupId" xml:"ParameterGroupId"` -} - -// CreateModifyParameterGroupRequest creates a request to invoke ModifyParameterGroup API -func CreateModifyParameterGroupRequest() (request *ModifyParameterGroupRequest) { - request = &ModifyParameterGroupRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyParameterGroup", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyParameterGroupResponse creates a response to parse from ModifyParameterGroup response -func CreateModifyParameterGroupResponse() (response *ModifyParameterGroupResponse) { - response = &ModifyParameterGroupResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_read_write_splitting_connection.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_read_write_splitting_connection.go deleted file mode 100644 index fc41eefc79e..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_read_write_splitting_connection.go +++ /dev/null @@ -1,108 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyReadWriteSplittingConnection invokes the rds.ModifyReadWriteSplittingConnection API synchronously -func (client *Client) ModifyReadWriteSplittingConnection(request *ModifyReadWriteSplittingConnectionRequest) (response *ModifyReadWriteSplittingConnectionResponse, err error) { - response = CreateModifyReadWriteSplittingConnectionResponse() - err = client.DoAction(request, response) - return -} - -// ModifyReadWriteSplittingConnectionWithChan invokes the rds.ModifyReadWriteSplittingConnection API asynchronously -func (client *Client) ModifyReadWriteSplittingConnectionWithChan(request *ModifyReadWriteSplittingConnectionRequest) (<-chan *ModifyReadWriteSplittingConnectionResponse, <-chan error) { - responseChan := make(chan *ModifyReadWriteSplittingConnectionResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyReadWriteSplittingConnection(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyReadWriteSplittingConnectionWithCallback invokes the rds.ModifyReadWriteSplittingConnection API asynchronously -func (client *Client) ModifyReadWriteSplittingConnectionWithCallback(request *ModifyReadWriteSplittingConnectionRequest, callback func(response *ModifyReadWriteSplittingConnectionResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyReadWriteSplittingConnectionResponse - var err error - defer close(result) - response, err = client.ModifyReadWriteSplittingConnection(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyReadWriteSplittingConnectionRequest is the request struct for api ModifyReadWriteSplittingConnection -type ModifyReadWriteSplittingConnectionRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ConnectionStringPrefix string `position:"Query" name:"ConnectionStringPrefix"` - DistributionType string `position:"Query" name:"DistributionType"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - Weight string `position:"Query" name:"Weight"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - Port string `position:"Query" name:"Port"` - MaxDelayTime string `position:"Query" name:"MaxDelayTime"` -} - -// ModifyReadWriteSplittingConnectionResponse is the response struct for api ModifyReadWriteSplittingConnection -type ModifyReadWriteSplittingConnectionResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateModifyReadWriteSplittingConnectionRequest creates a request to invoke ModifyReadWriteSplittingConnection API -func CreateModifyReadWriteSplittingConnectionRequest() (request *ModifyReadWriteSplittingConnectionRequest) { - request = &ModifyReadWriteSplittingConnectionRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyReadWriteSplittingConnection", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyReadWriteSplittingConnectionResponse creates a response to parse from ModifyReadWriteSplittingConnection response -func CreateModifyReadWriteSplittingConnectionResponse() (response *ModifyReadWriteSplittingConnectionResponse) { - response = &ModifyReadWriteSplittingConnectionResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_readonly_instance_delay_replication_time.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_readonly_instance_delay_replication_time.go deleted file mode 100644 index 159242de0a3..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_readonly_instance_delay_replication_time.go +++ /dev/null @@ -1,106 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyReadonlyInstanceDelayReplicationTime invokes the rds.ModifyReadonlyInstanceDelayReplicationTime API synchronously -func (client *Client) ModifyReadonlyInstanceDelayReplicationTime(request *ModifyReadonlyInstanceDelayReplicationTimeRequest) (response *ModifyReadonlyInstanceDelayReplicationTimeResponse, err error) { - response = CreateModifyReadonlyInstanceDelayReplicationTimeResponse() - err = client.DoAction(request, response) - return -} - -// ModifyReadonlyInstanceDelayReplicationTimeWithChan invokes the rds.ModifyReadonlyInstanceDelayReplicationTime API asynchronously -func (client *Client) ModifyReadonlyInstanceDelayReplicationTimeWithChan(request *ModifyReadonlyInstanceDelayReplicationTimeRequest) (<-chan *ModifyReadonlyInstanceDelayReplicationTimeResponse, <-chan error) { - responseChan := make(chan *ModifyReadonlyInstanceDelayReplicationTimeResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyReadonlyInstanceDelayReplicationTime(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyReadonlyInstanceDelayReplicationTimeWithCallback invokes the rds.ModifyReadonlyInstanceDelayReplicationTime API asynchronously -func (client *Client) ModifyReadonlyInstanceDelayReplicationTimeWithCallback(request *ModifyReadonlyInstanceDelayReplicationTimeRequest, callback func(response *ModifyReadonlyInstanceDelayReplicationTimeResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyReadonlyInstanceDelayReplicationTimeResponse - var err error - defer close(result) - response, err = client.ModifyReadonlyInstanceDelayReplicationTime(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyReadonlyInstanceDelayReplicationTimeRequest is the request struct for api ModifyReadonlyInstanceDelayReplicationTime -type ModifyReadonlyInstanceDelayReplicationTimeRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - ReadSQLReplicationTime string `position:"Query" name:"ReadSQLReplicationTime"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// ModifyReadonlyInstanceDelayReplicationTimeResponse is the response struct for api ModifyReadonlyInstanceDelayReplicationTime -type ModifyReadonlyInstanceDelayReplicationTimeResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - ReadSQLReplicationTime string `json:"ReadSQLReplicationTime" xml:"ReadSQLReplicationTime"` - TaskId string `json:"TaskId" xml:"TaskId"` -} - -// CreateModifyReadonlyInstanceDelayReplicationTimeRequest creates a request to invoke ModifyReadonlyInstanceDelayReplicationTime API -func CreateModifyReadonlyInstanceDelayReplicationTimeRequest() (request *ModifyReadonlyInstanceDelayReplicationTimeRequest) { - request = &ModifyReadonlyInstanceDelayReplicationTimeRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifyReadonlyInstanceDelayReplicationTime", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyReadonlyInstanceDelayReplicationTimeResponse creates a response to parse from ModifyReadonlyInstanceDelayReplicationTime response -func CreateModifyReadonlyInstanceDelayReplicationTimeResponse() (response *ModifyReadonlyInstanceDelayReplicationTimeResponse) { - response = &ModifyReadonlyInstanceDelayReplicationTimeResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_security_group_configuration.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_security_group_configuration.go deleted file mode 100644 index 0adbf191e58..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_security_group_configuration.go +++ /dev/null @@ -1,105 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifySecurityGroupConfiguration invokes the rds.ModifySecurityGroupConfiguration API synchronously -func (client *Client) ModifySecurityGroupConfiguration(request *ModifySecurityGroupConfigurationRequest) (response *ModifySecurityGroupConfigurationResponse, err error) { - response = CreateModifySecurityGroupConfigurationResponse() - err = client.DoAction(request, response) - return -} - -// ModifySecurityGroupConfigurationWithChan invokes the rds.ModifySecurityGroupConfiguration API asynchronously -func (client *Client) ModifySecurityGroupConfigurationWithChan(request *ModifySecurityGroupConfigurationRequest) (<-chan *ModifySecurityGroupConfigurationResponse, <-chan error) { - responseChan := make(chan *ModifySecurityGroupConfigurationResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifySecurityGroupConfiguration(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifySecurityGroupConfigurationWithCallback invokes the rds.ModifySecurityGroupConfiguration API asynchronously -func (client *Client) ModifySecurityGroupConfigurationWithCallback(request *ModifySecurityGroupConfigurationRequest, callback func(response *ModifySecurityGroupConfigurationResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifySecurityGroupConfigurationResponse - var err error - defer close(result) - response, err = client.ModifySecurityGroupConfiguration(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifySecurityGroupConfigurationRequest is the request struct for api ModifySecurityGroupConfiguration -type ModifySecurityGroupConfigurationRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - SecurityGroupId string `position:"Query" name:"SecurityGroupId"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// ModifySecurityGroupConfigurationResponse is the response struct for api ModifySecurityGroupConfiguration -type ModifySecurityGroupConfigurationResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceName string `json:"DBInstanceName" xml:"DBInstanceName"` - Items ItemsInModifySecurityGroupConfiguration `json:"Items" xml:"Items"` -} - -// CreateModifySecurityGroupConfigurationRequest creates a request to invoke ModifySecurityGroupConfiguration API -func CreateModifySecurityGroupConfigurationRequest() (request *ModifySecurityGroupConfigurationRequest) { - request = &ModifySecurityGroupConfigurationRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifySecurityGroupConfiguration", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifySecurityGroupConfigurationResponse creates a response to parse from ModifySecurityGroupConfiguration response -func CreateModifySecurityGroupConfigurationResponse() (response *ModifySecurityGroupConfigurationResponse) { - response = &ModifySecurityGroupConfigurationResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_security_ips.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_security_ips.go deleted file mode 100644 index 7319d97254b..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_security_ips.go +++ /dev/null @@ -1,112 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifySecurityIps invokes the rds.ModifySecurityIps API synchronously -func (client *Client) ModifySecurityIps(request *ModifySecurityIpsRequest) (response *ModifySecurityIpsResponse, err error) { - response = CreateModifySecurityIpsResponse() - err = client.DoAction(request, response) - return -} - -// ModifySecurityIpsWithChan invokes the rds.ModifySecurityIps API asynchronously -func (client *Client) ModifySecurityIpsWithChan(request *ModifySecurityIpsRequest) (<-chan *ModifySecurityIpsResponse, <-chan error) { - responseChan := make(chan *ModifySecurityIpsResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifySecurityIps(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifySecurityIpsWithCallback invokes the rds.ModifySecurityIps API asynchronously -func (client *Client) ModifySecurityIpsWithCallback(request *ModifySecurityIpsRequest, callback func(response *ModifySecurityIpsResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifySecurityIpsResponse - var err error - defer close(result) - response, err = client.ModifySecurityIps(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifySecurityIpsRequest is the request struct for api ModifySecurityIps -type ModifySecurityIpsRequest struct { - *requests.RpcRequest - DBInstanceIPArrayName string `position:"Query" name:"DBInstanceIPArrayName"` - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ClientToken string `position:"Query" name:"ClientToken"` - SecurityIps string `position:"Query" name:"SecurityIps"` - SecurityGroupId string `position:"Query" name:"SecurityGroupId"` - WhitelistNetworkType string `position:"Query" name:"WhitelistNetworkType"` - SecurityIPType string `position:"Query" name:"SecurityIPType"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ModifyMode string `position:"Query" name:"ModifyMode"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceIPArrayAttribute string `position:"Query" name:"DBInstanceIPArrayAttribute"` -} - -// ModifySecurityIpsResponse is the response struct for api ModifySecurityIps -type ModifySecurityIpsResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - TaskId string `json:"TaskId" xml:"TaskId"` -} - -// CreateModifySecurityIpsRequest creates a request to invoke ModifySecurityIps API -func CreateModifySecurityIpsRequest() (request *ModifySecurityIpsRequest) { - request = &ModifySecurityIpsRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifySecurityIps", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifySecurityIpsResponse creates a response to parse from ModifySecurityIps response -func CreateModifySecurityIpsResponse() (response *ModifySecurityIpsResponse) { - response = &ModifySecurityIpsResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_sql_collector_policy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_sql_collector_policy.go deleted file mode 100644 index e3551be7a29..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_sql_collector_policy.go +++ /dev/null @@ -1,107 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifySQLCollectorPolicy invokes the rds.ModifySQLCollectorPolicy API synchronously -func (client *Client) ModifySQLCollectorPolicy(request *ModifySQLCollectorPolicyRequest) (response *ModifySQLCollectorPolicyResponse, err error) { - response = CreateModifySQLCollectorPolicyResponse() - err = client.DoAction(request, response) - return -} - -// ModifySQLCollectorPolicyWithChan invokes the rds.ModifySQLCollectorPolicy API asynchronously -func (client *Client) ModifySQLCollectorPolicyWithChan(request *ModifySQLCollectorPolicyRequest) (<-chan *ModifySQLCollectorPolicyResponse, <-chan error) { - responseChan := make(chan *ModifySQLCollectorPolicyResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifySQLCollectorPolicy(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifySQLCollectorPolicyWithCallback invokes the rds.ModifySQLCollectorPolicy API asynchronously -func (client *Client) ModifySQLCollectorPolicyWithCallback(request *ModifySQLCollectorPolicyRequest, callback func(response *ModifySQLCollectorPolicyResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifySQLCollectorPolicyResponse - var err error - defer close(result) - response, err = client.ModifySQLCollectorPolicy(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifySQLCollectorPolicyRequest is the request struct for api ModifySQLCollectorPolicy -type ModifySQLCollectorPolicyRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - StoragePeriod requests.Integer `position:"Query" name:"StoragePeriod"` - ClientToken string `position:"Query" name:"ClientToken"` - ResourceGroupId string `position:"Query" name:"ResourceGroupId"` - SQLCollectorStatus string `position:"Query" name:"SQLCollectorStatus"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// ModifySQLCollectorPolicyResponse is the response struct for api ModifySQLCollectorPolicy -type ModifySQLCollectorPolicyResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateModifySQLCollectorPolicyRequest creates a request to invoke ModifySQLCollectorPolicy API -func CreateModifySQLCollectorPolicyRequest() (request *ModifySQLCollectorPolicyRequest) { - request = &ModifySQLCollectorPolicyRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifySQLCollectorPolicy", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifySQLCollectorPolicyResponse creates a response to parse from ModifySQLCollectorPolicy response -func CreateModifySQLCollectorPolicyResponse() (response *ModifySQLCollectorPolicyResponse) { - response = &ModifySQLCollectorPolicyResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_sql_collector_retention.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_sql_collector_retention.go deleted file mode 100644 index 33eb7e5c3fd..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/modify_sql_collector_retention.go +++ /dev/null @@ -1,106 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifySQLCollectorRetention invokes the rds.ModifySQLCollectorRetention API synchronously -func (client *Client) ModifySQLCollectorRetention(request *ModifySQLCollectorRetentionRequest) (response *ModifySQLCollectorRetentionResponse, err error) { - response = CreateModifySQLCollectorRetentionResponse() - err = client.DoAction(request, response) - return -} - -// ModifySQLCollectorRetentionWithChan invokes the rds.ModifySQLCollectorRetention API asynchronously -func (client *Client) ModifySQLCollectorRetentionWithChan(request *ModifySQLCollectorRetentionRequest) (<-chan *ModifySQLCollectorRetentionResponse, <-chan error) { - responseChan := make(chan *ModifySQLCollectorRetentionResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifySQLCollectorRetention(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifySQLCollectorRetentionWithCallback invokes the rds.ModifySQLCollectorRetention API asynchronously -func (client *Client) ModifySQLCollectorRetentionWithCallback(request *ModifySQLCollectorRetentionRequest, callback func(response *ModifySQLCollectorRetentionResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifySQLCollectorRetentionResponse - var err error - defer close(result) - response, err = client.ModifySQLCollectorRetention(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifySQLCollectorRetentionRequest is the request struct for api ModifySQLCollectorRetention -type ModifySQLCollectorRetentionRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceGroupId string `position:"Query" name:"ResourceGroupId"` - SecurityToken string `position:"Query" name:"SecurityToken"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - ConfigValue string `position:"Query" name:"ConfigValue"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// ModifySQLCollectorRetentionResponse is the response struct for api ModifySQLCollectorRetention -type ModifySQLCollectorRetentionResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateModifySQLCollectorRetentionRequest creates a request to invoke ModifySQLCollectorRetention API -func CreateModifySQLCollectorRetentionRequest() (request *ModifySQLCollectorRetentionRequest) { - request = &ModifySQLCollectorRetentionRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ModifySQLCollectorRetention", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifySQLCollectorRetentionResponse creates a response to parse from ModifySQLCollectorRetention response -func CreateModifySQLCollectorRetentionResponse() (response *ModifySQLCollectorRetentionResponse) { - response = &ModifySQLCollectorRetentionResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/purge_db_instance_log.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/purge_db_instance_log.go deleted file mode 100644 index 71f27e49dca..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/purge_db_instance_log.go +++ /dev/null @@ -1,104 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// PurgeDBInstanceLog invokes the rds.PurgeDBInstanceLog API synchronously -func (client *Client) PurgeDBInstanceLog(request *PurgeDBInstanceLogRequest) (response *PurgeDBInstanceLogResponse, err error) { - response = CreatePurgeDBInstanceLogResponse() - err = client.DoAction(request, response) - return -} - -// PurgeDBInstanceLogWithChan invokes the rds.PurgeDBInstanceLog API asynchronously -func (client *Client) PurgeDBInstanceLogWithChan(request *PurgeDBInstanceLogRequest) (<-chan *PurgeDBInstanceLogResponse, <-chan error) { - responseChan := make(chan *PurgeDBInstanceLogResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.PurgeDBInstanceLog(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// PurgeDBInstanceLogWithCallback invokes the rds.PurgeDBInstanceLog API asynchronously -func (client *Client) PurgeDBInstanceLogWithCallback(request *PurgeDBInstanceLogRequest, callback func(response *PurgeDBInstanceLogResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *PurgeDBInstanceLogResponse - var err error - defer close(result) - response, err = client.PurgeDBInstanceLog(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// PurgeDBInstanceLogRequest is the request struct for api PurgeDBInstanceLog -type PurgeDBInstanceLogRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - ClientToken string `position:"Query" name:"ClientToken"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// PurgeDBInstanceLogResponse is the response struct for api PurgeDBInstanceLog -type PurgeDBInstanceLogResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreatePurgeDBInstanceLogRequest creates a request to invoke PurgeDBInstanceLog API -func CreatePurgeDBInstanceLogRequest() (request *PurgeDBInstanceLogRequest) { - request = &PurgeDBInstanceLogRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "PurgeDBInstanceLog", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreatePurgeDBInstanceLogResponse creates a response to parse from PurgeDBInstanceLog response -func CreatePurgeDBInstanceLogResponse() (response *PurgeDBInstanceLogResponse) { - response = &PurgeDBInstanceLogResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/rebuild_db_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/rebuild_db_instance.go deleted file mode 100644 index 554491b6f92..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/rebuild_db_instance.go +++ /dev/null @@ -1,107 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// RebuildDBInstance invokes the rds.RebuildDBInstance API synchronously -func (client *Client) RebuildDBInstance(request *RebuildDBInstanceRequest) (response *RebuildDBInstanceResponse, err error) { - response = CreateRebuildDBInstanceResponse() - err = client.DoAction(request, response) - return -} - -// RebuildDBInstanceWithChan invokes the rds.RebuildDBInstance API asynchronously -func (client *Client) RebuildDBInstanceWithChan(request *RebuildDBInstanceRequest) (<-chan *RebuildDBInstanceResponse, <-chan error) { - responseChan := make(chan *RebuildDBInstanceResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.RebuildDBInstance(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// RebuildDBInstanceWithCallback invokes the rds.RebuildDBInstance API asynchronously -func (client *Client) RebuildDBInstanceWithCallback(request *RebuildDBInstanceRequest, callback func(response *RebuildDBInstanceResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *RebuildDBInstanceResponse - var err error - defer close(result) - response, err = client.RebuildDBInstance(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// RebuildDBInstanceRequest is the request struct for api RebuildDBInstance -type RebuildDBInstanceRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - RebuildNodeType string `position:"Query" name:"RebuildNodeType"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - DedicatedHostGroupId string `position:"Query" name:"DedicatedHostGroupId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - DedicatedHostId string `position:"Query" name:"DedicatedHostId"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// RebuildDBInstanceResponse is the response struct for api RebuildDBInstance -type RebuildDBInstanceResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - TaskId int `json:"TaskId" xml:"TaskId"` - MigrationId int `json:"MigrationId" xml:"MigrationId"` -} - -// CreateRebuildDBInstanceRequest creates a request to invoke RebuildDBInstance API -func CreateRebuildDBInstanceRequest() (request *RebuildDBInstanceRequest) { - request = &RebuildDBInstanceRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "RebuildDBInstance", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateRebuildDBInstanceResponse creates a response to parse from RebuildDBInstance response -func CreateRebuildDBInstanceResponse() (response *RebuildDBInstanceResponse) { - response = &RebuildDBInstanceResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/recovery_db_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/recovery_db_instance.go deleted file mode 100644 index f477a7dbf6c..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/recovery_db_instance.go +++ /dev/null @@ -1,122 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// RecoveryDBInstance invokes the rds.RecoveryDBInstance API synchronously -func (client *Client) RecoveryDBInstance(request *RecoveryDBInstanceRequest) (response *RecoveryDBInstanceResponse, err error) { - response = CreateRecoveryDBInstanceResponse() - err = client.DoAction(request, response) - return -} - -// RecoveryDBInstanceWithChan invokes the rds.RecoveryDBInstance API asynchronously -func (client *Client) RecoveryDBInstanceWithChan(request *RecoveryDBInstanceRequest) (<-chan *RecoveryDBInstanceResponse, <-chan error) { - responseChan := make(chan *RecoveryDBInstanceResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.RecoveryDBInstance(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// RecoveryDBInstanceWithCallback invokes the rds.RecoveryDBInstance API asynchronously -func (client *Client) RecoveryDBInstanceWithCallback(request *RecoveryDBInstanceRequest, callback func(response *RecoveryDBInstanceResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *RecoveryDBInstanceResponse - var err error - defer close(result) - response, err = client.RecoveryDBInstance(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// RecoveryDBInstanceRequest is the request struct for api RecoveryDBInstance -type RecoveryDBInstanceRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - DBInstanceStorage requests.Integer `position:"Query" name:"DBInstanceStorage"` - ClientToken string `position:"Query" name:"ClientToken"` - ResourceGroupId string `position:"Query" name:"ResourceGroupId"` - DBInstanceDescription string `position:"Query" name:"DBInstanceDescription"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - DBInstanceStorageType string `position:"Query" name:"DBInstanceStorageType"` - RestoreTime string `position:"Query" name:"RestoreTime"` - Period string `position:"Query" name:"Period"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - BackupId string `position:"Query" name:"BackupId"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - UsedTime string `position:"Query" name:"UsedTime"` - DBInstanceClass string `position:"Query" name:"DBInstanceClass"` - DbNames string `position:"Query" name:"DbNames"` - VSwitchId string `position:"Query" name:"VSwitchId"` - PrivateIpAddress string `position:"Query" name:"PrivateIpAddress"` - TargetDBInstanceId string `position:"Query" name:"TargetDBInstanceId"` - VPCId string `position:"Query" name:"VPCId"` - PayType string `position:"Query" name:"PayType"` - InstanceNetworkType string `position:"Query" name:"InstanceNetworkType"` -} - -// RecoveryDBInstanceResponse is the response struct for api RecoveryDBInstance -type RecoveryDBInstanceResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - OrderId string `json:"OrderId" xml:"OrderId"` -} - -// CreateRecoveryDBInstanceRequest creates a request to invoke RecoveryDBInstance API -func CreateRecoveryDBInstanceRequest() (request *RecoveryDBInstanceRequest) { - request = &RecoveryDBInstanceRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "RecoveryDBInstance", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateRecoveryDBInstanceResponse creates a response to parse from RecoveryDBInstance response -func CreateRecoveryDBInstanceResponse() (response *RecoveryDBInstanceResponse) { - response = &RecoveryDBInstanceResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/release_instance_connection.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/release_instance_connection.go deleted file mode 100644 index a02e1545e53..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/release_instance_connection.go +++ /dev/null @@ -1,105 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ReleaseInstanceConnection invokes the rds.ReleaseInstanceConnection API synchronously -func (client *Client) ReleaseInstanceConnection(request *ReleaseInstanceConnectionRequest) (response *ReleaseInstanceConnectionResponse, err error) { - response = CreateReleaseInstanceConnectionResponse() - err = client.DoAction(request, response) - return -} - -// ReleaseInstanceConnectionWithChan invokes the rds.ReleaseInstanceConnection API asynchronously -func (client *Client) ReleaseInstanceConnectionWithChan(request *ReleaseInstanceConnectionRequest) (<-chan *ReleaseInstanceConnectionResponse, <-chan error) { - responseChan := make(chan *ReleaseInstanceConnectionResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ReleaseInstanceConnection(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ReleaseInstanceConnectionWithCallback invokes the rds.ReleaseInstanceConnection API asynchronously -func (client *Client) ReleaseInstanceConnectionWithCallback(request *ReleaseInstanceConnectionRequest, callback func(response *ReleaseInstanceConnectionResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ReleaseInstanceConnectionResponse - var err error - defer close(result) - response, err = client.ReleaseInstanceConnection(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ReleaseInstanceConnectionRequest is the request struct for api ReleaseInstanceConnection -type ReleaseInstanceConnectionRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - CurrentConnectionString string `position:"Query" name:"CurrentConnectionString"` - InstanceNetworkType string `position:"Query" name:"InstanceNetworkType"` -} - -// ReleaseInstanceConnectionResponse is the response struct for api ReleaseInstanceConnection -type ReleaseInstanceConnectionResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateReleaseInstanceConnectionRequest creates a request to invoke ReleaseInstanceConnection API -func CreateReleaseInstanceConnectionRequest() (request *ReleaseInstanceConnectionRequest) { - request = &ReleaseInstanceConnectionRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ReleaseInstanceConnection", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateReleaseInstanceConnectionResponse creates a response to parse from ReleaseInstanceConnection response -func CreateReleaseInstanceConnectionResponse() (response *ReleaseInstanceConnectionResponse) { - response = &ReleaseInstanceConnectionResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/release_instance_public_connection.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/release_instance_public_connection.go deleted file mode 100644 index a20f9360289..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/release_instance_public_connection.go +++ /dev/null @@ -1,104 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ReleaseInstancePublicConnection invokes the rds.ReleaseInstancePublicConnection API synchronously -func (client *Client) ReleaseInstancePublicConnection(request *ReleaseInstancePublicConnectionRequest) (response *ReleaseInstancePublicConnectionResponse, err error) { - response = CreateReleaseInstancePublicConnectionResponse() - err = client.DoAction(request, response) - return -} - -// ReleaseInstancePublicConnectionWithChan invokes the rds.ReleaseInstancePublicConnection API asynchronously -func (client *Client) ReleaseInstancePublicConnectionWithChan(request *ReleaseInstancePublicConnectionRequest) (<-chan *ReleaseInstancePublicConnectionResponse, <-chan error) { - responseChan := make(chan *ReleaseInstancePublicConnectionResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ReleaseInstancePublicConnection(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ReleaseInstancePublicConnectionWithCallback invokes the rds.ReleaseInstancePublicConnection API asynchronously -func (client *Client) ReleaseInstancePublicConnectionWithCallback(request *ReleaseInstancePublicConnectionRequest, callback func(response *ReleaseInstancePublicConnectionResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ReleaseInstancePublicConnectionResponse - var err error - defer close(result) - response, err = client.ReleaseInstancePublicConnection(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ReleaseInstancePublicConnectionRequest is the request struct for api ReleaseInstancePublicConnection -type ReleaseInstancePublicConnectionRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - CurrentConnectionString string `position:"Query" name:"CurrentConnectionString"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// ReleaseInstancePublicConnectionResponse is the response struct for api ReleaseInstancePublicConnection -type ReleaseInstancePublicConnectionResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateReleaseInstancePublicConnectionRequest creates a request to invoke ReleaseInstancePublicConnection API -func CreateReleaseInstancePublicConnectionRequest() (request *ReleaseInstancePublicConnectionRequest) { - request = &ReleaseInstancePublicConnectionRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ReleaseInstancePublicConnection", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateReleaseInstancePublicConnectionResponse creates a response to parse from ReleaseInstancePublicConnection response -func CreateReleaseInstancePublicConnectionResponse() (response *ReleaseInstancePublicConnectionResponse) { - response = &ReleaseInstancePublicConnectionResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/release_read_write_splitting_connection.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/release_read_write_splitting_connection.go deleted file mode 100644 index dd2e894d8a8..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/release_read_write_splitting_connection.go +++ /dev/null @@ -1,103 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ReleaseReadWriteSplittingConnection invokes the rds.ReleaseReadWriteSplittingConnection API synchronously -func (client *Client) ReleaseReadWriteSplittingConnection(request *ReleaseReadWriteSplittingConnectionRequest) (response *ReleaseReadWriteSplittingConnectionResponse, err error) { - response = CreateReleaseReadWriteSplittingConnectionResponse() - err = client.DoAction(request, response) - return -} - -// ReleaseReadWriteSplittingConnectionWithChan invokes the rds.ReleaseReadWriteSplittingConnection API asynchronously -func (client *Client) ReleaseReadWriteSplittingConnectionWithChan(request *ReleaseReadWriteSplittingConnectionRequest) (<-chan *ReleaseReadWriteSplittingConnectionResponse, <-chan error) { - responseChan := make(chan *ReleaseReadWriteSplittingConnectionResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ReleaseReadWriteSplittingConnection(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ReleaseReadWriteSplittingConnectionWithCallback invokes the rds.ReleaseReadWriteSplittingConnection API asynchronously -func (client *Client) ReleaseReadWriteSplittingConnectionWithCallback(request *ReleaseReadWriteSplittingConnectionRequest, callback func(response *ReleaseReadWriteSplittingConnectionResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ReleaseReadWriteSplittingConnectionResponse - var err error - defer close(result) - response, err = client.ReleaseReadWriteSplittingConnection(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ReleaseReadWriteSplittingConnectionRequest is the request struct for api ReleaseReadWriteSplittingConnection -type ReleaseReadWriteSplittingConnectionRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// ReleaseReadWriteSplittingConnectionResponse is the response struct for api ReleaseReadWriteSplittingConnection -type ReleaseReadWriteSplittingConnectionResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateReleaseReadWriteSplittingConnectionRequest creates a request to invoke ReleaseReadWriteSplittingConnection API -func CreateReleaseReadWriteSplittingConnectionRequest() (request *ReleaseReadWriteSplittingConnectionRequest) { - request = &ReleaseReadWriteSplittingConnectionRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ReleaseReadWriteSplittingConnection", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateReleaseReadWriteSplittingConnectionResponse creates a response to parse from ReleaseReadWriteSplittingConnection response -func CreateReleaseReadWriteSplittingConnectionResponse() (response *ReleaseReadWriteSplittingConnectionResponse) { - response = &ReleaseReadWriteSplittingConnectionResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/remove_tags_from_resource.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/remove_tags_from_resource.go deleted file mode 100644 index a5243c14f91..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/remove_tags_from_resource.go +++ /dev/null @@ -1,116 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// RemoveTagsFromResource invokes the rds.RemoveTagsFromResource API synchronously -func (client *Client) RemoveTagsFromResource(request *RemoveTagsFromResourceRequest) (response *RemoveTagsFromResourceResponse, err error) { - response = CreateRemoveTagsFromResourceResponse() - err = client.DoAction(request, response) - return -} - -// RemoveTagsFromResourceWithChan invokes the rds.RemoveTagsFromResource API asynchronously -func (client *Client) RemoveTagsFromResourceWithChan(request *RemoveTagsFromResourceRequest) (<-chan *RemoveTagsFromResourceResponse, <-chan error) { - responseChan := make(chan *RemoveTagsFromResourceResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.RemoveTagsFromResource(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// RemoveTagsFromResourceWithCallback invokes the rds.RemoveTagsFromResource API asynchronously -func (client *Client) RemoveTagsFromResourceWithCallback(request *RemoveTagsFromResourceRequest, callback func(response *RemoveTagsFromResourceResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *RemoveTagsFromResourceResponse - var err error - defer close(result) - response, err = client.RemoveTagsFromResource(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// RemoveTagsFromResourceRequest is the request struct for api RemoveTagsFromResource -type RemoveTagsFromResourceRequest struct { - *requests.RpcRequest - Tag4Value string `position:"Query" name:"Tag.4.value"` - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - Tag2Key string `position:"Query" name:"Tag.2.key"` - ClientToken string `position:"Query" name:"ClientToken"` - Tag3Key string `position:"Query" name:"Tag.3.key"` - Tag1Value string `position:"Query" name:"Tag.1.value"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - Tag3Value string `position:"Query" name:"Tag.3.value"` - ProxyId string `position:"Query" name:"proxyId"` - Tag5Key string `position:"Query" name:"Tag.5.key"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - Tag5Value string `position:"Query" name:"Tag.5.value"` - Tags string `position:"Query" name:"Tags"` - Tag1Key string `position:"Query" name:"Tag.1.key"` - Tag2Value string `position:"Query" name:"Tag.2.value"` - Tag4Key string `position:"Query" name:"Tag.4.key"` -} - -// RemoveTagsFromResourceResponse is the response struct for api RemoveTagsFromResource -type RemoveTagsFromResourceResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateRemoveTagsFromResourceRequest creates a request to invoke RemoveTagsFromResource API -func CreateRemoveTagsFromResourceRequest() (request *RemoveTagsFromResourceRequest) { - request = &RemoveTagsFromResourceRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "RemoveTagsFromResource", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateRemoveTagsFromResourceResponse creates a response to parse from RemoveTagsFromResource response -func CreateRemoveTagsFromResourceResponse() (response *RemoveTagsFromResourceResponse) { - response = &RemoveTagsFromResourceResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/renew_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/renew_instance.go deleted file mode 100644 index cf538b7e60f..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/renew_instance.go +++ /dev/null @@ -1,107 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// RenewInstance invokes the rds.RenewInstance API synchronously -func (client *Client) RenewInstance(request *RenewInstanceRequest) (response *RenewInstanceResponse, err error) { - response = CreateRenewInstanceResponse() - err = client.DoAction(request, response) - return -} - -// RenewInstanceWithChan invokes the rds.RenewInstance API asynchronously -func (client *Client) RenewInstanceWithChan(request *RenewInstanceRequest) (<-chan *RenewInstanceResponse, <-chan error) { - responseChan := make(chan *RenewInstanceResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.RenewInstance(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// RenewInstanceWithCallback invokes the rds.RenewInstance API asynchronously -func (client *Client) RenewInstanceWithCallback(request *RenewInstanceRequest, callback func(response *RenewInstanceResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *RenewInstanceResponse - var err error - defer close(result) - response, err = client.RenewInstance(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// RenewInstanceRequest is the request struct for api RenewInstance -type RenewInstanceRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ClientToken string `position:"Query" name:"ClientToken"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - BusinessInfo string `position:"Query" name:"BusinessInfo"` - Period requests.Integer `position:"Query" name:"Period"` - AutoPay string `position:"Query" name:"AutoPay"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// RenewInstanceResponse is the response struct for api RenewInstance -type RenewInstanceResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - OrderId int64 `json:"OrderId" xml:"OrderId"` -} - -// CreateRenewInstanceRequest creates a request to invoke RenewInstance API -func CreateRenewInstanceRequest() (request *RenewInstanceRequest) { - request = &RenewInstanceRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "RenewInstance", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateRenewInstanceResponse creates a response to parse from RenewInstance response -func CreateRenewInstanceResponse() (response *RenewInstanceResponse) { - response = &RenewInstanceResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/reset_account.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/reset_account.go deleted file mode 100644 index 1bb9ecdfafd..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/reset_account.go +++ /dev/null @@ -1,105 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ResetAccount invokes the rds.ResetAccount API synchronously -func (client *Client) ResetAccount(request *ResetAccountRequest) (response *ResetAccountResponse, err error) { - response = CreateResetAccountResponse() - err = client.DoAction(request, response) - return -} - -// ResetAccountWithChan invokes the rds.ResetAccount API asynchronously -func (client *Client) ResetAccountWithChan(request *ResetAccountRequest) (<-chan *ResetAccountResponse, <-chan error) { - responseChan := make(chan *ResetAccountResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ResetAccount(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ResetAccountWithCallback invokes the rds.ResetAccount API asynchronously -func (client *Client) ResetAccountWithCallback(request *ResetAccountRequest, callback func(response *ResetAccountResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ResetAccountResponse - var err error - defer close(result) - response, err = client.ResetAccount(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ResetAccountRequest is the request struct for api ResetAccount -type ResetAccountRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - AccountName string `position:"Query" name:"AccountName"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - AccountPassword string `position:"Query" name:"AccountPassword"` -} - -// ResetAccountResponse is the response struct for api ResetAccount -type ResetAccountResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateResetAccountRequest creates a request to invoke ResetAccount API -func CreateResetAccountRequest() (request *ResetAccountRequest) { - request = &ResetAccountRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ResetAccount", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateResetAccountResponse creates a response to parse from ResetAccount response -func CreateResetAccountResponse() (response *ResetAccountResponse) { - response = &ResetAccountResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/reset_account_password.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/reset_account_password.go deleted file mode 100644 index 596cb9e4353..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/reset_account_password.go +++ /dev/null @@ -1,105 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ResetAccountPassword invokes the rds.ResetAccountPassword API synchronously -func (client *Client) ResetAccountPassword(request *ResetAccountPasswordRequest) (response *ResetAccountPasswordResponse, err error) { - response = CreateResetAccountPasswordResponse() - err = client.DoAction(request, response) - return -} - -// ResetAccountPasswordWithChan invokes the rds.ResetAccountPassword API asynchronously -func (client *Client) ResetAccountPasswordWithChan(request *ResetAccountPasswordRequest) (<-chan *ResetAccountPasswordResponse, <-chan error) { - responseChan := make(chan *ResetAccountPasswordResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ResetAccountPassword(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ResetAccountPasswordWithCallback invokes the rds.ResetAccountPassword API asynchronously -func (client *Client) ResetAccountPasswordWithCallback(request *ResetAccountPasswordRequest, callback func(response *ResetAccountPasswordResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ResetAccountPasswordResponse - var err error - defer close(result) - response, err = client.ResetAccountPassword(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ResetAccountPasswordRequest is the request struct for api ResetAccountPassword -type ResetAccountPasswordRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - AccountName string `position:"Query" name:"AccountName"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - AccountPassword string `position:"Query" name:"AccountPassword"` -} - -// ResetAccountPasswordResponse is the response struct for api ResetAccountPassword -type ResetAccountPasswordResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateResetAccountPasswordRequest creates a request to invoke ResetAccountPassword API -func CreateResetAccountPasswordRequest() (request *ResetAccountPasswordRequest) { - request = &ResetAccountPasswordRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "ResetAccountPassword", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateResetAccountPasswordResponse creates a response to parse from ResetAccountPassword response -func CreateResetAccountPasswordResponse() (response *ResetAccountPasswordResponse) { - response = &ResetAccountPasswordResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/restart_db_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/restart_db_instance.go deleted file mode 100644 index e54e24d924d..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/restart_db_instance.go +++ /dev/null @@ -1,107 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// RestartDBInstance invokes the rds.RestartDBInstance API synchronously -func (client *Client) RestartDBInstance(request *RestartDBInstanceRequest) (response *RestartDBInstanceResponse, err error) { - response = CreateRestartDBInstanceResponse() - err = client.DoAction(request, response) - return -} - -// RestartDBInstanceWithChan invokes the rds.RestartDBInstance API asynchronously -func (client *Client) RestartDBInstanceWithChan(request *RestartDBInstanceRequest) (<-chan *RestartDBInstanceResponse, <-chan error) { - responseChan := make(chan *RestartDBInstanceResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.RestartDBInstance(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// RestartDBInstanceWithCallback invokes the rds.RestartDBInstance API asynchronously -func (client *Client) RestartDBInstanceWithCallback(request *RestartDBInstanceRequest, callback func(response *RestartDBInstanceResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *RestartDBInstanceResponse - var err error - defer close(result) - response, err = client.RestartDBInstance(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// RestartDBInstanceRequest is the request struct for api RestartDBInstance -type RestartDBInstanceRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ClientToken string `position:"Query" name:"ClientToken"` - RestartMethod string `position:"Query" name:"RestartMethod"` - EffectiveTime string `position:"Query" name:"EffectiveTime"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - SwitchTime string `position:"Query" name:"SwitchTime"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// RestartDBInstanceResponse is the response struct for api RestartDBInstance -type RestartDBInstanceResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateRestartDBInstanceRequest creates a request to invoke RestartDBInstance API -func CreateRestartDBInstanceRequest() (request *RestartDBInstanceRequest) { - request = &RestartDBInstanceRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "RestartDBInstance", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateRestartDBInstanceResponse creates a response to parse from RestartDBInstance response -func CreateRestartDBInstanceResponse() (response *RestartDBInstanceResponse) { - response = &RestartDBInstanceResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/restore_ddr_table.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/restore_ddr_table.go deleted file mode 100644 index 6bcb3356bb0..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/restore_ddr_table.go +++ /dev/null @@ -1,113 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// RestoreDdrTable invokes the rds.RestoreDdrTable API synchronously -func (client *Client) RestoreDdrTable(request *RestoreDdrTableRequest) (response *RestoreDdrTableResponse, err error) { - response = CreateRestoreDdrTableResponse() - err = client.DoAction(request, response) - return -} - -// RestoreDdrTableWithChan invokes the rds.RestoreDdrTable API asynchronously -func (client *Client) RestoreDdrTableWithChan(request *RestoreDdrTableRequest) (<-chan *RestoreDdrTableResponse, <-chan error) { - responseChan := make(chan *RestoreDdrTableResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.RestoreDdrTable(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// RestoreDdrTableWithCallback invokes the rds.RestoreDdrTable API asynchronously -func (client *Client) RestoreDdrTableWithCallback(request *RestoreDdrTableRequest, callback func(response *RestoreDdrTableResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *RestoreDdrTableResponse - var err error - defer close(result) - response, err = client.RestoreDdrTable(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// RestoreDdrTableRequest is the request struct for api RestoreDdrTable -type RestoreDdrTableRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - SourceDBInstanceName string `position:"Query" name:"SourceDBInstanceName"` - ClientToken string `position:"Query" name:"ClientToken"` - UserBakSetURL string `position:"Query" name:"UserBakSetURL"` - TableMeta string `position:"Query" name:"TableMeta"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - BackupSetRegion string `position:"Query" name:"BackupSetRegion"` - BackupSetType string `position:"Query" name:"BackupSetType"` - RestoreTime string `position:"Query" name:"RestoreTime"` - BakSetName string `position:"Query" name:"BakSetName"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - BackupId string `position:"Query" name:"BackupId"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - RestoreType string `position:"Query" name:"RestoreType"` - SourceRegion string `position:"Query" name:"SourceRegion"` -} - -// RestoreDdrTableResponse is the response struct for api RestoreDdrTable -type RestoreDdrTableResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateRestoreDdrTableRequest creates a request to invoke RestoreDdrTable API -func CreateRestoreDdrTableRequest() (request *RestoreDdrTableRequest) { - request = &RestoreDdrTableRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "RestoreDdrTable", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateRestoreDdrTableResponse creates a response to parse from RestoreDdrTable response -func CreateRestoreDdrTableResponse() (response *RestoreDdrTableResponse) { - response = &RestoreDdrTableResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/restore_table.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/restore_table.go deleted file mode 100644 index 12777b9f05e..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/restore_table.go +++ /dev/null @@ -1,108 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// RestoreTable invokes the rds.RestoreTable API synchronously -func (client *Client) RestoreTable(request *RestoreTableRequest) (response *RestoreTableResponse, err error) { - response = CreateRestoreTableResponse() - err = client.DoAction(request, response) - return -} - -// RestoreTableWithChan invokes the rds.RestoreTable API asynchronously -func (client *Client) RestoreTableWithChan(request *RestoreTableRequest) (<-chan *RestoreTableResponse, <-chan error) { - responseChan := make(chan *RestoreTableResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.RestoreTable(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// RestoreTableWithCallback invokes the rds.RestoreTable API asynchronously -func (client *Client) RestoreTableWithCallback(request *RestoreTableRequest, callback func(response *RestoreTableResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *RestoreTableResponse - var err error - defer close(result) - response, err = client.RestoreTable(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// RestoreTableRequest is the request struct for api RestoreTable -type RestoreTableRequest struct { - *requests.RpcRequest - RestoreTableMode string `position:"Query" name:"RestoreTableMode"` - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ClientToken string `position:"Query" name:"ClientToken"` - TableMeta string `position:"Query" name:"TableMeta"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - RestoreTime string `position:"Query" name:"RestoreTime"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - BackupId string `position:"Query" name:"BackupId"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// RestoreTableResponse is the response struct for api RestoreTable -type RestoreTableResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateRestoreTableRequest creates a request to invoke RestoreTable API -func CreateRestoreTableRequest() (request *RestoreTableRequest) { - request = &RestoreTableRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "RestoreTable", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateRestoreTableResponse creates a response to parse from RestoreTable response -func CreateRestoreTableResponse() (response *RestoreTableResponse) { - response = &RestoreTableResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/revoke_account_privilege.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/revoke_account_privilege.go deleted file mode 100644 index a2098842727..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/revoke_account_privilege.go +++ /dev/null @@ -1,105 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// RevokeAccountPrivilege invokes the rds.RevokeAccountPrivilege API synchronously -func (client *Client) RevokeAccountPrivilege(request *RevokeAccountPrivilegeRequest) (response *RevokeAccountPrivilegeResponse, err error) { - response = CreateRevokeAccountPrivilegeResponse() - err = client.DoAction(request, response) - return -} - -// RevokeAccountPrivilegeWithChan invokes the rds.RevokeAccountPrivilege API asynchronously -func (client *Client) RevokeAccountPrivilegeWithChan(request *RevokeAccountPrivilegeRequest) (<-chan *RevokeAccountPrivilegeResponse, <-chan error) { - responseChan := make(chan *RevokeAccountPrivilegeResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.RevokeAccountPrivilege(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// RevokeAccountPrivilegeWithCallback invokes the rds.RevokeAccountPrivilege API asynchronously -func (client *Client) RevokeAccountPrivilegeWithCallback(request *RevokeAccountPrivilegeRequest, callback func(response *RevokeAccountPrivilegeResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *RevokeAccountPrivilegeResponse - var err error - defer close(result) - response, err = client.RevokeAccountPrivilege(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// RevokeAccountPrivilegeRequest is the request struct for api RevokeAccountPrivilege -type RevokeAccountPrivilegeRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - AccountName string `position:"Query" name:"AccountName"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBName string `position:"Query" name:"DBName"` -} - -// RevokeAccountPrivilegeResponse is the response struct for api RevokeAccountPrivilege -type RevokeAccountPrivilegeResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateRevokeAccountPrivilegeRequest creates a request to invoke RevokeAccountPrivilege API -func CreateRevokeAccountPrivilegeRequest() (request *RevokeAccountPrivilegeRequest) { - request = &RevokeAccountPrivilegeRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "RevokeAccountPrivilege", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateRevokeAccountPrivilegeResponse creates a response to parse from RevokeAccountPrivilege response -func CreateRevokeAccountPrivilegeResponse() (response *RevokeAccountPrivilegeResponse) { - response = &RevokeAccountPrivilegeResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/revoke_operator_permission.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/revoke_operator_permission.go deleted file mode 100644 index 761df68f9c4..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/revoke_operator_permission.go +++ /dev/null @@ -1,103 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// RevokeOperatorPermission invokes the rds.RevokeOperatorPermission API synchronously -func (client *Client) RevokeOperatorPermission(request *RevokeOperatorPermissionRequest) (response *RevokeOperatorPermissionResponse, err error) { - response = CreateRevokeOperatorPermissionResponse() - err = client.DoAction(request, response) - return -} - -// RevokeOperatorPermissionWithChan invokes the rds.RevokeOperatorPermission API asynchronously -func (client *Client) RevokeOperatorPermissionWithChan(request *RevokeOperatorPermissionRequest) (<-chan *RevokeOperatorPermissionResponse, <-chan error) { - responseChan := make(chan *RevokeOperatorPermissionResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.RevokeOperatorPermission(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// RevokeOperatorPermissionWithCallback invokes the rds.RevokeOperatorPermission API asynchronously -func (client *Client) RevokeOperatorPermissionWithCallback(request *RevokeOperatorPermissionRequest, callback func(response *RevokeOperatorPermissionResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *RevokeOperatorPermissionResponse - var err error - defer close(result) - response, err = client.RevokeOperatorPermission(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// RevokeOperatorPermissionRequest is the request struct for api RevokeOperatorPermission -type RevokeOperatorPermissionRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// RevokeOperatorPermissionResponse is the response struct for api RevokeOperatorPermission -type RevokeOperatorPermissionResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateRevokeOperatorPermissionRequest creates a request to invoke RevokeOperatorPermission API -func CreateRevokeOperatorPermissionRequest() (request *RevokeOperatorPermissionRequest) { - request = &RevokeOperatorPermissionRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "RevokeOperatorPermission", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateRevokeOperatorPermissionResponse creates a response to parse from RevokeOperatorPermission response -func CreateRevokeOperatorPermissionResponse() (response *RevokeOperatorPermissionResponse) { - response = &RevokeOperatorPermissionResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/start_db_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/start_db_instance.go deleted file mode 100644 index 898e65656f6..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/start_db_instance.go +++ /dev/null @@ -1,116 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// StartDBInstance invokes the rds.StartDBInstance API synchronously -func (client *Client) StartDBInstance(request *StartDBInstanceRequest) (response *StartDBInstanceResponse, err error) { - response = CreateStartDBInstanceResponse() - err = client.DoAction(request, response) - return -} - -// StartDBInstanceWithChan invokes the rds.StartDBInstance API asynchronously -func (client *Client) StartDBInstanceWithChan(request *StartDBInstanceRequest) (<-chan *StartDBInstanceResponse, <-chan error) { - responseChan := make(chan *StartDBInstanceResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.StartDBInstance(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// StartDBInstanceWithCallback invokes the rds.StartDBInstance API asynchronously -func (client *Client) StartDBInstanceWithCallback(request *StartDBInstanceRequest, callback func(response *StartDBInstanceResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *StartDBInstanceResponse - var err error - defer close(result) - response, err = client.StartDBInstance(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// StartDBInstanceRequest is the request struct for api StartDBInstance -type StartDBInstanceRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - SpecifiedTime string `position:"Query" name:"SpecifiedTime"` - TargetDedicatedHostIdForSlave string `position:"Query" name:"TargetDedicatedHostIdForSlave"` - EngineVersion string `position:"Query" name:"EngineVersion"` - Storage requests.Integer `position:"Query" name:"Storage"` - EffectiveTime string `position:"Query" name:"EffectiveTime"` - DBInstanceTransType requests.Integer `position:"Query" name:"DBInstanceTransType"` - TargetDedicatedHostIdForMaster string `position:"Query" name:"TargetDedicatedHostIdForMaster"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - DedicatedHostGroupId string `position:"Query" name:"DedicatedHostGroupId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - TargetDBInstanceClass string `position:"Query" name:"TargetDBInstanceClass"` - VSwitchId string `position:"Query" name:"VSwitchId"` - TargetDedicatedHostIdForLog string `position:"Query" name:"TargetDedicatedHostIdForLog"` - ZoneId string `position:"Query" name:"ZoneId"` -} - -// StartDBInstanceResponse is the response struct for api StartDBInstance -type StartDBInstanceResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - TaskId int `json:"TaskId" xml:"TaskId"` - MigrationId int `json:"MigrationId" xml:"MigrationId"` -} - -// CreateStartDBInstanceRequest creates a request to invoke StartDBInstance API -func CreateStartDBInstanceRequest() (request *StartDBInstanceRequest) { - request = &StartDBInstanceRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "StartDBInstance", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateStartDBInstanceResponse creates a response to parse from StartDBInstance response -func CreateStartDBInstanceResponse() (response *StartDBInstanceResponse) { - response = &StartDBInstanceResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/stop_db_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/stop_db_instance.go deleted file mode 100644 index 8f15d226106..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/stop_db_instance.go +++ /dev/null @@ -1,102 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// StopDBInstance invokes the rds.StopDBInstance API synchronously -func (client *Client) StopDBInstance(request *StopDBInstanceRequest) (response *StopDBInstanceResponse, err error) { - response = CreateStopDBInstanceResponse() - err = client.DoAction(request, response) - return -} - -// StopDBInstanceWithChan invokes the rds.StopDBInstance API asynchronously -func (client *Client) StopDBInstanceWithChan(request *StopDBInstanceRequest) (<-chan *StopDBInstanceResponse, <-chan error) { - responseChan := make(chan *StopDBInstanceResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.StopDBInstance(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// StopDBInstanceWithCallback invokes the rds.StopDBInstance API asynchronously -func (client *Client) StopDBInstanceWithCallback(request *StopDBInstanceRequest, callback func(response *StopDBInstanceResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *StopDBInstanceResponse - var err error - defer close(result) - response, err = client.StopDBInstance(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// StopDBInstanceRequest is the request struct for api StopDBInstance -type StopDBInstanceRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// StopDBInstanceResponse is the response struct for api StopDBInstance -type StopDBInstanceResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateStopDBInstanceRequest creates a request to invoke StopDBInstance API -func CreateStopDBInstanceRequest() (request *StopDBInstanceRequest) { - request = &StopDBInstanceRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "StopDBInstance", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateStopDBInstanceResponse creates a response to parse from StopDBInstance response -func CreateStopDBInstanceResponse() (response *StopDBInstanceResponse) { - response = &StopDBInstanceResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_account_privilege_info.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_account_privilege_info.go deleted file mode 100644 index 2daf1066230..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_account_privilege_info.go +++ /dev/null @@ -1,23 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AccountPrivilegeInfo is a nested struct in rds response -type AccountPrivilegeInfo struct { - Account string `json:"Account" xml:"Account"` - AccountPrivilege string `json:"AccountPrivilege" xml:"AccountPrivilege"` - AccountPrivilegeDetail string `json:"AccountPrivilegeDetail" xml:"AccountPrivilegeDetail"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_accounts_in_describe_accounts.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_accounts_in_describe_accounts.go deleted file mode 100644 index d1a76147aa7..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_accounts_in_describe_accounts.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AccountsInDescribeAccounts is a nested struct in rds response -type AccountsInDescribeAccounts struct { - DBInstanceAccount []DBInstanceAccount `json:"DBInstanceAccount" xml:"DBInstanceAccount"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_accounts_in_describe_databases.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_accounts_in_describe_databases.go deleted file mode 100644 index 06f72d57154..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_accounts_in_describe_databases.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AccountsInDescribeDatabases is a nested struct in rds response -type AccountsInDescribeDatabases struct { - AccountPrivilegeInfo []AccountPrivilegeInfo `json:"AccountPrivilegeInfo" xml:"AccountPrivilegeInfo"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_activity_info.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_activity_info.go deleted file mode 100644 index 2f10701da6e..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_activity_info.go +++ /dev/null @@ -1,23 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ActivityInfo is a nested struct in rds response -type ActivityInfo struct { - Success string `json:"Success" xml:"Success"` - CheckErrMsg string `json:"CheckErrMsg" xml:"CheckErrMsg"` - ErrorCode string `json:"ErrorCode" xml:"ErrorCode"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_available_resource.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_available_resource.go deleted file mode 100644 index cd0d2f73621..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_available_resource.go +++ /dev/null @@ -1,23 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AvailableResource is a nested struct in rds response -type AvailableResource struct { - DBInstanceClass string `json:"DBInstanceClass" xml:"DBInstanceClass"` - StorageRange string `json:"StorageRange" xml:"StorageRange"` - DBInstanceStorageRange DBInstanceStorageRange `json:"DBInstanceStorageRange" xml:"DBInstanceStorageRange"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_available_resources.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_available_resources.go deleted file mode 100644 index 6c5d769bad4..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_available_resources.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AvailableResources is a nested struct in rds response -type AvailableResources struct { - AvailableResource []AvailableResource `json:"AvailableResource" xml:"AvailableResource"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_available_zone.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_available_zone.go deleted file mode 100644 index 19056035016..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_available_zone.go +++ /dev/null @@ -1,25 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AvailableZone is a nested struct in rds response -type AvailableZone struct { - RegionId string `json:"RegionId" xml:"RegionId"` - ZoneId string `json:"ZoneId" xml:"ZoneId"` - Status string `json:"Status" xml:"Status"` - NetworkTypes string `json:"NetworkTypes" xml:"NetworkTypes"` - SupportedEngines SupportedEnginesInDescribeAvailableResource `json:"SupportedEngines" xml:"SupportedEngines"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_available_zone_in_describe_available_resource.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_available_zone_in_describe_available_resource.go deleted file mode 100644 index 0ec766bb913..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_available_zone_in_describe_available_resource.go +++ /dev/null @@ -1,25 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AvailableZoneInDescribeAvailableResource is a nested struct in rds response -type AvailableZoneInDescribeAvailableResource struct { - NetworkTypes string `json:"NetworkTypes" xml:"NetworkTypes"` - RegionId string `json:"RegionId" xml:"RegionId"` - Status string `json:"Status" xml:"Status"` - ZoneId string `json:"ZoneId" xml:"ZoneId"` - SupportedEngines SupportedEnginesInDescribeAvailableResource `json:"SupportedEngines" xml:"SupportedEngines"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_available_zones_in_describe_available_resource.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_available_zones_in_describe_available_resource.go deleted file mode 100644 index 6a1053f2002..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_available_zones_in_describe_available_resource.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AvailableZonesInDescribeAvailableResource is a nested struct in rds response -type AvailableZonesInDescribeAvailableResource struct { - AvailableZone []AvailableZoneInDescribeAvailableResource `json:"AvailableZone" xml:"AvailableZone"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_available_zones_in_describe_available_zones.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_available_zones_in_describe_available_zones.go deleted file mode 100644 index f9506c162b9..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_available_zones_in_describe_available_zones.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AvailableZonesInDescribeAvailableZones is a nested struct in rds response -type AvailableZonesInDescribeAvailableZones struct { - AvailableZone []AvailableZone `json:"AvailableZone" xml:"AvailableZone"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_backup.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_backup.go deleted file mode 100644 index b4e44f5cfe1..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_backup.go +++ /dev/null @@ -1,46 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// Backup is a nested struct in rds response -type Backup struct { - MetaStatus string `json:"MetaStatus" xml:"MetaStatus"` - HostInstanceID string `json:"HostInstanceID" xml:"HostInstanceID"` - CopyOnlyBackup string `json:"CopyOnlyBackup" xml:"CopyOnlyBackup"` - BackupMode string `json:"BackupMode" xml:"BackupMode"` - IsAvail int `json:"IsAvail" xml:"IsAvail"` - BackupDBNames string `json:"BackupDBNames" xml:"BackupDBNames"` - StorageClass string `json:"StorageClass" xml:"StorageClass"` - Encryption string `json:"Encryption" xml:"Encryption"` - BackupSize int64 `json:"BackupSize" xml:"BackupSize"` - BackupStartTime string `json:"BackupStartTime" xml:"BackupStartTime"` - ConsistentTime int64 `json:"ConsistentTime" xml:"ConsistentTime"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - BackupScale string `json:"BackupScale" xml:"BackupScale"` - BackupDownloadURL string `json:"BackupDownloadURL" xml:"BackupDownloadURL"` - SlaveStatus string `json:"SlaveStatus" xml:"SlaveStatus"` - BackupExtractionStatus string `json:"BackupExtractionStatus" xml:"BackupExtractionStatus"` - BackupIntranetDownloadURL string `json:"BackupIntranetDownloadURL" xml:"BackupIntranetDownloadURL"` - BackupEndTime string `json:"BackupEndTime" xml:"BackupEndTime"` - BackupMethod string `json:"BackupMethod" xml:"BackupMethod"` - BackupType string `json:"BackupType" xml:"BackupType"` - TotalBackupSize int64 `json:"TotalBackupSize" xml:"TotalBackupSize"` - BackupInitiator string `json:"BackupInitiator" xml:"BackupInitiator"` - BackupStatus string `json:"BackupStatus" xml:"BackupStatus"` - StoreStatus string `json:"StoreStatus" xml:"StoreStatus"` - BackupId string `json:"BackupId" xml:"BackupId"` - BackupLocation string `json:"BackupLocation" xml:"BackupLocation"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_backup_job.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_backup_job.go deleted file mode 100644 index 11615936851..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_backup_job.go +++ /dev/null @@ -1,27 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// BackupJob is a nested struct in rds response -type BackupJob struct { - BackupProgressStatus string `json:"BackupProgressStatus" xml:"BackupProgressStatus"` - BackupStatus string `json:"BackupStatus" xml:"BackupStatus"` - JobMode string `json:"JobMode" xml:"JobMode"` - Process string `json:"Process" xml:"Process"` - TaskAction string `json:"TaskAction" xml:"TaskAction"` - BackupJobId string `json:"BackupJobId" xml:"BackupJobId"` - BackupId string `json:"BackupId" xml:"BackupId"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_bin_log_file.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_bin_log_file.go deleted file mode 100644 index a606b873de3..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_bin_log_file.go +++ /dev/null @@ -1,30 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// BinLogFile is a nested struct in rds response -type BinLogFile struct { - RemoteStatus string `json:"RemoteStatus" xml:"RemoteStatus"` - HostInstanceID string `json:"HostInstanceID" xml:"HostInstanceID"` - LogEndTime string `json:"LogEndTime" xml:"LogEndTime"` - IntranetDownloadLink string `json:"IntranetDownloadLink" xml:"IntranetDownloadLink"` - FileSize int64 `json:"FileSize" xml:"FileSize"` - Checksum string `json:"Checksum" xml:"Checksum"` - LinkExpiredTime string `json:"LinkExpiredTime" xml:"LinkExpiredTime"` - LogFileName string `json:"LogFileName" xml:"LogFileName"` - DownloadLink string `json:"DownloadLink" xml:"DownloadLink"` - LogBeginTime string `json:"LogBeginTime" xml:"LogBeginTime"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_character_set_name_items.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_character_set_name_items.go deleted file mode 100644 index 1a95e5622a8..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_character_set_name_items.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// CharacterSetNameItems is a nested struct in rds response -type CharacterSetNameItems struct { - CharacterSetName []string `json:"CharacterSetName" xml:"CharacterSetName"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_collation_time_zone.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_collation_time_zone.go deleted file mode 100644 index 0f8c6fe27d3..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_collation_time_zone.go +++ /dev/null @@ -1,23 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// CollationTimeZone is a nested struct in rds response -type CollationTimeZone struct { - TimeZone string `json:"TimeZone" xml:"TimeZone"` - StandardTimeOffset string `json:"StandardTimeOffset" xml:"StandardTimeOffset"` - Description string `json:"Description" xml:"Description"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_collation_time_zones.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_collation_time_zones.go deleted file mode 100644 index 406fa1766ae..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_collation_time_zones.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// CollationTimeZones is a nested struct in rds response -type CollationTimeZones struct { - CollationTimeZone []CollationTimeZone `json:"CollationTimeZone" xml:"CollationTimeZone"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_config_parameters.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_config_parameters.go deleted file mode 100644 index 49158cce22a..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_config_parameters.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ConfigParameters is a nested struct in rds response -type ConfigParameters struct { - DBInstanceParameter []DBInstanceParameter `json:"DBInstanceParameter" xml:"DBInstanceParameter"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_coupon.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_coupon.go deleted file mode 100644 index daff42be38b..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_coupon.go +++ /dev/null @@ -1,24 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// Coupon is a nested struct in rds response -type Coupon struct { - Name string `json:"Name" xml:"Name"` - CouponNo string `json:"CouponNo" xml:"CouponNo"` - IsSelected string `json:"IsSelected" xml:"IsSelected"` - Description string `json:"Description" xml:"Description"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_coupons_in_describe_price.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_coupons_in_describe_price.go deleted file mode 100644 index 45dc8e7b579..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_coupons_in_describe_price.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// CouponsInDescribePrice is a nested struct in rds response -type CouponsInDescribePrice struct { - Coupon []Coupon `json:"Coupon" xml:"Coupon"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_coupons_in_describe_renewal_price.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_coupons_in_describe_renewal_price.go deleted file mode 100644 index 1a64e4513e2..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_coupons_in_describe_renewal_price.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// CouponsInDescribeRenewalPrice is a nested struct in rds response -type CouponsInDescribeRenewalPrice struct { - Coupon []Coupon `json:"Coupon" xml:"Coupon"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_database.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_database.go deleted file mode 100644 index 3dd8c6a326d..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_database.go +++ /dev/null @@ -1,28 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// Database is a nested struct in rds response -type Database struct { - CharacterSetName string `json:"CharacterSetName" xml:"CharacterSetName"` - Engine string `json:"Engine" xml:"Engine"` - DBStatus string `json:"DBStatus" xml:"DBStatus"` - TDEStatus string `json:"TDEStatus" xml:"TDEStatus"` - DBName string `json:"DBName" xml:"DBName"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - DBDescription string `json:"DBDescription" xml:"DBDescription"` - Accounts AccountsInDescribeDatabases `json:"Accounts" xml:"Accounts"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_database_privilege.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_database_privilege.go deleted file mode 100644 index 280d8a03c75..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_database_privilege.go +++ /dev/null @@ -1,23 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DatabasePrivilege is a nested struct in rds response -type DatabasePrivilege struct { - DBName string `json:"DBName" xml:"DBName"` - AccountPrivilege string `json:"AccountPrivilege" xml:"AccountPrivilege"` - AccountPrivilegeDetail string `json:"AccountPrivilegeDetail" xml:"AccountPrivilegeDetail"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_database_privileges.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_database_privileges.go deleted file mode 100644 index 66118f7d4c8..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_database_privileges.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DatabasePrivileges is a nested struct in rds response -type DatabasePrivileges struct { - DatabasePrivilege []DatabasePrivilege `json:"DatabasePrivilege" xml:"DatabasePrivilege"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_databases_in_describe_databases.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_databases_in_describe_databases.go deleted file mode 100644 index e8e8867b078..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_databases_in_describe_databases.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DatabasesInDescribeDatabases is a nested struct in rds response -type DatabasesInDescribeDatabases struct { - Database []Database `json:"Database" xml:"Database"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_databases_in_describe_db_instance_tde.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_databases_in_describe_db_instance_tde.go deleted file mode 100644 index 87bb0c6f0a4..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_databases_in_describe_db_instance_tde.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DatabasesInDescribeDBInstanceTDE is a nested struct in rds response -type DatabasesInDescribeDBInstanceTDE struct { - Database []Database `json:"Database" xml:"Database"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance.go deleted file mode 100644 index 2dcd19434fa..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance.go +++ /dev/null @@ -1,65 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DBInstance is a nested struct in rds response -type DBInstance struct { - Category string `json:"Category" xml:"Category"` - LockReason string `json:"LockReason" xml:"LockReason"` - InsId int `json:"InsId" xml:"InsId"` - GuardDBInstanceId string `json:"GuardDBInstanceId" xml:"GuardDBInstanceId"` - DBInstanceDescription string `json:"DBInstanceDescription" xml:"DBInstanceDescription"` - Engine string `json:"Engine" xml:"Engine"` - VpcName string `json:"VpcName" xml:"VpcName"` - CreateTime string `json:"CreateTime" xml:"CreateTime"` - DBInstanceNetType string `json:"DBInstanceNetType" xml:"DBInstanceNetType"` - DBInstanceClass string `json:"DBInstanceClass" xml:"DBInstanceClass"` - VpcCloudInstanceId string `json:"VpcCloudInstanceId" xml:"VpcCloudInstanceId"` - DestroyTime string `json:"DestroyTime" xml:"DestroyTime"` - DedicatedHostIdForMaster string `json:"DedicatedHostIdForMaster" xml:"DedicatedHostIdForMaster"` - DedicatedHostNameForLog string `json:"DedicatedHostNameForLog" xml:"DedicatedHostNameForLog"` - RegionId string `json:"RegionId" xml:"RegionId"` - InstanceNetworkType string `json:"InstanceNetworkType" xml:"InstanceNetworkType"` - ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` - DBInstanceType string `json:"DBInstanceType" xml:"DBInstanceType"` - ExpireTime string `json:"ExpireTime" xml:"ExpireTime"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - VpcId string `json:"VpcId" xml:"VpcId"` - DBInstanceStorageType string `json:"DBInstanceStorageType" xml:"DBInstanceStorageType"` - MutriORsignle bool `json:"MutriORsignle" xml:"MutriORsignle"` - DedicatedHostZoneIdForMaster string `json:"DedicatedHostZoneIdForMaster" xml:"DedicatedHostZoneIdForMaster"` - DedicatedHostGroupId string `json:"DedicatedHostGroupId" xml:"DedicatedHostGroupId"` - DedicatedHostIdForLog string `json:"DedicatedHostIdForLog" xml:"DedicatedHostIdForLog"` - DedicatedHostGroupName string `json:"DedicatedHostGroupName" xml:"DedicatedHostGroupName"` - EngineVersion string `json:"EngineVersion" xml:"EngineVersion"` - PayType string `json:"PayType" xml:"PayType"` - VSwitchId string `json:"VSwitchId" xml:"VSwitchId"` - MasterInstanceId string `json:"MasterInstanceId" xml:"MasterInstanceId"` - DedicatedHostZoneIdForSlave string `json:"DedicatedHostZoneIdForSlave" xml:"DedicatedHostZoneIdForSlave"` - TempDBInstanceId string `json:"TempDBInstanceId" xml:"TempDBInstanceId"` - DBInstanceStatus string `json:"DBInstanceStatus" xml:"DBInstanceStatus"` - ZoneId string `json:"ZoneId" xml:"ZoneId"` - ReplicateId string `json:"ReplicateId" xml:"ReplicateId"` - DedicatedHostNameForSlave string `json:"DedicatedHostNameForSlave" xml:"DedicatedHostNameForSlave"` - DedicatedHostZoneIdForLog string `json:"DedicatedHostZoneIdForLog" xml:"DedicatedHostZoneIdForLog"` - ConnectionString string `json:"ConnectionString" xml:"ConnectionString"` - ConnectionMode string `json:"ConnectionMode" xml:"ConnectionMode"` - DedicatedHostNameForMaster string `json:"DedicatedHostNameForMaster" xml:"DedicatedHostNameForMaster"` - AutoUpgradeMinorVersion string `json:"AutoUpgradeMinorVersion" xml:"AutoUpgradeMinorVersion"` - LockMode string `json:"LockMode" xml:"LockMode"` - DedicatedHostIdForSlave string `json:"DedicatedHostIdForSlave" xml:"DedicatedHostIdForSlave"` - ReadOnlyDBInstanceIds ReadOnlyDBInstanceIdsInDescribeDBInstances `json:"ReadOnlyDBInstanceIds" xml:"ReadOnlyDBInstanceIds"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_account.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_account.go deleted file mode 100644 index ac8f8435455..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_account.go +++ /dev/null @@ -1,27 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DBInstanceAccount is a nested struct in rds response -type DBInstanceAccount struct { - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - AccountName string `json:"AccountName" xml:"AccountName"` - AccountStatus string `json:"AccountStatus" xml:"AccountStatus"` - AccountType string `json:"AccountType" xml:"AccountType"` - AccountDescription string `json:"AccountDescription" xml:"AccountDescription"` - PrivExceeded string `json:"PrivExceeded" xml:"PrivExceeded"` - DatabasePrivileges DatabasePrivileges `json:"DatabasePrivileges" xml:"DatabasePrivileges"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_attribute.go deleted file mode 100644 index eaab119a782..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_attribute.go +++ /dev/null @@ -1,98 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DBInstanceAttribute is a nested struct in rds response -type DBInstanceAttribute struct { - TimeZone string `json:"TimeZone" xml:"TimeZone"` - Engine string `json:"Engine" xml:"Engine"` - TempUpgradeTimeStart string `json:"TempUpgradeTimeStart" xml:"TempUpgradeTimeStart"` - TempUpgradeRecoveryTime string `json:"TempUpgradeRecoveryTime" xml:"TempUpgradeRecoveryTime"` - TempUpgradeRecoveryMaxIOPS string `json:"TempUpgradeRecoveryMaxIOPS" xml:"TempUpgradeRecoveryMaxIOPS"` - DBInstanceDiskUsed string `json:"DBInstanceDiskUsed" xml:"DBInstanceDiskUsed"` - AdvancedFeatures string `json:"AdvancedFeatures" xml:"AdvancedFeatures"` - DBInstanceClass string `json:"DBInstanceClass" xml:"DBInstanceClass"` - VpcCloudInstanceId string `json:"VpcCloudInstanceId" xml:"VpcCloudInstanceId"` - DBInstanceNetType string `json:"DBInstanceNetType" xml:"DBInstanceNetType"` - DBMaxQuantity int `json:"DBMaxQuantity" xml:"DBMaxQuantity"` - DBInstanceCPU string `json:"DBInstanceCPU" xml:"DBInstanceCPU"` - MaxConnections int `json:"MaxConnections" xml:"MaxConnections"` - IncrementSourceDBInstanceId string `json:"IncrementSourceDBInstanceId" xml:"IncrementSourceDBInstanceId"` - InstanceNetworkType string `json:"InstanceNetworkType" xml:"InstanceNetworkType"` - MultipleTempUpgrade bool `json:"MultipleTempUpgrade" xml:"MultipleTempUpgrade"` - DBInstanceType string `json:"DBInstanceType" xml:"DBInstanceType"` - TempUpgradeRecoveryClass string `json:"TempUpgradeRecoveryClass" xml:"TempUpgradeRecoveryClass"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - DBInstanceMemory int64 `json:"DBInstanceMemory" xml:"DBInstanceMemory"` - VpcId string `json:"VpcId" xml:"VpcId"` - DBInstanceStorageType string `json:"DBInstanceStorageType" xml:"DBInstanceStorageType"` - SecurityIPList string `json:"SecurityIPList" xml:"SecurityIPList"` - LatestKernelVersion string `json:"LatestKernelVersion" xml:"LatestKernelVersion"` - SupportUpgradeAccountType string `json:"SupportUpgradeAccountType" xml:"SupportUpgradeAccountType"` - MaxIOPS int `json:"MaxIOPS" xml:"MaxIOPS"` - Tags string `json:"Tags" xml:"Tags"` - EngineVersion string `json:"EngineVersion" xml:"EngineVersion"` - MaintainTime string `json:"MaintainTime" xml:"MaintainTime"` - PayType string `json:"PayType" xml:"PayType"` - DBInstanceStorage int `json:"DBInstanceStorage" xml:"DBInstanceStorage"` - SupportCreateSuperAccount string `json:"SupportCreateSuperAccount" xml:"SupportCreateSuperAccount"` - TempDBInstanceId string `json:"TempDBInstanceId" xml:"TempDBInstanceId"` - CurrentKernelVersion string `json:"CurrentKernelVersion" xml:"CurrentKernelVersion"` - ZoneId string `json:"ZoneId" xml:"ZoneId"` - IPType string `json:"IPType" xml:"IPType"` - ConnectionMode string `json:"ConnectionMode" xml:"ConnectionMode"` - ReadonlyInstanceSQLDelayedTime string `json:"ReadonlyInstanceSQLDelayedTime" xml:"ReadonlyInstanceSQLDelayedTime"` - LockMode string `json:"LockMode" xml:"LockMode"` - MasterZone string `json:"MasterZone" xml:"MasterZone"` - CanTempUpgrade bool `json:"CanTempUpgrade" xml:"CanTempUpgrade"` - Collation string `json:"Collation" xml:"Collation"` - LockReason string `json:"LockReason" xml:"LockReason"` - Category string `json:"Category" xml:"Category"` - InsId int `json:"InsId" xml:"InsId"` - GuardDBInstanceId string `json:"GuardDBInstanceId" xml:"GuardDBInstanceId"` - DBInstanceDescription string `json:"DBInstanceDescription" xml:"DBInstanceDescription"` - AccountType string `json:"AccountType" xml:"AccountType"` - SuperPermissionMode string `json:"SuperPermissionMode" xml:"SuperPermissionMode"` - GuardDBInstanceName string `json:"GuardDBInstanceName" xml:"GuardDBInstanceName"` - RegionId string `json:"RegionId" xml:"RegionId"` - ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` - ConsoleVersion string `json:"ConsoleVersion" xml:"ConsoleVersion"` - TempUpgradeTimeEnd string `json:"TempUpgradeTimeEnd" xml:"TempUpgradeTimeEnd"` - ExpireTime string `json:"ExpireTime" xml:"ExpireTime"` - TempUpgradeRecoveryMemory int `json:"TempUpgradeRecoveryMemory" xml:"TempUpgradeRecoveryMemory"` - DispenseMode string `json:"DispenseMode" xml:"DispenseMode"` - OriginConfiguration string `json:"OriginConfiguration" xml:"OriginConfiguration"` - DedicatedHostGroupId string `json:"DedicatedHostGroupId" xml:"DedicatedHostGroupId"` - ProxyType int `json:"ProxyType" xml:"ProxyType"` - AccountMaxQuantity int `json:"AccountMaxQuantity" xml:"AccountMaxQuantity"` - TempUpgradeRecoveryMaxConnections string `json:"TempUpgradeRecoveryMaxConnections" xml:"TempUpgradeRecoveryMaxConnections"` - Port string `json:"Port" xml:"Port"` - VSwitchId string `json:"VSwitchId" xml:"VSwitchId"` - CreationTime string `json:"CreationTime" xml:"CreationTime"` - MasterInstanceId string `json:"MasterInstanceId" xml:"MasterInstanceId"` - SecurityIPMode string `json:"SecurityIPMode" xml:"SecurityIPMode"` - DBInstanceClassType string `json:"DBInstanceClassType" xml:"DBInstanceClassType"` - ReadDelayTime string `json:"ReadDelayTime" xml:"ReadDelayTime"` - DBInstanceStatus string `json:"DBInstanceStatus" xml:"DBInstanceStatus"` - ReplicateId string `json:"ReplicateId" xml:"ReplicateId"` - TempUpgradeRecoveryCpu int `json:"TempUpgradeRecoveryCpu" xml:"TempUpgradeRecoveryCpu"` - ConnectionString string `json:"ConnectionString" xml:"ConnectionString"` - AvailabilityValue string `json:"AvailabilityValue" xml:"AvailabilityValue"` - AutoUpgradeMinorVersion string `json:"AutoUpgradeMinorVersion" xml:"AutoUpgradeMinorVersion"` - Extra Extra `json:"Extra" xml:"Extra"` - ReadOnlyDBInstanceIds ReadOnlyDBInstanceIdsInDescribeDBInstanceAttribute `json:"ReadOnlyDBInstanceIds" xml:"ReadOnlyDBInstanceIds"` - SlaveZones SlaveZones `json:"SlaveZones" xml:"SlaveZones"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_class.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_class.go deleted file mode 100644 index ed92e0481cb..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_class.go +++ /dev/null @@ -1,23 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DBInstanceClass is a nested struct in rds response -type DBInstanceClass struct { - DBInstanceClass string `json:"DBInstanceClass" xml:"DBInstanceClass"` - StorageRange string `json:"StorageRange" xml:"StorageRange"` - DBInstanceStorageRange DBInstanceStorageRange `json:"DBInstanceStorageRange" xml:"DBInstanceStorageRange"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_classes.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_classes.go deleted file mode 100644 index 4aa2298dc78..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_classes.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DBInstanceClasses is a nested struct in rds response -type DBInstanceClasses struct { - DBInstanceClass []DBInstanceClass `json:"DBInstanceClass" xml:"DBInstanceClass"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_expire_time.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_expire_time.go deleted file mode 100644 index a1377e79c46..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_expire_time.go +++ /dev/null @@ -1,26 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DBInstanceExpireTime is a nested struct in rds response -type DBInstanceExpireTime struct { - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - DBInstanceDescription string `json:"DBInstanceDescription" xml:"DBInstanceDescription"` - ExpireTime string `json:"ExpireTime" xml:"ExpireTime"` - DBInstanceStatus string `json:"DBInstanceStatus" xml:"DBInstanceStatus"` - LockMode string `json:"LockMode" xml:"LockMode"` - PayType string `json:"PayType" xml:"PayType"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_ids_in_describe_db_instance_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_ids_in_describe_db_instance_attribute.go deleted file mode 100644 index e8223d19844..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_ids_in_describe_db_instance_attribute.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DBInstanceIdsInDescribeDBInstanceAttribute is a nested struct in rds response -type DBInstanceIdsInDescribeDBInstanceAttribute struct { - DBInstanceId []string `json:"DBInstanceId" xml:"DBInstanceId"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_ids_in_describe_tags.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_ids_in_describe_tags.go deleted file mode 100644 index 90b1e7e632c..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_ids_in_describe_tags.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DBInstanceIdsInDescribeTags is a nested struct in rds response -type DBInstanceIdsInDescribeTags struct { - DBInstanceIds []string `json:"DBInstanceIds" xml:"DBInstanceIds"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_ip_array.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_ip_array.go deleted file mode 100644 index 4346595a322..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_ip_array.go +++ /dev/null @@ -1,25 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DBInstanceIPArray is a nested struct in rds response -type DBInstanceIPArray struct { - DBInstanceIPArrayName string `json:"DBInstanceIPArrayName" xml:"DBInstanceIPArrayName"` - DBInstanceIPArrayAttribute string `json:"DBInstanceIPArrayAttribute" xml:"DBInstanceIPArrayAttribute"` - SecurityIPType string `json:"SecurityIPType" xml:"SecurityIPType"` - SecurityIPList string `json:"SecurityIPList" xml:"SecurityIPList"` - WhitelistNetworkType string `json:"WhitelistNetworkType" xml:"WhitelistNetworkType"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_net_info.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_net_info.go deleted file mode 100644 index 6e09e5af7f8..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_net_info.go +++ /dev/null @@ -1,33 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DBInstanceNetInfo is a nested struct in rds response -type DBInstanceNetInfo struct { - Upgradeable string `json:"Upgradeable" xml:"Upgradeable"` - ExpiredTime string `json:"ExpiredTime" xml:"ExpiredTime"` - ConnectionString string `json:"ConnectionString" xml:"ConnectionString"` - IPAddress string `json:"IPAddress" xml:"IPAddress"` - IPType string `json:"IPType" xml:"IPType"` - Port string `json:"Port" xml:"Port"` - VPCId string `json:"VPCId" xml:"VPCId"` - VSwitchId string `json:"VSwitchId" xml:"VSwitchId"` - ConnectionStringType string `json:"ConnectionStringType" xml:"ConnectionStringType"` - MaxDelayTime string `json:"MaxDelayTime" xml:"MaxDelayTime"` - DistributionType string `json:"DistributionType" xml:"DistributionType"` - SecurityIPGroups SecurityIPGroups `json:"SecurityIPGroups" xml:"SecurityIPGroups"` - DBInstanceWeights DBInstanceWeights `json:"DBInstanceWeights" xml:"DBInstanceWeights"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_net_infos.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_net_infos.go deleted file mode 100644 index ccc2fe8f3bb..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_net_infos.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DBInstanceNetInfos is a nested struct in rds response -type DBInstanceNetInfos struct { - DBInstanceNetInfo []DBInstanceNetInfo `json:"DBInstanceNetInfo" xml:"DBInstanceNetInfo"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_parameter.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_parameter.go deleted file mode 100644 index 7cb56adf0cb..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_parameter.go +++ /dev/null @@ -1,23 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DBInstanceParameter is a nested struct in rds response -type DBInstanceParameter struct { - ParameterName string `json:"ParameterName" xml:"ParameterName"` - ParameterDescription string `json:"ParameterDescription" xml:"ParameterDescription"` - ParameterValue string `json:"ParameterValue" xml:"ParameterValue"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_performance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_performance.go deleted file mode 100644 index f7f70b80431..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_performance.go +++ /dev/null @@ -1,26 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DBInstancePerformance is a nested struct in rds response -type DBInstancePerformance struct { - CPUUsage string `json:"CPUUsage" xml:"CPUUsage"` - IOPSUsage string `json:"IOPSUsage" xml:"IOPSUsage"` - DiskUsage string `json:"DiskUsage" xml:"DiskUsage"` - SessionUsage string `json:"SessionUsage" xml:"SessionUsage"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - DBInstanceDescription string `json:"DBInstanceDescription" xml:"DBInstanceDescription"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_storage_range.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_storage_range.go deleted file mode 100644 index b40004cc7ed..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_storage_range.go +++ /dev/null @@ -1,25 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DBInstanceStorageRange is a nested struct in rds response -type DBInstanceStorageRange struct { - Step int `json:"Step" xml:"Step"` - Max int `json:"Max" xml:"Max"` - MinValue int `json:"MinValue" xml:"MinValue"` - MaxValue int `json:"MaxValue" xml:"MaxValue"` - Min int `json:"Min" xml:"Min"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_weight.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_weight.go deleted file mode 100644 index 771d00ad55b..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_weight.go +++ /dev/null @@ -1,25 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DBInstanceWeight is a nested struct in rds response -type DBInstanceWeight struct { - Availability string `json:"Availability" xml:"Availability"` - DBInstanceType string `json:"DBInstanceType" xml:"DBInstanceType"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - ReadonlyInstanceSQLDelayedTime string `json:"ReadonlyInstanceSQLDelayedTime" xml:"ReadonlyInstanceSQLDelayedTime"` - Weight string `json:"Weight" xml:"Weight"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_weights.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_weights.go deleted file mode 100644 index 23a18d44371..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_instance_weights.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DBInstanceWeights is a nested struct in rds response -type DBInstanceWeights struct { - DBInstanceWeight []DBInstanceWeight `json:"DBInstanceWeight" xml:"DBInstanceWeight"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_proxy_cert_list_items.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_proxy_cert_list_items.go deleted file mode 100644 index 4520180d077..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_proxy_cert_list_items.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DbProxyCertListItems is a nested struct in rds response -type DbProxyCertListItems struct { - DbProxyCertListItemsItem []DbProxyCertListItemsItem `json:"DbProxyCertListItems" xml:"DbProxyCertListItems"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_proxy_cert_list_items_item.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_proxy_cert_list_items_item.go deleted file mode 100644 index c9d71a1dca7..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_proxy_cert_list_items_item.go +++ /dev/null @@ -1,25 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DbProxyCertListItemsItem is a nested struct in rds response -type DbProxyCertListItemsItem struct { - DbInstanceName string `json:"DbInstanceName" xml:"DbInstanceName"` - EndpointName string `json:"EndpointName" xml:"EndpointName"` - EndpointType string `json:"EndpointType" xml:"EndpointType"` - CertCommonName string `json:"CertCommonName" xml:"CertCommonName"` - SslExpiredTime string `json:"SslExpiredTime" xml:"SslExpiredTime"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_proxy_connect_string_items.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_proxy_connect_string_items.go deleted file mode 100644 index 2f99f0b7dbf..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_proxy_connect_string_items.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DBProxyConnectStringItems is a nested struct in rds response -type DBProxyConnectStringItems struct { - DBProxyConnectStringItemsItem []DBProxyConnectStringItemsItem `json:"DBProxyConnectStringItems" xml:"DBProxyConnectStringItems"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_proxy_connect_string_items_item.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_proxy_connect_string_items_item.go deleted file mode 100644 index 2c04eb2b1c5..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_proxy_connect_string_items_item.go +++ /dev/null @@ -1,27 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DBProxyConnectStringItemsItem is a nested struct in rds response -type DBProxyConnectStringItemsItem struct { - DBProxyEndpointId string `json:"DBProxyEndpointId" xml:"DBProxyEndpointId"` - DBProxyConnectString string `json:"DBProxyConnectString" xml:"DBProxyConnectString"` - DBProxyConnectStringPort string `json:"DBProxyConnectStringPort" xml:"DBProxyConnectStringPort"` - DBProxyConnectStringNetType string `json:"DBProxyConnectStringNetType" xml:"DBProxyConnectStringNetType"` - DBProxyVpcInstanceId string `json:"DBProxyVpcInstanceId" xml:"DBProxyVpcInstanceId"` - DBProxyEndpointName string `json:"DBProxyEndpointName" xml:"DBProxyEndpointName"` - DBProxyConnectStringNetWorkType string `json:"DBProxyConnectStringNetWorkType" xml:"DBProxyConnectStringNetWorkType"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_proxy_endpoint_items.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_proxy_endpoint_items.go deleted file mode 100644 index 800449936ca..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_proxy_endpoint_items.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DbProxyEndpointItems is a nested struct in rds response -type DbProxyEndpointItems struct { - DbProxyEndpointItemsItem []DbProxyEndpointItemsItem `json:"DbProxyEndpointItems" xml:"DbProxyEndpointItems"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_proxy_endpoint_items_item.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_proxy_endpoint_items_item.go deleted file mode 100644 index fee6a5ad325..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_db_proxy_endpoint_items_item.go +++ /dev/null @@ -1,24 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DbProxyEndpointItemsItem is a nested struct in rds response -type DbProxyEndpointItemsItem struct { - DbProxyEndpointName string `json:"DbProxyEndpointName" xml:"DbProxyEndpointName"` - DbProxyEndpointType string `json:"DbProxyEndpointType" xml:"DbProxyEndpointType"` - DbProxyReadWriteMode string `json:"DbProxyReadWriteMode" xml:"DbProxyReadWriteMode"` - DbProxyEndpointAliases string `json:"DbProxyEndpointAliases" xml:"DbProxyEndpointAliases"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_dedicated_host_groups.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_dedicated_host_groups.go deleted file mode 100644 index f0703b707fa..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_dedicated_host_groups.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DedicatedHostGroups is a nested struct in rds response -type DedicatedHostGroups struct { - DedicatedHostGroupsItem []DedicatedHostGroupsItem `json:"DedicatedHostGroups" xml:"DedicatedHostGroups"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_dedicated_host_groups_item.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_dedicated_host_groups_item.go deleted file mode 100644 index 89cc7e325f4..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_dedicated_host_groups_item.go +++ /dev/null @@ -1,47 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DedicatedHostGroupsItem is a nested struct in rds response -type DedicatedHostGroupsItem struct { - DedicatedHostGroupId string `json:"DedicatedHostGroupId" xml:"DedicatedHostGroupId"` - DedicatedHostGroupDesc string `json:"DedicatedHostGroupDesc" xml:"DedicatedHostGroupDesc"` - CpuAllocationRatio int `json:"CpuAllocationRatio" xml:"CpuAllocationRatio"` - MemAllocationRatio int `json:"MemAllocationRatio" xml:"MemAllocationRatio"` - DiskAllocationRatio int `json:"DiskAllocationRatio" xml:"DiskAllocationRatio"` - AllocationPolicy string `json:"AllocationPolicy" xml:"AllocationPolicy"` - HostReplacePolicy string `json:"HostReplacePolicy" xml:"HostReplacePolicy"` - CreateTime string `json:"CreateTime" xml:"CreateTime"` - VPCId string `json:"VPCId" xml:"VPCId"` - HostNumber int `json:"HostNumber" xml:"HostNumber"` - InstanceNumber int `json:"InstanceNumber" xml:"InstanceNumber"` - Engine string `json:"Engine" xml:"Engine"` - Text string `json:"Text" xml:"Text"` - DedicatedHostCountGroupByHostType map[string]interface{} `json:"DedicatedHostCountGroupByHostType" xml:"DedicatedHostCountGroupByHostType"` - BastionInstanceId string `json:"BastionInstanceId" xml:"BastionInstanceId"` - OpenPermission string `json:"OpenPermission" xml:"OpenPermission"` - MemUtility float64 `json:"MemUtility" xml:"MemUtility"` - MemUsedAmount float64 `json:"MemUsedAmount" xml:"MemUsedAmount"` - DiskUtility float64 `json:"DiskUtility" xml:"DiskUtility"` - DiskUsedAmount float64 `json:"DiskUsedAmount" xml:"DiskUsedAmount"` - CpuAllocateRation float64 `json:"CpuAllocateRation" xml:"CpuAllocateRation"` - CpuAllocatedAmount float64 `json:"CpuAllocatedAmount" xml:"CpuAllocatedAmount"` - MemAllocateRation float64 `json:"MemAllocateRation" xml:"MemAllocateRation"` - MemAllocatedAmount float64 `json:"MemAllocatedAmount" xml:"MemAllocatedAmount"` - DiskAllocateRation float64 `json:"DiskAllocateRation" xml:"DiskAllocateRation"` - DiskAllocatedAmount float64 `json:"DiskAllocatedAmount" xml:"DiskAllocatedAmount"` - ZoneIDList ZoneIDList `json:"ZoneIDList" xml:"ZoneIDList"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_dedicated_hosts.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_dedicated_hosts.go deleted file mode 100644 index dd5d58ed6cf..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_dedicated_hosts.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DedicatedHosts is a nested struct in rds response -type DedicatedHosts struct { - DedicatedHostsItem []DedicatedHostsItem `json:"DedicatedHosts" xml:"DedicatedHosts"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_dedicated_hosts_item.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_dedicated_hosts_item.go deleted file mode 100644 index 7e3bedfe69c..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_dedicated_hosts_item.go +++ /dev/null @@ -1,48 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DedicatedHostsItem is a nested struct in rds response -type DedicatedHostsItem struct { - HostName string `json:"HostName" xml:"HostName"` - HostStatus string `json:"HostStatus" xml:"HostStatus"` - InstanceNumber string `json:"InstanceNumber" xml:"InstanceNumber"` - CPUAllocationRatio string `json:"CPUAllocationRatio" xml:"CPUAllocationRatio"` - MemAllocationRatio string `json:"MemAllocationRatio" xml:"MemAllocationRatio"` - DiskAllocationRatio string `json:"DiskAllocationRatio" xml:"DiskAllocationRatio"` - VPCId string `json:"VPCId" xml:"VPCId"` - VSwitchId string `json:"VSwitchId" xml:"VSwitchId"` - ZoneId string `json:"ZoneId" xml:"ZoneId"` - IPAddress string `json:"IPAddress" xml:"IPAddress"` - HostClass string `json:"HostClass" xml:"HostClass"` - CreatedTime string `json:"CreatedTime" xml:"CreatedTime"` - DedicatedHostId string `json:"DedicatedHostId" xml:"DedicatedHostId"` - AllocationStatus string `json:"AllocationStatus" xml:"AllocationStatus"` - EndTime string `json:"EndTime" xml:"EndTime"` - HostType string `json:"HostType" xml:"HostType"` - BastionInstanceId string `json:"BastionInstanceId" xml:"BastionInstanceId"` - OpenPermission string `json:"OpenPermission" xml:"OpenPermission"` - AccountName string `json:"AccountName" xml:"AccountName"` - HostCPU string `json:"HostCPU" xml:"HostCPU"` - HostMem string `json:"HostMem" xml:"HostMem"` - HostStorage string `json:"HostStorage" xml:"HostStorage"` - CpuUsed string `json:"CpuUsed" xml:"CpuUsed"` - MemoryUsed string `json:"MemoryUsed" xml:"MemoryUsed"` - StorageUsed string `json:"StorageUsed" xml:"StorageUsed"` - ImageCategory string `json:"ImageCategory" xml:"ImageCategory"` - DedicatedHostGroupId string `json:"DedicatedHostGroupId" xml:"DedicatedHostGroupId"` - Engine string `json:"Engine" xml:"Engine"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_deleted_bakset_ids.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_deleted_bakset_ids.go deleted file mode 100644 index 5f8f81aeecc..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_deleted_bakset_ids.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DeletedBaksetIds is a nested struct in rds response -type DeletedBaksetIds struct { - DeletedBaksetIds []int `json:"DeletedBaksetIds" xml:"DeletedBaksetIds"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_duplication_location.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_duplication_location.go deleted file mode 100644 index 092a74fda10..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_duplication_location.go +++ /dev/null @@ -1,22 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DuplicationLocation is a nested struct in rds response -type DuplicationLocation struct { - Sotrage string `json:"Sotrage" xml:"Sotrage"` - Location Location `json:"Location" xml:"Location"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_ecs_security_group_relation.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_ecs_security_group_relation.go deleted file mode 100644 index 6f7640a47ef..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_ecs_security_group_relation.go +++ /dev/null @@ -1,23 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// EcsSecurityGroupRelation is a nested struct in rds response -type EcsSecurityGroupRelation struct { - RegionId string `json:"RegionId" xml:"RegionId"` - SecurityGroupId string `json:"SecurityGroupId" xml:"SecurityGroupId"` - NetworkType string `json:"NetworkType" xml:"NetworkType"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_endpoint_connect_items.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_endpoint_connect_items.go deleted file mode 100644 index 3a11e9c11ee..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_endpoint_connect_items.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// EndpointConnectItems is a nested struct in rds response -type EndpointConnectItems struct { - EndpointConnectItemsItem []EndpointConnectItemsItem `json:"EndpointConnectItems" xml:"EndpointConnectItems"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_endpoint_connect_items_item.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_endpoint_connect_items_item.go deleted file mode 100644 index 04fb40f5aaa..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_endpoint_connect_items_item.go +++ /dev/null @@ -1,23 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// EndpointConnectItemsItem is a nested struct in rds response -type EndpointConnectItemsItem struct { - DbProxyEndpointConnectString string `json:"DbProxyEndpointConnectString" xml:"DbProxyEndpointConnectString"` - DbProxyEndpointPort string `json:"DbProxyEndpointPort" xml:"DbProxyEndpointPort"` - DbProxyEndpointNetType string `json:"DbProxyEndpointNetType" xml:"DbProxyEndpointNetType"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_error_log.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_error_log.go deleted file mode 100644 index 14e1f5927c7..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_error_log.go +++ /dev/null @@ -1,22 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ErrorLog is a nested struct in rds response -type ErrorLog struct { - CreateTime string `json:"CreateTime" xml:"CreateTime"` - ErrorInfo string `json:"ErrorInfo" xml:"ErrorInfo"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_event_items.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_event_items.go deleted file mode 100644 index fb5b066b207..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_event_items.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// EventItems is a nested struct in rds response -type EventItems struct { - EventItemsItem []EventItemsItem `json:"EventItems" xml:"EventItems"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_event_items_item.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_event_items_item.go deleted file mode 100644 index be62aa862f7..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_event_items_item.go +++ /dev/null @@ -1,31 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// EventItemsItem is a nested struct in rds response -type EventItemsItem struct { - EventId int `json:"EventId" xml:"EventId"` - EventType string `json:"EventType" xml:"EventType"` - EventName string `json:"EventName" xml:"EventName"` - EventTime string `json:"EventTime" xml:"EventTime"` - ResourceType string `json:"ResourceType" xml:"ResourceType"` - ResourceName string `json:"ResourceName" xml:"ResourceName"` - RegionId string `json:"RegionId" xml:"RegionId"` - EventUserType string `json:"EventUserType" xml:"EventUserType"` - EventReason string `json:"EventReason" xml:"EventReason"` - EventPayload string `json:"EventPayload" xml:"EventPayload"` - EventRecordTime string `json:"EventRecordTime" xml:"EventRecordTime"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_extra.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_extra.go deleted file mode 100644 index a61561799e9..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_extra.go +++ /dev/null @@ -1,24 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// Extra is a nested struct in rds response -type Extra struct { - ReplicaGroupID string `json:"ReplicaGroupID" xml:"ReplicaGroupID"` - ReplicaGroupStatus string `json:"ReplicaGroupStatus" xml:"ReplicaGroupStatus"` - ActiveReplicaDBInstanceID string `json:"ActiveReplicaDBInstanceID" xml:"ActiveReplicaDBInstanceID"` - DBInstanceIds DBInstanceIdsInDescribeDBInstanceAttribute `json:"DBInstanceIds" xml:"DBInstanceIds"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_host_classes.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_host_classes.go deleted file mode 100644 index f4fc8e1a24e..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_host_classes.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// HostClasses is a nested struct in rds response -type HostClasses struct { - HostClassesItem []HostClassesItem `json:"HostClasses" xml:"HostClasses"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_host_classes_item.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_host_classes_item.go deleted file mode 100644 index 8379f15114c..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_host_classes_item.go +++ /dev/null @@ -1,22 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// HostClassesItem is a nested struct in rds response -type HostClassesItem struct { - HostClassName string `json:"HostClassName" xml:"HostClassName"` - Description string `json:"Description" xml:"Description"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_host_instance_infos.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_host_instance_infos.go deleted file mode 100644 index ba9a84ea56e..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_host_instance_infos.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// HostInstanceInfos is a nested struct in rds response -type HostInstanceInfos struct { - NodeInfo []NodeInfo `json:"NodeInfo" xml:"NodeInfo"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_import_result_from_db.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_import_result_from_db.go deleted file mode 100644 index e6cdcbfd0e2..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_import_result_from_db.go +++ /dev/null @@ -1,25 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ImportResultFromDB is a nested struct in rds response -type ImportResultFromDB struct { - ImportId int `json:"ImportId" xml:"ImportId"` - ImportDataType string `json:"ImportDataType" xml:"ImportDataType"` - ImportDataStatus string `json:"ImportDataStatus" xml:"ImportDataStatus"` - ImportDataStatusDescription string `json:"ImportDataStatusDescription" xml:"ImportDataStatusDescription"` - IncrementalImportingTime string `json:"IncrementalImportingTime" xml:"IncrementalImportingTime"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_item.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_item.go deleted file mode 100644 index c143193043d..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_item.go +++ /dev/null @@ -1,69 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// Item is a nested struct in rds response -type Item struct { - Engine string `json:"Engine" xml:"Engine"` - ReportTime string `json:"ReportTime" xml:"ReportTime"` - BackupSetStatus int `json:"BackupSetStatus" xml:"BackupSetStatus"` - DBInstanceStatusDesc string `json:"DBInstanceStatusDesc" xml:"DBInstanceStatusDesc"` - BackupEnabled string `json:"BackupEnabled" xml:"BackupEnabled"` - CrossBackupRegion string `json:"CrossBackupRegion" xml:"CrossBackupRegion"` - BackupStartTime string `json:"BackupStartTime" xml:"BackupStartTime"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - DBInstanceStorageType string `json:"DBInstanceStorageType" xml:"DBInstanceStorageType"` - CrossLogBackupSize int64 `json:"CrossLogBackupSize" xml:"CrossLogBackupSize"` - BackupEnabledTime string `json:"BackupEnabledTime" xml:"BackupEnabledTime"` - CrossBackupDownloadLink string `json:"CrossBackupDownloadLink" xml:"CrossBackupDownloadLink"` - LogEndTime string `json:"LogEndTime" xml:"LogEndTime"` - EngineVersion string `json:"EngineVersion" xml:"EngineVersion"` - LogBackupEnabled string `json:"LogBackupEnabled" xml:"LogBackupEnabled"` - HasBackupTableMeta string `json:"HasBackupTableMeta" xml:"HasBackupTableMeta"` - LogBeginTime string `json:"LogBeginTime" xml:"LogBeginTime"` - RetentType int `json:"RetentType" xml:"RetentType"` - ConsistentTime string `json:"ConsistentTime" xml:"ConsistentTime"` - Status string `json:"Status" xml:"Status"` - RelServiceId string `json:"RelServiceId" xml:"RelServiceId"` - LockMode string `json:"LockMode" xml:"LockMode"` - CrossBackupSetSize int64 `json:"CrossBackupSetSize" xml:"CrossBackupSetSize"` - Category string `json:"Category" xml:"Category"` - DBInstanceDescription string `json:"DBInstanceDescription" xml:"DBInstanceDescription"` - CrossLogBackupId int `json:"CrossLogBackupId" xml:"CrossLogBackupId"` - CrossDownloadLink string `json:"CrossDownloadLink" xml:"CrossDownloadLink"` - LogFileName string `json:"LogFileName" xml:"LogFileName"` - RegionId string `json:"RegionId" xml:"RegionId"` - Duration int `json:"Duration" xml:"Duration"` - CrossBackupId int `json:"CrossBackupId" xml:"CrossBackupId"` - LinkExpiredTime string `json:"LinkExpiredTime" xml:"LinkExpiredTime"` - BackupSetScale int `json:"BackupSetScale" xml:"BackupSetScale"` - AutoRenew string `json:"AutoRenew" xml:"AutoRenew"` - CrossBackupSetFile string `json:"CrossBackupSetFile" xml:"CrossBackupSetFile"` - CrossBackupSetLocation string `json:"CrossBackupSetLocation" xml:"CrossBackupSetLocation"` - LogBackupEnabledTime string `json:"LogBackupEnabledTime" xml:"LogBackupEnabledTime"` - BackupEndTime string `json:"BackupEndTime" xml:"BackupEndTime"` - BackupMethod string `json:"BackupMethod" xml:"BackupMethod"` - RelService string `json:"RelService" xml:"RelService"` - BackupType string `json:"BackupType" xml:"BackupType"` - Retention int `json:"Retention" xml:"Retention"` - DBInstanceStatus string `json:"DBInstanceStatus" xml:"DBInstanceStatus"` - CrossIntranetDownloadLink string `json:"CrossIntranetDownloadLink" xml:"CrossIntranetDownloadLink"` - InstanceId int `json:"InstanceId" xml:"InstanceId"` - CrossBackupType string `json:"CrossBackupType" xml:"CrossBackupType"` - RestoreRegions RestoreRegions `json:"RestoreRegions" xml:"RestoreRegions"` - QPSTopNItems QPSTopNItemsInDescribeSQLLogReportList `json:"QPSTopNItems" xml:"QPSTopNItems"` - LatencyTopNItems LatencyTopNItemsInDescribeSQLLogReportList `json:"LatencyTopNItems" xml:"LatencyTopNItems"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_calculate_db_instance_weight.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_calculate_db_instance_weight.go deleted file mode 100644 index 37763d5f76b..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_calculate_db_instance_weight.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInCalculateDBInstanceWeight is a nested struct in rds response -type ItemsInCalculateDBInstanceWeight struct { - DBInstanceWeight []DBInstanceWeight `json:"DBInstanceWeight" xml:"DBInstanceWeight"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_descibe_imports_from_database.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_descibe_imports_from_database.go deleted file mode 100644 index 7efd4a42281..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_descibe_imports_from_database.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescibeImportsFromDatabase is a nested struct in rds response -type ItemsInDescibeImportsFromDatabase struct { - ImportResultFromDB []ImportResultFromDB `json:"ImportResultFromDB" xml:"ImportResultFromDB"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_backup_tasks.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_backup_tasks.go deleted file mode 100644 index 034c0e62008..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_backup_tasks.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeBackupTasks is a nested struct in rds response -type ItemsInDescribeBackupTasks struct { - BackupJob []BackupJob `json:"BackupJob" xml:"BackupJob"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_backups.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_backups.go deleted file mode 100644 index a223f3992bf..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_backups.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeBackups is a nested struct in rds response -type ItemsInDescribeBackups struct { - Backup []Backup `json:"Backup" xml:"Backup"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_binlog_files.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_binlog_files.go deleted file mode 100644 index de667f26bb3..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_binlog_files.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeBinlogFiles is a nested struct in rds response -type ItemsInDescribeBinlogFiles struct { - BinLogFile []BinLogFile `json:"BinLogFile" xml:"BinLogFile"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_cross_backup_meta_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_cross_backup_meta_list.go deleted file mode 100644 index 26211cc9c3d..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_cross_backup_meta_list.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeCrossBackupMetaList is a nested struct in rds response -type ItemsInDescribeCrossBackupMetaList struct { - Meta []Meta `json:"Meta" xml:"Meta"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_cross_region_backup_db_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_cross_region_backup_db_instance.go deleted file mode 100644 index 1612c88c397..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_cross_region_backup_db_instance.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeCrossRegionBackupDBInstance is a nested struct in rds response -type ItemsInDescribeCrossRegionBackupDBInstance struct { - Item []Item `json:"Item" xml:"Item"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_cross_region_backups.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_cross_region_backups.go deleted file mode 100644 index bc64ad839d8..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_cross_region_backups.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeCrossRegionBackups is a nested struct in rds response -type ItemsInDescribeCrossRegionBackups struct { - Item []Item `json:"Item" xml:"Item"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_cross_region_log_backup_files.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_cross_region_log_backup_files.go deleted file mode 100644 index a6683702eb9..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_cross_region_log_backup_files.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeCrossRegionLogBackupFiles is a nested struct in rds response -type ItemsInDescribeCrossRegionLogBackupFiles struct { - Item []Item `json:"Item" xml:"Item"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_db_instance_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_db_instance_attribute.go deleted file mode 100644 index 82eaa65d0c3..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_db_instance_attribute.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeDBInstanceAttribute is a nested struct in rds response -type ItemsInDescribeDBInstanceAttribute struct { - DBInstanceAttribute []DBInstanceAttribute `json:"DBInstanceAttribute" xml:"DBInstanceAttribute"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_db_instance_ip_array_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_db_instance_ip_array_list.go deleted file mode 100644 index 6eddc13f112..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_db_instance_ip_array_list.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeDBInstanceIPArrayList is a nested struct in rds response -type ItemsInDescribeDBInstanceIPArrayList struct { - DBInstanceIPArray []DBInstanceIPArray `json:"DBInstanceIPArray" xml:"DBInstanceIPArray"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_db_instances.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_db_instances.go deleted file mode 100644 index 0ef3bab85cd..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_db_instances.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeDBInstances is a nested struct in rds response -type ItemsInDescribeDBInstances struct { - DBInstance []DBInstance `json:"DBInstance" xml:"DBInstance"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_db_instances_as_csv.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_db_instances_as_csv.go deleted file mode 100644 index 5810538fa70..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_db_instances_as_csv.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeDBInstancesAsCsv is a nested struct in rds response -type ItemsInDescribeDBInstancesAsCsv struct { - DBInstanceAttribute []DBInstanceAttribute `json:"DBInstanceAttribute" xml:"DBInstanceAttribute"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_db_instances_by_expire_time.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_db_instances_by_expire_time.go deleted file mode 100644 index de55eaabf30..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_db_instances_by_expire_time.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeDBInstancesByExpireTime is a nested struct in rds response -type ItemsInDescribeDBInstancesByExpireTime struct { - DBInstanceExpireTime []DBInstanceExpireTime `json:"DBInstanceExpireTime" xml:"DBInstanceExpireTime"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_db_instances_by_performance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_db_instances_by_performance.go deleted file mode 100644 index 041d136c9d5..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_db_instances_by_performance.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeDBInstancesByPerformance is a nested struct in rds response -type ItemsInDescribeDBInstancesByPerformance struct { - DBInstancePerformance []DBInstancePerformance `json:"DBInstancePerformance" xml:"DBInstancePerformance"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_db_instances_for_clone.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_db_instances_for_clone.go deleted file mode 100644 index a35dd714aff..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_db_instances_for_clone.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeDBInstancesForClone is a nested struct in rds response -type ItemsInDescribeDBInstancesForClone struct { - DBInstance []DBInstance `json:"DBInstance" xml:"DBInstance"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_detached_backups.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_detached_backups.go deleted file mode 100644 index 2b6fcdb96a9..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_detached_backups.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeDetachedBackups is a nested struct in rds response -type ItemsInDescribeDetachedBackups struct { - Backup []Backup `json:"Backup" xml:"Backup"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_dtc_security_ip_hosts_for_sql_server.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_dtc_security_ip_hosts_for_sql_server.go deleted file mode 100644 index ea9f357dfca..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_dtc_security_ip_hosts_for_sql_server.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeDTCSecurityIpHostsForSQLServer is a nested struct in rds response -type ItemsInDescribeDTCSecurityIpHostsForSQLServer struct { - WhiteListGroups []WhiteListGroups `json:"WhiteListGroups" xml:"WhiteListGroups"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_error_logs.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_error_logs.go deleted file mode 100644 index b88ffe7545d..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_error_logs.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeErrorLogs is a nested struct in rds response -type ItemsInDescribeErrorLogs struct { - ErrorLog []ErrorLog `json:"ErrorLog" xml:"ErrorLog"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_instance_auto_renewal_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_instance_auto_renewal_attribute.go deleted file mode 100644 index d111af0dd46..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_instance_auto_renewal_attribute.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeInstanceAutoRenewalAttribute is a nested struct in rds response -type ItemsInDescribeInstanceAutoRenewalAttribute struct { - Item []Item `json:"Item" xml:"Item"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_log_backup_files.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_log_backup_files.go deleted file mode 100644 index 8f25b6af3b8..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_log_backup_files.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeLogBackupFiles is a nested struct in rds response -type ItemsInDescribeLogBackupFiles struct { - BinLogFile []BinLogFile `json:"BinLogFile" xml:"BinLogFile"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_meta_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_meta_list.go deleted file mode 100644 index 048d86ab992..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_meta_list.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeMetaList is a nested struct in rds response -type ItemsInDescribeMetaList struct { - Meta []Meta `json:"Meta" xml:"Meta"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_migrate_tasks.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_migrate_tasks.go deleted file mode 100644 index e0d372dc439..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_migrate_tasks.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeMigrateTasks is a nested struct in rds response -type ItemsInDescribeMigrateTasks struct { - MigrateTask []MigrateTask `json:"MigrateTask" xml:"MigrateTask"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_migrate_tasks_for_sql_server.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_migrate_tasks_for_sql_server.go deleted file mode 100644 index 86ebdd8adb3..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_migrate_tasks_for_sql_server.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeMigrateTasksForSQLServer is a nested struct in rds response -type ItemsInDescribeMigrateTasksForSQLServer struct { - MigrateTask []MigrateTask `json:"MigrateTask" xml:"MigrateTask"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_modify_parameter_log.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_modify_parameter_log.go deleted file mode 100644 index 89d068170a7..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_modify_parameter_log.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeModifyParameterLog is a nested struct in rds response -type ItemsInDescribeModifyParameterLog struct { - ParameterChangeLog []ParameterChangeLog `json:"ParameterChangeLog" xml:"ParameterChangeLog"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_oss_downloads.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_oss_downloads.go deleted file mode 100644 index b7bb000bfd7..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_oss_downloads.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeOssDownloads is a nested struct in rds response -type ItemsInDescribeOssDownloads struct { - OssDownload []OssDownload `json:"OssDownload" xml:"OssDownload"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_oss_downloads_for_sql_server.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_oss_downloads_for_sql_server.go deleted file mode 100644 index c6eb41671b0..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_oss_downloads_for_sql_server.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeOssDownloadsForSQLServer is a nested struct in rds response -type ItemsInDescribeOssDownloadsForSQLServer struct { - OssDownload []OssDownload `json:"OssDownload" xml:"OssDownload"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_read_db_instance_delay.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_read_db_instance_delay.go deleted file mode 100644 index 33e1e33ab3e..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_read_db_instance_delay.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeReadDBInstanceDelay is a nested struct in rds response -type ItemsInDescribeReadDBInstanceDelay struct { - ItemsItem []ItemsItem `json:"Items" xml:"Items"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_security_group_configuration.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_security_group_configuration.go deleted file mode 100644 index 1af87088a0a..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_security_group_configuration.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeSecurityGroupConfiguration is a nested struct in rds response -type ItemsInDescribeSecurityGroupConfiguration struct { - EcsSecurityGroupRelation []EcsSecurityGroupRelation `json:"EcsSecurityGroupRelation" xml:"EcsSecurityGroupRelation"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_slow_log_records.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_slow_log_records.go deleted file mode 100644 index d0c39216005..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_slow_log_records.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeSlowLogRecords is a nested struct in rds response -type ItemsInDescribeSlowLogRecords struct { - SQLSlowRecord []SQLSlowRecord `json:"SQLSlowRecord" xml:"SQLSlowRecord"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_slow_logs.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_slow_logs.go deleted file mode 100644 index a0febe2a0dd..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_slow_logs.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeSlowLogs is a nested struct in rds response -type ItemsInDescribeSlowLogs struct { - SQLSlowLog []SQLSlowLog `json:"SQLSlowLog" xml:"SQLSlowLog"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_sql_log_files.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_sql_log_files.go deleted file mode 100644 index 8cb9a44e80e..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_sql_log_files.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeSQLLogFiles is a nested struct in rds response -type ItemsInDescribeSQLLogFiles struct { - LogFile []LogFile `json:"LogFile" xml:"LogFile"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_sql_log_records.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_sql_log_records.go deleted file mode 100644 index 70a025e1647..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_sql_log_records.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeSQLLogRecords is a nested struct in rds response -type ItemsInDescribeSQLLogRecords struct { - SQLRecord []SQLRecord `json:"SQLRecord" xml:"SQLRecord"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_sql_log_report_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_sql_log_report_list.go deleted file mode 100644 index cd52694a360..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_sql_log_report_list.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeSQLLogReportList is a nested struct in rds response -type ItemsInDescribeSQLLogReportList struct { - Item []Item `json:"Item" xml:"Item"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_sql_log_reports.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_sql_log_reports.go deleted file mode 100644 index 4db36d4b53a..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_sql_log_reports.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeSQLLogReports is a nested struct in rds response -type ItemsInDescribeSQLLogReports struct { - Item []Item `json:"Item" xml:"Item"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_tags.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_tags.go deleted file mode 100644 index c0d12f77d0c..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_tags.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeTags is a nested struct in rds response -type ItemsInDescribeTags struct { - TagInfos []TagInfos `json:"TagInfos" xml:"TagInfos"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_tasks.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_tasks.go deleted file mode 100644 index e426c536126..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_describe_tasks.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInDescribeTasks is a nested struct in rds response -type ItemsInDescribeTasks struct { - TaskProgressInfo []TaskProgressInfo `json:"TaskProgressInfo" xml:"TaskProgressInfo"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_modify_security_group_configuration.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_modify_security_group_configuration.go deleted file mode 100644 index e8d5af20898..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_in_modify_security_group_configuration.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsInModifySecurityGroupConfiguration is a nested struct in rds response -type ItemsInModifySecurityGroupConfiguration struct { - EcsSecurityGroupRelation []EcsSecurityGroupRelation `json:"EcsSecurityGroupRelation" xml:"EcsSecurityGroupRelation"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_item.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_item.go deleted file mode 100644 index 354c763f789..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_items_item.go +++ /dev/null @@ -1,24 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ItemsItem is a nested struct in rds response -type ItemsItem struct { - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` - ReadDBInstanceNames ReadDBInstanceNames `json:"ReadDBInstanceNames" xml:"ReadDBInstanceNames"` - ReadDelayTimes ReadDelayTimes `json:"ReadDelayTimes" xml:"ReadDelayTimes"` - ReadonlyInstanceDelay ReadonlyInstanceDelay `json:"ReadonlyInstanceDelay" xml:"ReadonlyInstanceDelay"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_latency_top_n_item.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_latency_top_n_item.go deleted file mode 100644 index 6ebb9f5dee6..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_latency_top_n_item.go +++ /dev/null @@ -1,23 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// LatencyTopNItem is a nested struct in rds response -type LatencyTopNItem struct { - SQLExecuteTimes int64 `json:"SQLExecuteTimes" xml:"SQLExecuteTimes"` - AvgLatency int64 `json:"AvgLatency" xml:"AvgLatency"` - SQLText string `json:"SQLText" xml:"SQLText"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_latency_top_n_items_in_describe_sql_log_report_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_latency_top_n_items_in_describe_sql_log_report_list.go deleted file mode 100644 index c62c7d0b3d0..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_latency_top_n_items_in_describe_sql_log_report_list.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// LatencyTopNItemsInDescribeSQLLogReportList is a nested struct in rds response -type LatencyTopNItemsInDescribeSQLLogReportList struct { - LatencyTopNItem []LatencyTopNItem `json:"LatencyTopNItem" xml:"LatencyTopNItem"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_latency_top_n_items_in_describe_sql_log_reports.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_latency_top_n_items_in_describe_sql_log_reports.go deleted file mode 100644 index 22140dc570c..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_latency_top_n_items_in_describe_sql_log_reports.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// LatencyTopNItemsInDescribeSQLLogReports is a nested struct in rds response -type LatencyTopNItemsInDescribeSQLLogReports struct { - LatencyTopNItem []LatencyTopNItem `json:"LatencyTopNItem" xml:"LatencyTopNItem"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_location.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_location.go deleted file mode 100644 index 1bdacdccdbc..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_location.go +++ /dev/null @@ -1,22 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// Location is a nested struct in rds response -type Location struct { - Endpoint string `json:"Endpoint" xml:"Endpoint"` - Bucket string `json:"Bucket" xml:"Bucket"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_log_file.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_log_file.go deleted file mode 100644 index ff3671255f7..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_log_file.go +++ /dev/null @@ -1,26 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// LogFile is a nested struct in rds response -type LogFile struct { - FileID string `json:"FileID" xml:"FileID"` - LogStatus string `json:"LogStatus" xml:"LogStatus"` - LogDownloadURL string `json:"LogDownloadURL" xml:"LogDownloadURL"` - LogSize string `json:"LogSize" xml:"LogSize"` - LogStartTime string `json:"LogStartTime" xml:"LogStartTime"` - LogEndTime string `json:"LogEndTime" xml:"LogEndTime"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_meta.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_meta.go deleted file mode 100644 index 7740e66a59f..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_meta.go +++ /dev/null @@ -1,23 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// Meta is a nested struct in rds response -type Meta struct { - Size string `json:"Size" xml:"Size"` - Database string `json:"Database" xml:"Database"` - Tables string `json:"Tables" xml:"Tables"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_migrate_task.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_migrate_task.go deleted file mode 100644 index 3eadc1e505b..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_migrate_task.go +++ /dev/null @@ -1,31 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// MigrateTask is a nested struct in rds response -type MigrateTask struct { - BackupMode string `json:"BackupMode" xml:"BackupMode"` - EndTime string `json:"EndTime" xml:"EndTime"` - Desc string `json:"Desc" xml:"Desc"` - MigrateTaskId string `json:"MigrateTaskId" xml:"MigrateTaskId"` - CreateTime string `json:"CreateTime" xml:"CreateTime"` - DBName string `json:"DBName" xml:"DBName"` - IsDBReplaced string `json:"IsDBReplaced" xml:"IsDBReplaced"` - MigrateIaskId string `json:"MigrateIaskId" xml:"MigrateIaskId"` - Status string `json:"Status" xml:"Status"` - TaskType string `json:"TaskType" xml:"TaskType"` - Description string `json:"Description" xml:"Description"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_node_info.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_node_info.go deleted file mode 100644 index 7646dba3eab..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_node_info.go +++ /dev/null @@ -1,27 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// NodeInfo is a nested struct in rds response -type NodeInfo struct { - NodeId string `json:"NodeId" xml:"NodeId"` - RegionId string `json:"RegionId" xml:"RegionId"` - LogSyncTime string `json:"LogSyncTime" xml:"LogSyncTime"` - DataSyncTime string `json:"DataSyncTime" xml:"DataSyncTime"` - NodeType string `json:"NodeType" xml:"NodeType"` - ZoneId string `json:"ZoneId" xml:"ZoneId"` - SyncStatus string `json:"SyncStatus" xml:"SyncStatus"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_oss_download.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_oss_download.go deleted file mode 100644 index 1744f7c1f9c..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_oss_download.go +++ /dev/null @@ -1,31 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// OssDownload is a nested struct in rds response -type OssDownload struct { - FileSize string `json:"FileSize" xml:"FileSize"` - BackupMode string `json:"BackupMode" xml:"BackupMode"` - IsAvail string `json:"IsAvail" xml:"IsAvail"` - EndTime string `json:"EndTime" xml:"EndTime"` - Desc string `json:"Desc" xml:"Desc"` - IsAvailable string `json:"IsAvailable" xml:"IsAvailable"` - CreateTime string `json:"CreateTime" xml:"CreateTime"` - BakType string `json:"BakType" xml:"BakType"` - Status string `json:"Status" xml:"Status"` - FileName string `json:"FileName" xml:"FileName"` - Description string `json:"Description" xml:"Description"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_param_detail.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_param_detail.go deleted file mode 100644 index 3feb2ba8686..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_param_detail.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ParamDetail is a nested struct in rds response -type ParamDetail struct { - ParameterDetail []ParameterDetail `json:"ParameterDetail" xml:"ParameterDetail"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_param_group.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_param_group.go deleted file mode 100644 index cfd0eadaaf3..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_param_group.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ParamGroup is a nested struct in rds response -type ParamGroup struct { - ParameterGroup []ParameterGroup `json:"ParameterGroup" xml:"ParameterGroup"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_parameter_change_log.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_parameter_change_log.go deleted file mode 100644 index fc885965a56..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_parameter_change_log.go +++ /dev/null @@ -1,25 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ParameterChangeLog is a nested struct in rds response -type ParameterChangeLog struct { - ModifyTime string `json:"ModifyTime" xml:"ModifyTime"` - OldParameterValue string `json:"OldParameterValue" xml:"OldParameterValue"` - NewParameterValue string `json:"NewParameterValue" xml:"NewParameterValue"` - ParameterName string `json:"ParameterName" xml:"ParameterName"` - Status string `json:"Status" xml:"Status"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_parameter_detail.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_parameter_detail.go deleted file mode 100644 index b380ecc8e5f..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_parameter_detail.go +++ /dev/null @@ -1,22 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ParameterDetail is a nested struct in rds response -type ParameterDetail struct { - ParamName string `json:"ParamName" xml:"ParamName"` - ParamValue string `json:"ParamValue" xml:"ParamValue"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_parameter_group.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_parameter_group.go deleted file mode 100644 index a17dbb2277c..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_parameter_group.go +++ /dev/null @@ -1,31 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ParameterGroup is a nested struct in rds response -type ParameterGroup struct { - Engine string `json:"Engine" xml:"Engine"` - EngineVersion string `json:"EngineVersion" xml:"EngineVersion"` - UpdateTime string `json:"UpdateTime" xml:"UpdateTime"` - ParameterGroupName string `json:"ParameterGroupName" xml:"ParameterGroupName"` - ParameterGroupType int `json:"ParameterGroupType" xml:"ParameterGroupType"` - ParameterGroupDesc string `json:"ParameterGroupDesc" xml:"ParameterGroupDesc"` - CreateTime string `json:"CreateTime" xml:"CreateTime"` - ParamCounts int `json:"ParamCounts" xml:"ParamCounts"` - ForceRestart int `json:"ForceRestart" xml:"ForceRestart"` - ParameterGroupId string `json:"ParameterGroupId" xml:"ParameterGroupId"` - ParamDetail ParamDetail `json:"ParamDetail" xml:"ParamDetail"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_parameter_groups.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_parameter_groups.go deleted file mode 100644 index c049df9dd49..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_parameter_groups.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ParameterGroups is a nested struct in rds response -type ParameterGroups struct { - ParameterGroup []ParameterGroup `json:"ParameterGroup" xml:"ParameterGroup"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_parameters.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_parameters.go deleted file mode 100644 index 134f2a0067c..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_parameters.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// Parameters is a nested struct in rds response -type Parameters struct { - TemplateRecord []TemplateRecord `json:"TemplateRecord" xml:"TemplateRecord"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_performance_key.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_performance_key.go deleted file mode 100644 index 557f7ca8171..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_performance_key.go +++ /dev/null @@ -1,24 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// PerformanceKey is a nested struct in rds response -type PerformanceKey struct { - Key string `json:"Key" xml:"Key"` - Unit string `json:"Unit" xml:"Unit"` - ValueFormat string `json:"ValueFormat" xml:"ValueFormat"` - Values ValuesInDescribeDBInstancePerformance `json:"Values" xml:"Values"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_performance_keys_in_describe_db_instance_performance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_performance_keys_in_describe_db_instance_performance.go deleted file mode 100644 index 30bc59b5a0b..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_performance_keys_in_describe_db_instance_performance.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// PerformanceKeysInDescribeDBInstancePerformance is a nested struct in rds response -type PerformanceKeysInDescribeDBInstancePerformance struct { - PerformanceKey []PerformanceKey `json:"PerformanceKey" xml:"PerformanceKey"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_performance_keys_in_describe_db_proxy_performance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_performance_keys_in_describe_db_proxy_performance.go deleted file mode 100644 index fc6e69da099..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_performance_keys_in_describe_db_proxy_performance.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// PerformanceKeysInDescribeDBProxyPerformance is a nested struct in rds response -type PerformanceKeysInDescribeDBProxyPerformance struct { - PerformanceKey []PerformanceKey `json:"PerformanceKey" xml:"PerformanceKey"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_performance_value.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_performance_value.go deleted file mode 100644 index 462e74371ec..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_performance_value.go +++ /dev/null @@ -1,22 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// PerformanceValue is a nested struct in rds response -type PerformanceValue struct { - Value string `json:"Value" xml:"Value"` - Date string `json:"Date" xml:"Date"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_price_info.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_price_info.go deleted file mode 100644 index 4c2e916261d..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_price_info.go +++ /dev/null @@ -1,27 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// PriceInfo is a nested struct in rds response -type PriceInfo struct { - TradePrice float64 `json:"TradePrice" xml:"TradePrice"` - DiscountPrice float64 `json:"DiscountPrice" xml:"DiscountPrice"` - OriginalPrice float64 `json:"OriginalPrice" xml:"OriginalPrice"` - Currency string `json:"Currency" xml:"Currency"` - RuleIds RuleIdsInDescribePrice `json:"RuleIds" xml:"RuleIds"` - ActivityInfo ActivityInfo `json:"ActivityInfo" xml:"ActivityInfo"` - Coupons CouponsInDescribePrice `json:"Coupons" xml:"Coupons"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_qps_top_n_item.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_qps_top_n_item.go deleted file mode 100644 index 41ffbfaeb33..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_qps_top_n_item.go +++ /dev/null @@ -1,22 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// QPSTopNItem is a nested struct in rds response -type QPSTopNItem struct { - SQLExecuteTimes int64 `json:"SQLExecuteTimes" xml:"SQLExecuteTimes"` - SQLText string `json:"SQLText" xml:"SQLText"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_qps_top_n_items_in_describe_sql_log_report_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_qps_top_n_items_in_describe_sql_log_report_list.go deleted file mode 100644 index f4045c17420..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_qps_top_n_items_in_describe_sql_log_report_list.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// QPSTopNItemsInDescribeSQLLogReportList is a nested struct in rds response -type QPSTopNItemsInDescribeSQLLogReportList struct { - QPSTopNItem []QPSTopNItem `json:"QPSTopNItem" xml:"QPSTopNItem"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_qps_top_n_items_in_describe_sql_log_reports.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_qps_top_n_items_in_describe_sql_log_reports.go deleted file mode 100644 index 13f3f567979..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_qps_top_n_items_in_describe_sql_log_reports.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// QPSTopNItemsInDescribeSQLLogReports is a nested struct in rds response -type QPSTopNItemsInDescribeSQLLogReports struct { - QPSTopNItem []QPSTopNItem `json:"QPSTopNItem" xml:"QPSTopNItem"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_rds_instance_resource_setting.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_rds_instance_resource_setting.go deleted file mode 100644 index 876338e4258..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_rds_instance_resource_setting.go +++ /dev/null @@ -1,29 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// RdsInstanceResourceSetting is a nested struct in rds response -type RdsInstanceResourceSetting struct { - StartDate string `json:"StartDate" xml:"StartDate"` - EndDate string `json:"EndDate" xml:"EndDate"` - ResourceNiche string `json:"ResourceNiche" xml:"ResourceNiche"` - NoticeBarContent string `json:"NoticeBarContent" xml:"NoticeBarContent"` - PoppedUpButtonText string `json:"PoppedUpButtonText" xml:"PoppedUpButtonText"` - PoppedUpButtonType string `json:"PoppedUpButtonType" xml:"PoppedUpButtonType"` - PoppedUpButtonUrl string `json:"PoppedUpButtonUrl" xml:"PoppedUpButtonUrl"` - PoppedUpContent string `json:"PoppedUpContent" xml:"PoppedUpContent"` - IsTop string `json:"IsTop" xml:"IsTop"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_rds_instance_resource_settings.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_rds_instance_resource_settings.go deleted file mode 100644 index 0b3fcc1fb25..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_rds_instance_resource_settings.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// RdsInstanceResourceSettings is a nested struct in rds response -type RdsInstanceResourceSettings struct { - RdsInstanceResourceSetting []RdsInstanceResourceSetting `json:"RdsInstanceResourceSetting" xml:"RdsInstanceResourceSetting"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_rds_region.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_rds_region.go deleted file mode 100644 index 27db26ce71c..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_rds_region.go +++ /dev/null @@ -1,22 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// RDSRegion is a nested struct in rds response -type RDSRegion struct { - RegionId string `json:"RegionId" xml:"RegionId"` - ZoneId string `json:"ZoneId" xml:"ZoneId"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_read_db_instance_names.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_read_db_instance_names.go deleted file mode 100644 index fce4477a081..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_read_db_instance_names.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ReadDBInstanceNames is a nested struct in rds response -type ReadDBInstanceNames struct { - ReadDBInstanceName []string `json:"ReadDBInstanceName" xml:"ReadDBInstanceName"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_read_delay_times.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_read_delay_times.go deleted file mode 100644 index 897cd90cf0f..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_read_delay_times.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ReadDelayTimes is a nested struct in rds response -type ReadDelayTimes struct { - ReadDelayTime []string `json:"ReadDelayTime" xml:"ReadDelayTime"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_read_only_db_instance_id.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_read_only_db_instance_id.go deleted file mode 100644 index be666d7b0b2..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_read_only_db_instance_id.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ReadOnlyDBInstanceId is a nested struct in rds response -type ReadOnlyDBInstanceId struct { - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_read_only_db_instance_ids_in_describe_db_instance_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_read_only_db_instance_ids_in_describe_db_instance_attribute.go deleted file mode 100644 index f3decf847f2..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_read_only_db_instance_ids_in_describe_db_instance_attribute.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ReadOnlyDBInstanceIdsInDescribeDBInstanceAttribute is a nested struct in rds response -type ReadOnlyDBInstanceIdsInDescribeDBInstanceAttribute struct { - ReadOnlyDBInstanceId []ReadOnlyDBInstanceId `json:"ReadOnlyDBInstanceId" xml:"ReadOnlyDBInstanceId"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_read_only_db_instance_ids_in_describe_db_instances.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_read_only_db_instance_ids_in_describe_db_instances.go deleted file mode 100644 index 31bebe12425..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_read_only_db_instance_ids_in_describe_db_instances.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ReadOnlyDBInstanceIdsInDescribeDBInstances is a nested struct in rds response -type ReadOnlyDBInstanceIdsInDescribeDBInstances struct { - ReadOnlyDBInstanceId []ReadOnlyDBInstanceId `json:"ReadOnlyDBInstanceId" xml:"ReadOnlyDBInstanceId"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_read_only_db_instance_ids_in_describe_db_instances_for_clone.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_read_only_db_instance_ids_in_describe_db_instances_for_clone.go deleted file mode 100644 index a7591397bc4..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_read_only_db_instance_ids_in_describe_db_instances_for_clone.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ReadOnlyDBInstanceIdsInDescribeDBInstancesForClone is a nested struct in rds response -type ReadOnlyDBInstanceIdsInDescribeDBInstancesForClone struct { - ReadOnlyDBInstanceId []ReadOnlyDBInstanceId `json:"ReadOnlyDBInstanceId" xml:"ReadOnlyDBInstanceId"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_readonly_instance_delay.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_readonly_instance_delay.go deleted file mode 100644 index 30b80fbfc1c..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_readonly_instance_delay.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ReadonlyInstanceDelay is a nested struct in rds response -type ReadonlyInstanceDelay struct { - ReadonlyInstanceDelayItem []ReadonlyInstanceDelayItem `json:"ReadonlyInstanceDelay" xml:"ReadonlyInstanceDelay"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_readonly_instance_delay_item.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_readonly_instance_delay_item.go deleted file mode 100644 index 16c74bccd18..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_readonly_instance_delay_item.go +++ /dev/null @@ -1,28 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ReadonlyInstanceDelayItem is a nested struct in rds response -type ReadonlyInstanceDelayItem struct { - ReplayLatency string `json:"ReplayLatency" xml:"ReplayLatency"` - FlushLag string `json:"FlushLag" xml:"FlushLag"` - FlushLatency string `json:"FlushLatency" xml:"FlushLatency"` - SendLatency string `json:"SendLatency" xml:"SendLatency"` - WriteLag string `json:"WriteLag" xml:"WriteLag"` - ReplayLag string `json:"ReplayLag" xml:"ReplayLag"` - WriteLatency string `json:"WriteLatency" xml:"WriteLatency"` - ReadDBInstanceName string `json:"ReadDBInstanceName" xml:"ReadDBInstanceName"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_regions_in_describe_available_cross_region.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_regions_in_describe_available_cross_region.go deleted file mode 100644 index f0816e94ab6..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_regions_in_describe_available_cross_region.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// RegionsInDescribeAvailableCrossRegion is a nested struct in rds response -type RegionsInDescribeAvailableCrossRegion struct { - Region []string `json:"Region" xml:"Region"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_regions_in_describe_regions.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_regions_in_describe_regions.go deleted file mode 100644 index 8685701e10a..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_regions_in_describe_regions.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// RegionsInDescribeRegions is a nested struct in rds response -type RegionsInDescribeRegions struct { - RDSRegion []RDSRegion `json:"RDSRegion" xml:"RDSRegion"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_report.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_report.go deleted file mode 100644 index e4172c7843f..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_report.go +++ /dev/null @@ -1,25 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// Report is a nested struct in rds response -type Report struct { - DiagnosticTime string `json:"DiagnosticTime" xml:"DiagnosticTime"` - Score int `json:"Score" xml:"Score"` - StartTime string `json:"StartTime" xml:"StartTime"` - EndTime string `json:"EndTime" xml:"EndTime"` - DownloadURL string `json:"DownloadURL" xml:"DownloadURL"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_report_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_report_list.go deleted file mode 100644 index 2fb1e6db514..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_report_list.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ReportList is a nested struct in rds response -type ReportList struct { - Report []Report `json:"Report" xml:"Report"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_restore_regions.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_restore_regions.go deleted file mode 100644 index 7f00c0ed91c..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_restore_regions.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// RestoreRegions is a nested struct in rds response -type RestoreRegions struct { - RestoreRegion []string `json:"RestoreRegion" xml:"RestoreRegion"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_rule.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_rule.go deleted file mode 100644 index d52a0ae0385..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_rule.go +++ /dev/null @@ -1,23 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// Rule is a nested struct in rds response -type Rule struct { - Name string `json:"Name" xml:"Name"` - RuleId int64 `json:"RuleId" xml:"RuleId"` - Description string `json:"Description" xml:"Description"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_rule_ids_in_describe_price.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_rule_ids_in_describe_price.go deleted file mode 100644 index 791940f06fc..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_rule_ids_in_describe_price.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// RuleIdsInDescribePrice is a nested struct in rds response -type RuleIdsInDescribePrice struct { - RuleId []string `json:"RuleId" xml:"RuleId"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_rule_ids_in_describe_renewal_price.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_rule_ids_in_describe_renewal_price.go deleted file mode 100644 index 5df3b81759e..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_rule_ids_in_describe_renewal_price.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// RuleIdsInDescribeRenewalPrice is a nested struct in rds response -type RuleIdsInDescribeRenewalPrice struct { - RuleId []string `json:"RuleId" xml:"RuleId"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_rules_in_describe_price.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_rules_in_describe_price.go deleted file mode 100644 index acd24523d44..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_rules_in_describe_price.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// RulesInDescribePrice is a nested struct in rds response -type RulesInDescribePrice struct { - Rule []Rule `json:"Rule" xml:"Rule"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_rules_in_describe_renewal_price.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_rules_in_describe_renewal_price.go deleted file mode 100644 index 0913f725e32..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_rules_in_describe_renewal_price.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// RulesInDescribeRenewalPrice is a nested struct in rds response -type RulesInDescribeRenewalPrice struct { - Rule []Rule `json:"Rule" xml:"Rule"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_running_parameters.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_running_parameters.go deleted file mode 100644 index 6189d6b8447..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_running_parameters.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// RunningParameters is a nested struct in rds response -type RunningParameters struct { - DBInstanceParameter []DBInstanceParameter `json:"DBInstanceParameter" xml:"DBInstanceParameter"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_security_ip_group.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_security_ip_group.go deleted file mode 100644 index 1f8756fccfa..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_security_ip_group.go +++ /dev/null @@ -1,22 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// SecurityIPGroup is a nested struct in rds response -type SecurityIPGroup struct { - SecurityIPGroupName string `json:"SecurityIPGroupName" xml:"SecurityIPGroupName"` - SecurityIPs string `json:"SecurityIPs" xml:"SecurityIPs"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_security_ip_groups.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_security_ip_groups.go deleted file mode 100644 index 649ff76f567..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_security_ip_groups.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// SecurityIPGroups is a nested struct in rds response -type SecurityIPGroups struct { - SecurityIPGroup []SecurityIPGroup `json:"securityIPGroup" xml:"securityIPGroup"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_slave_zone.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_slave_zone.go deleted file mode 100644 index b74e43e4262..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_slave_zone.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// SlaveZone is a nested struct in rds response -type SlaveZone struct { - ZoneId string `json:"ZoneId" xml:"ZoneId"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_sql_record.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_sql_record.go deleted file mode 100644 index 450260ed66c..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_sql_record.go +++ /dev/null @@ -1,28 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// SQLRecord is a nested struct in rds response -type SQLRecord struct { - DBName string `json:"DBName" xml:"DBName"` - AccountName string `json:"AccountName" xml:"AccountName"` - HostAddress string `json:"HostAddress" xml:"HostAddress"` - SQLText string `json:"SQLText" xml:"SQLText"` - TotalExecutionTimes int64 `json:"TotalExecutionTimes" xml:"TotalExecutionTimes"` - ReturnRowCounts int64 `json:"ReturnRowCounts" xml:"ReturnRowCounts"` - ExecuteTime string `json:"ExecuteTime" xml:"ExecuteTime"` - ThreadID string `json:"ThreadID" xml:"ThreadID"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_sql_slow_log.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_sql_slow_log.go deleted file mode 100644 index ee76e49f159..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_sql_slow_log.go +++ /dev/null @@ -1,65 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// SQLSlowLog is a nested struct in rds response -type SQLSlowLog struct { - SlowLogId int64 `json:"SlowLogId" xml:"SlowLogId"` - SQLHASH string `json:"SQLHASH" xml:"SQLHASH"` - SQLIdStr string `json:"SQLIdStr" xml:"SQLIdStr"` - DBName string `json:"DBName" xml:"DBName"` - SQLText string `json:"SQLText" xml:"SQLText"` - MySQLTotalExecutionCounts int64 `json:"MySQLTotalExecutionCounts" xml:"MySQLTotalExecutionCounts"` - MySQLTotalExecutionTimes int64 `json:"MySQLTotalExecutionTimes" xml:"MySQLTotalExecutionTimes"` - TotalLockTimes int64 `json:"TotalLockTimes" xml:"TotalLockTimes"` - MaxLockTime int64 `json:"MaxLockTime" xml:"MaxLockTime"` - ParseTotalRowCounts int64 `json:"ParseTotalRowCounts" xml:"ParseTotalRowCounts"` - ParseMaxRowCount int64 `json:"ParseMaxRowCount" xml:"ParseMaxRowCount"` - ReturnTotalRowCounts int64 `json:"ReturnTotalRowCounts" xml:"ReturnTotalRowCounts"` - ReturnMaxRowCount int64 `json:"ReturnMaxRowCount" xml:"ReturnMaxRowCount"` - CreateTime string `json:"CreateTime" xml:"CreateTime"` - SQLServerTotalExecutionCounts int64 `json:"SQLServerTotalExecutionCounts" xml:"SQLServerTotalExecutionCounts"` - SQLServerTotalExecutionTimes int64 `json:"SQLServerTotalExecutionTimes" xml:"SQLServerTotalExecutionTimes"` - TotalLogicalReadCounts int64 `json:"TotalLogicalReadCounts" xml:"TotalLogicalReadCounts"` - TotalPhysicalReadCounts int64 `json:"TotalPhysicalReadCounts" xml:"TotalPhysicalReadCounts"` - ReportTime string `json:"ReportTime" xml:"ReportTime"` - MaxExecutionTime int64 `json:"MaxExecutionTime" xml:"MaxExecutionTime"` - AvgExecutionTime int64 `json:"AvgExecutionTime" xml:"AvgExecutionTime"` - AvgPhysicalReadCounts int64 `json:"AvgPhysicalReadCounts" xml:"AvgPhysicalReadCounts"` - MaxPhysicalReadCounts int64 `json:"MaxPhysicalReadCounts" xml:"MaxPhysicalReadCounts"` - MinPhysicalReadCounts int64 `json:"MinPhysicalReadCounts" xml:"MinPhysicalReadCounts"` - AvgLogicalReadCounts int64 `json:"AvgLogicalReadCounts" xml:"AvgLogicalReadCounts"` - MaxLogicalReadCounts int64 `json:"MaxLogicalReadCounts" xml:"MaxLogicalReadCounts"` - MinLogicalReadCounts int64 `json:"MinLogicalReadCounts" xml:"MinLogicalReadCounts"` - TotalIOWriteCounts int64 `json:"TotalIOWriteCounts" xml:"TotalIOWriteCounts"` - AvgIOWriteCounts int64 `json:"AvgIOWriteCounts" xml:"AvgIOWriteCounts"` - MaxIOWriteCounts int64 `json:"MaxIOWriteCounts" xml:"MaxIOWriteCounts"` - MinIOWriteCounts int64 `json:"MinIOWriteCounts" xml:"MinIOWriteCounts"` - TotalRowsAffectedCounts int64 `json:"TotalRowsAffectedCounts" xml:"TotalRowsAffectedCounts"` - AvgRowsAffectedCounts int64 `json:"AvgRowsAffectedCounts" xml:"AvgRowsAffectedCounts"` - MaxRowsAffectedCounts int64 `json:"MaxRowsAffectedCounts" xml:"MaxRowsAffectedCounts"` - MinRowsAffectedCounts int64 `json:"MinRowsAffectedCounts" xml:"MinRowsAffectedCounts"` - TotalLastRowsAffectedCounts int64 `json:"TotalLastRowsAffectedCounts" xml:"TotalLastRowsAffectedCounts"` - AvgLastRowsAffectedCounts int64 `json:"AvgLastRowsAffectedCounts" xml:"AvgLastRowsAffectedCounts"` - MaxLastRowsAffectedCounts int64 `json:"MaxLastRowsAffectedCounts" xml:"MaxLastRowsAffectedCounts"` - MinLastRowsAffectedCounts int64 `json:"MinLastRowsAffectedCounts" xml:"MinLastRowsAffectedCounts"` - SQLServerMinExecutionTime int64 `json:"SQLServerMinExecutionTime" xml:"SQLServerMinExecutionTime"` - SQLServerAvgExecutionTime int64 `json:"SQLServerAvgExecutionTime" xml:"SQLServerAvgExecutionTime"` - SQLServerTotalCpuTime int64 `json:"SQLServerTotalCpuTime" xml:"SQLServerTotalCpuTime"` - SQLServerAvgCpuTime int64 `json:"SQLServerAvgCpuTime" xml:"SQLServerAvgCpuTime"` - SQLServerMaxCpuTime int64 `json:"SQLServerMaxCpuTime" xml:"SQLServerMaxCpuTime"` - SQLServerMinCpuTime int64 `json:"SQLServerMinCpuTime" xml:"SQLServerMinCpuTime"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_sql_slow_record.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_sql_slow_record.go deleted file mode 100644 index 553d92b834d..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_sql_slow_record.go +++ /dev/null @@ -1,38 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// SQLSlowRecord is a nested struct in rds response -type SQLSlowRecord struct { - HostAddress string `json:"HostAddress" xml:"HostAddress"` - DBName string `json:"DBName" xml:"DBName"` - SQLText string `json:"SQLText" xml:"SQLText"` - QueryTimes int64 `json:"QueryTimes" xml:"QueryTimes"` - LockTimes int64 `json:"LockTimes" xml:"LockTimes"` - ParseRowCounts int64 `json:"ParseRowCounts" xml:"ParseRowCounts"` - ReturnRowCounts int64 `json:"ReturnRowCounts" xml:"ReturnRowCounts"` - ExecutionStartTime string `json:"ExecutionStartTime" xml:"ExecutionStartTime"` - QueryTimeMS int64 `json:"QueryTimeMS" xml:"QueryTimeMS"` - CpuTime int64 `json:"CpuTime" xml:"CpuTime"` - LogicalIORead int64 `json:"LogicalIORead" xml:"LogicalIORead"` - PhysicalIORead int64 `json:"PhysicalIORead" xml:"PhysicalIORead"` - WriteIOCount int64 `json:"WriteIOCount" xml:"WriteIOCount"` - RowsAffectedCount int64 `json:"RowsAffectedCount" xml:"RowsAffectedCount"` - LastRowsAffectedCount int64 `json:"LastRowsAffectedCount" xml:"LastRowsAffectedCount"` - UserName string `json:"UserName" xml:"UserName"` - ApplicationName string `json:"ApplicationName" xml:"ApplicationName"` - ClientHostName string `json:"ClientHostName" xml:"ClientHostName"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_category.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_category.go deleted file mode 100644 index 0c2e59f3fa4..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_category.go +++ /dev/null @@ -1,22 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// SupportedCategory is a nested struct in rds response -type SupportedCategory struct { - Category string `json:"Category" xml:"Category"` - SupportedStorageTypes SupportedStorageTypesInDescribeAvailableResource `json:"SupportedStorageTypes" xml:"SupportedStorageTypes"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_category_in_describe_available_resource.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_category_in_describe_available_resource.go deleted file mode 100644 index fd57246e666..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_category_in_describe_available_resource.go +++ /dev/null @@ -1,22 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// SupportedCategoryInDescribeAvailableResource is a nested struct in rds response -type SupportedCategoryInDescribeAvailableResource struct { - Category string `json:"Category" xml:"Category"` - SupportedStorageTypes SupportedStorageTypesInDescribeAvailableResource `json:"SupportedStorageTypes" xml:"SupportedStorageTypes"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_categorys_in_describe_available_resource.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_categorys_in_describe_available_resource.go deleted file mode 100644 index 552a4d6416f..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_categorys_in_describe_available_resource.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// SupportedCategorysInDescribeAvailableResource is a nested struct in rds response -type SupportedCategorysInDescribeAvailableResource struct { - SupportedCategory []SupportedCategoryInDescribeAvailableResource `json:"SupportedCategory" xml:"SupportedCategory"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_categorys_in_describe_available_zones.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_categorys_in_describe_available_zones.go deleted file mode 100644 index 4481dbd3b51..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_categorys_in_describe_available_zones.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// SupportedCategorysInDescribeAvailableZones is a nested struct in rds response -type SupportedCategorysInDescribeAvailableZones struct { - SupportedCategory []SupportedCategory `json:"SupportedCategory" xml:"SupportedCategory"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_engine.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_engine.go deleted file mode 100644 index 5aea377c9ce..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_engine.go +++ /dev/null @@ -1,22 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// SupportedEngine is a nested struct in rds response -type SupportedEngine struct { - Engine string `json:"Engine" xml:"Engine"` - SupportedEngineVersions SupportedEngineVersionsInDescribeAvailableResource `json:"SupportedEngineVersions" xml:"SupportedEngineVersions"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_engine_in_describe_available_resource.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_engine_in_describe_available_resource.go deleted file mode 100644 index feb74bff94f..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_engine_in_describe_available_resource.go +++ /dev/null @@ -1,22 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// SupportedEngineInDescribeAvailableResource is a nested struct in rds response -type SupportedEngineInDescribeAvailableResource struct { - Engine string `json:"Engine" xml:"Engine"` - SupportedEngineVersions SupportedEngineVersionsInDescribeAvailableResource `json:"SupportedEngineVersions" xml:"SupportedEngineVersions"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_engine_version.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_engine_version.go deleted file mode 100644 index 5ce37caa064..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_engine_version.go +++ /dev/null @@ -1,22 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// SupportedEngineVersion is a nested struct in rds response -type SupportedEngineVersion struct { - Version string `json:"Version" xml:"Version"` - SupportedCategorys SupportedCategorysInDescribeAvailableResource `json:"SupportedCategorys" xml:"SupportedCategorys"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_engine_version_in_describe_available_resource.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_engine_version_in_describe_available_resource.go deleted file mode 100644 index 561202172bd..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_engine_version_in_describe_available_resource.go +++ /dev/null @@ -1,22 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// SupportedEngineVersionInDescribeAvailableResource is a nested struct in rds response -type SupportedEngineVersionInDescribeAvailableResource struct { - Version string `json:"Version" xml:"Version"` - SupportedCategorys SupportedCategorysInDescribeAvailableResource `json:"SupportedCategorys" xml:"SupportedCategorys"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_engine_versions_in_describe_available_resource.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_engine_versions_in_describe_available_resource.go deleted file mode 100644 index 3415c05a5a8..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_engine_versions_in_describe_available_resource.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// SupportedEngineVersionsInDescribeAvailableResource is a nested struct in rds response -type SupportedEngineVersionsInDescribeAvailableResource struct { - SupportedEngineVersion []SupportedEngineVersionInDescribeAvailableResource `json:"SupportedEngineVersion" xml:"SupportedEngineVersion"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_engine_versions_in_describe_available_zones.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_engine_versions_in_describe_available_zones.go deleted file mode 100644 index e82f08ee3d4..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_engine_versions_in_describe_available_zones.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// SupportedEngineVersionsInDescribeAvailableZones is a nested struct in rds response -type SupportedEngineVersionsInDescribeAvailableZones struct { - SupportedEngineVersion []SupportedEngineVersion `json:"SupportedEngineVersion" xml:"SupportedEngineVersion"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_engines_in_describe_available_resource.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_engines_in_describe_available_resource.go deleted file mode 100644 index 204312f56df..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_engines_in_describe_available_resource.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// SupportedEnginesInDescribeAvailableResource is a nested struct in rds response -type SupportedEnginesInDescribeAvailableResource struct { - SupportedEngine []SupportedEngineInDescribeAvailableResource `json:"SupportedEngine" xml:"SupportedEngine"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_engines_in_describe_available_zones.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_engines_in_describe_available_zones.go deleted file mode 100644 index 4971f9d2adf..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_engines_in_describe_available_zones.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// SupportedEnginesInDescribeAvailableZones is a nested struct in rds response -type SupportedEnginesInDescribeAvailableZones struct { - SupportedEngine []SupportedEngine `json:"SupportedEngine" xml:"SupportedEngine"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_storage_type.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_storage_type.go deleted file mode 100644 index 84e1867890f..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_storage_type.go +++ /dev/null @@ -1,22 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// SupportedStorageType is a nested struct in rds response -type SupportedStorageType struct { - StorageType string `json:"StorageType" xml:"StorageType"` - AvailableResources AvailableResources `json:"AvailableResources" xml:"AvailableResources"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_storage_type_in_describe_available_resource.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_storage_type_in_describe_available_resource.go deleted file mode 100644 index 01f271ca0c4..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_storage_type_in_describe_available_resource.go +++ /dev/null @@ -1,22 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// SupportedStorageTypeInDescribeAvailableResource is a nested struct in rds response -type SupportedStorageTypeInDescribeAvailableResource struct { - StorageType string `json:"StorageType" xml:"StorageType"` - AvailableResources AvailableResources `json:"AvailableResources" xml:"AvailableResources"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_storage_types_in_describe_available_resource.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_storage_types_in_describe_available_resource.go deleted file mode 100644 index e48ac9765f5..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_storage_types_in_describe_available_resource.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// SupportedStorageTypesInDescribeAvailableResource is a nested struct in rds response -type SupportedStorageTypesInDescribeAvailableResource struct { - SupportedStorageType []SupportedStorageTypeInDescribeAvailableResource `json:"SupportedStorageType" xml:"SupportedStorageType"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_storage_types_in_describe_available_zones.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_storage_types_in_describe_available_zones.go deleted file mode 100644 index ef815a6c3f2..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_supported_storage_types_in_describe_available_zones.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// SupportedStorageTypesInDescribeAvailableZones is a nested struct in rds response -type SupportedStorageTypesInDescribeAvailableZones struct { - SupportedStorageType []SupportedStorageType `json:"SupportedStorageType" xml:"SupportedStorageType"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_tag_infos.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_tag_infos.go deleted file mode 100644 index db09bf75236..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_tag_infos.go +++ /dev/null @@ -1,23 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// TagInfos is a nested struct in rds response -type TagInfos struct { - TagKey string `json:"TagKey" xml:"TagKey"` - TagValue string `json:"TagValue" xml:"TagValue"` - DBInstanceIds DBInstanceIdsInDescribeTags `json:"DBInstanceIds" xml:"DBInstanceIds"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_tag_resource.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_tag_resource.go deleted file mode 100644 index 1144d28d4d1..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_tag_resource.go +++ /dev/null @@ -1,24 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// TagResource is a nested struct in rds response -type TagResource struct { - TagKey string `json:"TagKey" xml:"TagKey"` - TagValue string `json:"TagValue" xml:"TagValue"` - ResourceType string `json:"ResourceType" xml:"ResourceType"` - ResourceId string `json:"ResourceId" xml:"ResourceId"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_tag_resources.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_tag_resources.go deleted file mode 100644 index 48919ce6236..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_tag_resources.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// TagResources is a nested struct in rds response -type TagResources struct { - TagResource []TagResource `json:"TagResource" xml:"TagResource"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_task_progress_info.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_task_progress_info.go deleted file mode 100644 index 6b50179f35b..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_task_progress_info.go +++ /dev/null @@ -1,35 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// TaskProgressInfo is a nested struct in rds response -type TaskProgressInfo struct { - DBName string `json:"DBName" xml:"DBName"` - BeginTime string `json:"BeginTime" xml:"BeginTime"` - ProgressInfo string `json:"ProgressInfo" xml:"ProgressInfo"` - FinishTime string `json:"FinishTime" xml:"FinishTime"` - TaskAction string `json:"TaskAction" xml:"TaskAction"` - TaskId string `json:"TaskId" xml:"TaskId"` - Progress string `json:"Progress" xml:"Progress"` - ExpectedFinishTime string `json:"ExpectedFinishTime" xml:"ExpectedFinishTime"` - Status string `json:"Status" xml:"Status"` - TaskErrorCode string `json:"TaskErrorCode" xml:"TaskErrorCode"` - TaskErrorMessage string `json:"TaskErrorMessage" xml:"TaskErrorMessage"` - StepsInfo string `json:"StepsInfo" xml:"StepsInfo"` - Remain int `json:"Remain" xml:"Remain"` - StepProgressInfo string `json:"StepProgressInfo" xml:"StepProgressInfo"` - CurrentStepName string `json:"CurrentStepName" xml:"CurrentStepName"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_template_record.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_template_record.go deleted file mode 100644 index af3bf6dbe2e..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_template_record.go +++ /dev/null @@ -1,26 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// TemplateRecord is a nested struct in rds response -type TemplateRecord struct { - ParameterName string `json:"ParameterName" xml:"ParameterName"` - ParameterValue string `json:"ParameterValue" xml:"ParameterValue"` - ForceModify string `json:"ForceModify" xml:"ForceModify"` - ForceRestart string `json:"ForceRestart" xml:"ForceRestart"` - CheckingCode string `json:"CheckingCode" xml:"CheckingCode"` - ParameterDescription string `json:"ParameterDescription" xml:"ParameterDescription"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_values_in_describe_db_instance_performance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_values_in_describe_db_instance_performance.go deleted file mode 100644 index 5f866b0f460..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_values_in_describe_db_instance_performance.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ValuesInDescribeDBInstancePerformance is a nested struct in rds response -type ValuesInDescribeDBInstancePerformance struct { - PerformanceValue []PerformanceValue `json:"PerformanceValue" xml:"PerformanceValue"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_values_in_describe_db_proxy_performance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_values_in_describe_db_proxy_performance.go deleted file mode 100644 index 3276268ffde..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_values_in_describe_db_proxy_performance.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ValuesInDescribeDBProxyPerformance is a nested struct in rds response -type ValuesInDescribeDBProxyPerformance struct { - PerformanceValue []PerformanceValue `json:"PerformanceValue" xml:"PerformanceValue"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_white_list_groups.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_white_list_groups.go deleted file mode 100644 index a853774a6ee..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_white_list_groups.go +++ /dev/null @@ -1,22 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// WhiteListGroups is a nested struct in rds response -type WhiteListGroups struct { - SecurityIpHosts string `json:"SecurityIpHosts" xml:"SecurityIpHosts"` - WhitelistGroupName string `json:"WhitelistGroupName" xml:"WhitelistGroupName"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_words.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_words.go deleted file mode 100644 index 7eddf924c08..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_words.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// Words is a nested struct in rds response -type Words struct { - Word []string `json:"word" xml:"word"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_zone_id_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_zone_id_list.go deleted file mode 100644 index 645db942884..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/struct_zone_id_list.go +++ /dev/null @@ -1,21 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ZoneIDList is a nested struct in rds response -type ZoneIDList struct { - ZoneIDList []string `json:"ZoneIDList" xml:"ZoneIDList"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/switch_db_instance_ha.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/switch_db_instance_ha.go deleted file mode 100644 index 614c604a58d..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/switch_db_instance_ha.go +++ /dev/null @@ -1,107 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// SwitchDBInstanceHA invokes the rds.SwitchDBInstanceHA API synchronously -func (client *Client) SwitchDBInstanceHA(request *SwitchDBInstanceHARequest) (response *SwitchDBInstanceHAResponse, err error) { - response = CreateSwitchDBInstanceHAResponse() - err = client.DoAction(request, response) - return -} - -// SwitchDBInstanceHAWithChan invokes the rds.SwitchDBInstanceHA API asynchronously -func (client *Client) SwitchDBInstanceHAWithChan(request *SwitchDBInstanceHARequest) (<-chan *SwitchDBInstanceHAResponse, <-chan error) { - responseChan := make(chan *SwitchDBInstanceHAResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.SwitchDBInstanceHA(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// SwitchDBInstanceHAWithCallback invokes the rds.SwitchDBInstanceHA API asynchronously -func (client *Client) SwitchDBInstanceHAWithCallback(request *SwitchDBInstanceHARequest, callback func(response *SwitchDBInstanceHAResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *SwitchDBInstanceHAResponse - var err error - defer close(result) - response, err = client.SwitchDBInstanceHA(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// SwitchDBInstanceHARequest is the request struct for api SwitchDBInstanceHA -type SwitchDBInstanceHARequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - EffectiveTime string `position:"Query" name:"EffectiveTime"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - NodeId string `position:"Query" name:"NodeId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - Force string `position:"Query" name:"Force"` - Operation string `position:"Query" name:"Operation"` -} - -// SwitchDBInstanceHAResponse is the response struct for api SwitchDBInstanceHA -type SwitchDBInstanceHAResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateSwitchDBInstanceHARequest creates a request to invoke SwitchDBInstanceHA API -func CreateSwitchDBInstanceHARequest() (request *SwitchDBInstanceHARequest) { - request = &SwitchDBInstanceHARequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "SwitchDBInstanceHA", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateSwitchDBInstanceHAResponse creates a response to parse from SwitchDBInstanceHA response -func CreateSwitchDBInstanceHAResponse() (response *SwitchDBInstanceHAResponse) { - response = &SwitchDBInstanceHAResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/switch_db_instance_net_type.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/switch_db_instance_net_type.go deleted file mode 100644 index aaeba701b5f..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/switch_db_instance_net_type.go +++ /dev/null @@ -1,109 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// SwitchDBInstanceNetType invokes the rds.SwitchDBInstanceNetType API synchronously -func (client *Client) SwitchDBInstanceNetType(request *SwitchDBInstanceNetTypeRequest) (response *SwitchDBInstanceNetTypeResponse, err error) { - response = CreateSwitchDBInstanceNetTypeResponse() - err = client.DoAction(request, response) - return -} - -// SwitchDBInstanceNetTypeWithChan invokes the rds.SwitchDBInstanceNetType API asynchronously -func (client *Client) SwitchDBInstanceNetTypeWithChan(request *SwitchDBInstanceNetTypeRequest) (<-chan *SwitchDBInstanceNetTypeResponse, <-chan error) { - responseChan := make(chan *SwitchDBInstanceNetTypeResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.SwitchDBInstanceNetType(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// SwitchDBInstanceNetTypeWithCallback invokes the rds.SwitchDBInstanceNetType API asynchronously -func (client *Client) SwitchDBInstanceNetTypeWithCallback(request *SwitchDBInstanceNetTypeRequest, callback func(response *SwitchDBInstanceNetTypeResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *SwitchDBInstanceNetTypeResponse - var err error - defer close(result) - response, err = client.SwitchDBInstanceNetType(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// SwitchDBInstanceNetTypeRequest is the request struct for api SwitchDBInstanceNetType -type SwitchDBInstanceNetTypeRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ConnectionStringPrefix string `position:"Query" name:"ConnectionStringPrefix"` - ClientToken string `position:"Query" name:"ClientToken"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - ConnectionStringType string `position:"Query" name:"ConnectionStringType"` - Port string `position:"Query" name:"Port"` -} - -// SwitchDBInstanceNetTypeResponse is the response struct for api SwitchDBInstanceNetType -type SwitchDBInstanceNetTypeResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - OldConnectionString string `json:"OldConnectionString" xml:"OldConnectionString"` - NewConnectionString string `json:"NewConnectionString" xml:"NewConnectionString"` -} - -// CreateSwitchDBInstanceNetTypeRequest creates a request to invoke SwitchDBInstanceNetType API -func CreateSwitchDBInstanceNetTypeRequest() (request *SwitchDBInstanceNetTypeRequest) { - request = &SwitchDBInstanceNetTypeRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "SwitchDBInstanceNetType", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateSwitchDBInstanceNetTypeResponse creates a response to parse from SwitchDBInstanceNetType response -func CreateSwitchDBInstanceNetTypeResponse() (response *SwitchDBInstanceNetTypeResponse) { - response = &SwitchDBInstanceNetTypeResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/switch_db_instance_vpc.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/switch_db_instance_vpc.go deleted file mode 100644 index 844fe6faef1..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/switch_db_instance_vpc.go +++ /dev/null @@ -1,106 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// SwitchDBInstanceVpc invokes the rds.SwitchDBInstanceVpc API synchronously -func (client *Client) SwitchDBInstanceVpc(request *SwitchDBInstanceVpcRequest) (response *SwitchDBInstanceVpcResponse, err error) { - response = CreateSwitchDBInstanceVpcResponse() - err = client.DoAction(request, response) - return -} - -// SwitchDBInstanceVpcWithChan invokes the rds.SwitchDBInstanceVpc API asynchronously -func (client *Client) SwitchDBInstanceVpcWithChan(request *SwitchDBInstanceVpcRequest) (<-chan *SwitchDBInstanceVpcResponse, <-chan error) { - responseChan := make(chan *SwitchDBInstanceVpcResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.SwitchDBInstanceVpc(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// SwitchDBInstanceVpcWithCallback invokes the rds.SwitchDBInstanceVpc API asynchronously -func (client *Client) SwitchDBInstanceVpcWithCallback(request *SwitchDBInstanceVpcRequest, callback func(response *SwitchDBInstanceVpcResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *SwitchDBInstanceVpcResponse - var err error - defer close(result) - response, err = client.SwitchDBInstanceVpc(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// SwitchDBInstanceVpcRequest is the request struct for api SwitchDBInstanceVpc -type SwitchDBInstanceVpcRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - VSwitchId string `position:"Query" name:"VSwitchId"` - PrivateIpAddress string `position:"Query" name:"PrivateIpAddress"` - VPCId string `position:"Query" name:"VPCId"` -} - -// SwitchDBInstanceVpcResponse is the response struct for api SwitchDBInstanceVpc -type SwitchDBInstanceVpcResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateSwitchDBInstanceVpcRequest creates a request to invoke SwitchDBInstanceVpc API -func CreateSwitchDBInstanceVpcRequest() (request *SwitchDBInstanceVpcRequest) { - request = &SwitchDBInstanceVpcRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "SwitchDBInstanceVpc", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateSwitchDBInstanceVpcResponse creates a response to parse from SwitchDBInstanceVpc response -func CreateSwitchDBInstanceVpcResponse() (response *SwitchDBInstanceVpcResponse) { - response = &SwitchDBInstanceVpcResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/tag_resources.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/tag_resources.go deleted file mode 100644 index 900226b1df2..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/tag_resources.go +++ /dev/null @@ -1,110 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// TagResources invokes the rds.TagResources API synchronously -func (client *Client) TagResources(request *TagResourcesRequest) (response *TagResourcesResponse, err error) { - response = CreateTagResourcesResponse() - err = client.DoAction(request, response) - return -} - -// TagResourcesWithChan invokes the rds.TagResources API asynchronously -func (client *Client) TagResourcesWithChan(request *TagResourcesRequest) (<-chan *TagResourcesResponse, <-chan error) { - responseChan := make(chan *TagResourcesResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.TagResources(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// TagResourcesWithCallback invokes the rds.TagResources API asynchronously -func (client *Client) TagResourcesWithCallback(request *TagResourcesRequest, callback func(response *TagResourcesResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *TagResourcesResponse - var err error - defer close(result) - response, err = client.TagResources(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// TagResourcesRequest is the request struct for api TagResources -type TagResourcesRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - Tag *[]TagResourcesTag `position:"Query" name:"Tag" type:"Repeated"` - ResourceId *[]string `position:"Query" name:"ResourceId" type:"Repeated"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - ResourceType string `position:"Query" name:"ResourceType"` -} - -// TagResourcesTag is a repeated param struct in TagResourcesRequest -type TagResourcesTag struct { - Value string `name:"Value"` - Key string `name:"Key"` -} - -// TagResourcesResponse is the response struct for api TagResources -type TagResourcesResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateTagResourcesRequest creates a request to invoke TagResources API -func CreateTagResourcesRequest() (request *TagResourcesRequest) { - request = &TagResourcesRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "TagResources", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateTagResourcesResponse creates a response to parse from TagResources response -func CreateTagResourcesResponse() (response *TagResourcesResponse) { - response = &TagResourcesResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/terminate_migrate_task.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/terminate_migrate_task.go deleted file mode 100644 index 261f0e9e0d5..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/terminate_migrate_task.go +++ /dev/null @@ -1,103 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// TerminateMigrateTask invokes the rds.TerminateMigrateTask API synchronously -func (client *Client) TerminateMigrateTask(request *TerminateMigrateTaskRequest) (response *TerminateMigrateTaskResponse, err error) { - response = CreateTerminateMigrateTaskResponse() - err = client.DoAction(request, response) - return -} - -// TerminateMigrateTaskWithChan invokes the rds.TerminateMigrateTask API asynchronously -func (client *Client) TerminateMigrateTaskWithChan(request *TerminateMigrateTaskRequest) (<-chan *TerminateMigrateTaskResponse, <-chan error) { - responseChan := make(chan *TerminateMigrateTaskResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.TerminateMigrateTask(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// TerminateMigrateTaskWithCallback invokes the rds.TerminateMigrateTask API asynchronously -func (client *Client) TerminateMigrateTaskWithCallback(request *TerminateMigrateTaskRequest, callback func(response *TerminateMigrateTaskResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *TerminateMigrateTaskResponse - var err error - defer close(result) - response, err = client.TerminateMigrateTask(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// TerminateMigrateTaskRequest is the request struct for api TerminateMigrateTask -type TerminateMigrateTaskRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - MigrateTaskId string `position:"Query" name:"MigrateTaskId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// TerminateMigrateTaskResponse is the response struct for api TerminateMigrateTask -type TerminateMigrateTaskResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateTerminateMigrateTaskRequest creates a request to invoke TerminateMigrateTask API -func CreateTerminateMigrateTaskRequest() (request *TerminateMigrateTaskRequest) { - request = &TerminateMigrateTaskRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "TerminateMigrateTask", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateTerminateMigrateTaskResponse creates a response to parse from TerminateMigrateTask response -func CreateTerminateMigrateTaskResponse() (response *TerminateMigrateTaskResponse) { - response = &TerminateMigrateTaskResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/transform_db_instance_pay_type.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/transform_db_instance_pay_type.go deleted file mode 100644 index 75842d65e50..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/transform_db_instance_pay_type.go +++ /dev/null @@ -1,113 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// TransformDBInstancePayType invokes the rds.TransformDBInstancePayType API synchronously -func (client *Client) TransformDBInstancePayType(request *TransformDBInstancePayTypeRequest) (response *TransformDBInstancePayTypeResponse, err error) { - response = CreateTransformDBInstancePayTypeResponse() - err = client.DoAction(request, response) - return -} - -// TransformDBInstancePayTypeWithChan invokes the rds.TransformDBInstancePayType API asynchronously -func (client *Client) TransformDBInstancePayTypeWithChan(request *TransformDBInstancePayTypeRequest) (<-chan *TransformDBInstancePayTypeResponse, <-chan error) { - responseChan := make(chan *TransformDBInstancePayTypeResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.TransformDBInstancePayType(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// TransformDBInstancePayTypeWithCallback invokes the rds.TransformDBInstancePayType API asynchronously -func (client *Client) TransformDBInstancePayTypeWithCallback(request *TransformDBInstancePayTypeRequest, callback func(response *TransformDBInstancePayTypeResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *TransformDBInstancePayTypeResponse - var err error - defer close(result) - response, err = client.TransformDBInstancePayType(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// TransformDBInstancePayTypeRequest is the request struct for api TransformDBInstancePayType -type TransformDBInstancePayTypeRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ClientToken string `position:"Query" name:"ClientToken"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - BusinessInfo string `position:"Query" name:"BusinessInfo"` - Period string `position:"Query" name:"Period"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - Resource string `position:"Query" name:"Resource"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - UsedTime requests.Integer `position:"Query" name:"UsedTime"` - PayType string `position:"Query" name:"PayType"` -} - -// TransformDBInstancePayTypeResponse is the response struct for api TransformDBInstancePayType -type TransformDBInstancePayTypeResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - OrderId int64 `json:"OrderId" xml:"OrderId"` - ChargeType string `json:"ChargeType" xml:"ChargeType"` - ExpiredTime string `json:"ExpiredTime" xml:"ExpiredTime"` - DBInstanceId string `json:"DBInstanceId" xml:"DBInstanceId"` -} - -// CreateTransformDBInstancePayTypeRequest creates a request to invoke TransformDBInstancePayType API -func CreateTransformDBInstancePayTypeRequest() (request *TransformDBInstancePayTypeRequest) { - request = &TransformDBInstancePayTypeRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "TransformDBInstancePayType", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateTransformDBInstancePayTypeResponse creates a response to parse from TransformDBInstancePayType response -func CreateTransformDBInstancePayTypeResponse() (response *TransformDBInstancePayTypeResponse) { - response = &TransformDBInstancePayTypeResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/unlock_account.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/unlock_account.go deleted file mode 100644 index cb28e604a04..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/unlock_account.go +++ /dev/null @@ -1,103 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// UnlockAccount invokes the rds.UnlockAccount API synchronously -func (client *Client) UnlockAccount(request *UnlockAccountRequest) (response *UnlockAccountResponse, err error) { - response = CreateUnlockAccountResponse() - err = client.DoAction(request, response) - return -} - -// UnlockAccountWithChan invokes the rds.UnlockAccount API asynchronously -func (client *Client) UnlockAccountWithChan(request *UnlockAccountRequest) (<-chan *UnlockAccountResponse, <-chan error) { - responseChan := make(chan *UnlockAccountResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.UnlockAccount(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// UnlockAccountWithCallback invokes the rds.UnlockAccount API asynchronously -func (client *Client) UnlockAccountWithCallback(request *UnlockAccountRequest, callback func(response *UnlockAccountResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *UnlockAccountResponse - var err error - defer close(result) - response, err = client.UnlockAccount(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// UnlockAccountRequest is the request struct for api UnlockAccount -type UnlockAccountRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - AccountName string `position:"Query" name:"AccountName"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` -} - -// UnlockAccountResponse is the response struct for api UnlockAccount -type UnlockAccountResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateUnlockAccountRequest creates a request to invoke UnlockAccount API -func CreateUnlockAccountRequest() (request *UnlockAccountRequest) { - request = &UnlockAccountRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "UnlockAccount", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateUnlockAccountResponse creates a response to parse from UnlockAccount response -func CreateUnlockAccountResponse() (response *UnlockAccountResponse) { - response = &UnlockAccountResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/untag_resources.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/untag_resources.go deleted file mode 100644 index 4e92206e99c..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/untag_resources.go +++ /dev/null @@ -1,105 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// UntagResources invokes the rds.UntagResources API synchronously -func (client *Client) UntagResources(request *UntagResourcesRequest) (response *UntagResourcesResponse, err error) { - response = CreateUntagResourcesResponse() - err = client.DoAction(request, response) - return -} - -// UntagResourcesWithChan invokes the rds.UntagResources API asynchronously -func (client *Client) UntagResourcesWithChan(request *UntagResourcesRequest) (<-chan *UntagResourcesResponse, <-chan error) { - responseChan := make(chan *UntagResourcesResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.UntagResources(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// UntagResourcesWithCallback invokes the rds.UntagResources API asynchronously -func (client *Client) UntagResourcesWithCallback(request *UntagResourcesRequest, callback func(response *UntagResourcesResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *UntagResourcesResponse - var err error - defer close(result) - response, err = client.UntagResources(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// UntagResourcesRequest is the request struct for api UntagResources -type UntagResourcesRequest struct { - *requests.RpcRequest - All requests.Boolean `position:"Query" name:"All"` - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceId *[]string `position:"Query" name:"ResourceId" type:"Repeated"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - ResourceType string `position:"Query" name:"ResourceType"` - TagKey *[]string `position:"Query" name:"TagKey" type:"Repeated"` -} - -// UntagResourcesResponse is the response struct for api UntagResources -type UntagResourcesResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateUntagResourcesRequest creates a request to invoke UntagResources API -func CreateUntagResourcesRequest() (request *UntagResourcesRequest) { - request = &UntagResourcesRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "UntagResources", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateUntagResourcesResponse creates a response to parse from UntagResources response -func CreateUntagResourcesResponse() (response *UntagResourcesResponse) { - response = &UntagResourcesResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/upgrade_db_instance_engine_version.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/upgrade_db_instance_engine_version.go deleted file mode 100644 index 7fa9db04383..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/upgrade_db_instance_engine_version.go +++ /dev/null @@ -1,107 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// UpgradeDBInstanceEngineVersion invokes the rds.UpgradeDBInstanceEngineVersion API synchronously -func (client *Client) UpgradeDBInstanceEngineVersion(request *UpgradeDBInstanceEngineVersionRequest) (response *UpgradeDBInstanceEngineVersionResponse, err error) { - response = CreateUpgradeDBInstanceEngineVersionResponse() - err = client.DoAction(request, response) - return -} - -// UpgradeDBInstanceEngineVersionWithChan invokes the rds.UpgradeDBInstanceEngineVersion API asynchronously -func (client *Client) UpgradeDBInstanceEngineVersionWithChan(request *UpgradeDBInstanceEngineVersionRequest) (<-chan *UpgradeDBInstanceEngineVersionResponse, <-chan error) { - responseChan := make(chan *UpgradeDBInstanceEngineVersionResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.UpgradeDBInstanceEngineVersion(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// UpgradeDBInstanceEngineVersionWithCallback invokes the rds.UpgradeDBInstanceEngineVersion API asynchronously -func (client *Client) UpgradeDBInstanceEngineVersionWithCallback(request *UpgradeDBInstanceEngineVersionRequest, callback func(response *UpgradeDBInstanceEngineVersionResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *UpgradeDBInstanceEngineVersionResponse - var err error - defer close(result) - response, err = client.UpgradeDBInstanceEngineVersion(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// UpgradeDBInstanceEngineVersionRequest is the request struct for api UpgradeDBInstanceEngineVersion -type UpgradeDBInstanceEngineVersionRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ClientToken string `position:"Query" name:"ClientToken"` - EngineVersion string `position:"Query" name:"EngineVersion"` - EffectiveTime string `position:"Query" name:"EffectiveTime"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerAccount string `position:"Query" name:"OwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` -} - -// UpgradeDBInstanceEngineVersionResponse is the response struct for api UpgradeDBInstanceEngineVersion -type UpgradeDBInstanceEngineVersionResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - TaskId string `json:"TaskId" xml:"TaskId"` -} - -// CreateUpgradeDBInstanceEngineVersionRequest creates a request to invoke UpgradeDBInstanceEngineVersion API -func CreateUpgradeDBInstanceEngineVersionRequest() (request *UpgradeDBInstanceEngineVersionRequest) { - request = &UpgradeDBInstanceEngineVersionRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "UpgradeDBInstanceEngineVersion", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateUpgradeDBInstanceEngineVersionResponse creates a response to parse from UpgradeDBInstanceEngineVersion response -func CreateUpgradeDBInstanceEngineVersionResponse() (response *UpgradeDBInstanceEngineVersionResponse) { - response = &UpgradeDBInstanceEngineVersionResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/upgrade_db_instance_kernel_version.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/upgrade_db_instance_kernel_version.go deleted file mode 100644 index bbc2624a44d..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/upgrade_db_instance_kernel_version.go +++ /dev/null @@ -1,108 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// UpgradeDBInstanceKernelVersion invokes the rds.UpgradeDBInstanceKernelVersion API synchronously -func (client *Client) UpgradeDBInstanceKernelVersion(request *UpgradeDBInstanceKernelVersionRequest) (response *UpgradeDBInstanceKernelVersionResponse, err error) { - response = CreateUpgradeDBInstanceKernelVersionResponse() - err = client.DoAction(request, response) - return -} - -// UpgradeDBInstanceKernelVersionWithChan invokes the rds.UpgradeDBInstanceKernelVersion API asynchronously -func (client *Client) UpgradeDBInstanceKernelVersionWithChan(request *UpgradeDBInstanceKernelVersionRequest) (<-chan *UpgradeDBInstanceKernelVersionResponse, <-chan error) { - responseChan := make(chan *UpgradeDBInstanceKernelVersionResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.UpgradeDBInstanceKernelVersion(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// UpgradeDBInstanceKernelVersionWithCallback invokes the rds.UpgradeDBInstanceKernelVersion API asynchronously -func (client *Client) UpgradeDBInstanceKernelVersionWithCallback(request *UpgradeDBInstanceKernelVersionRequest, callback func(response *UpgradeDBInstanceKernelVersionResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *UpgradeDBInstanceKernelVersionResponse - var err error - defer close(result) - response, err = client.UpgradeDBInstanceKernelVersion(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// UpgradeDBInstanceKernelVersionRequest is the request struct for api UpgradeDBInstanceKernelVersion -type UpgradeDBInstanceKernelVersionRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - SwitchTime string `position:"Query" name:"SwitchTime"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - TargetMinorVersion string `position:"Query" name:"TargetMinorVersion"` - UpgradeTime string `position:"Query" name:"UpgradeTime"` -} - -// UpgradeDBInstanceKernelVersionResponse is the response struct for api UpgradeDBInstanceKernelVersion -type UpgradeDBInstanceKernelVersionResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceName string `json:"DBInstanceName" xml:"DBInstanceName"` - TaskId string `json:"TaskId" xml:"TaskId"` - TargetMinorVersion string `json:"TargetMinorVersion" xml:"TargetMinorVersion"` -} - -// CreateUpgradeDBInstanceKernelVersionRequest creates a request to invoke UpgradeDBInstanceKernelVersion API -func CreateUpgradeDBInstanceKernelVersionRequest() (request *UpgradeDBInstanceKernelVersionRequest) { - request = &UpgradeDBInstanceKernelVersionRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "UpgradeDBInstanceKernelVersion", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateUpgradeDBInstanceKernelVersionResponse creates a response to parse from UpgradeDBInstanceKernelVersion response -func CreateUpgradeDBInstanceKernelVersionResponse() (response *UpgradeDBInstanceKernelVersionResponse) { - response = &UpgradeDBInstanceKernelVersionResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/upgrade_db_proxy_instance_kernel_version.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/upgrade_db_proxy_instance_kernel_version.go deleted file mode 100644 index 504d105eb7c..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/rds/upgrade_db_proxy_instance_kernel_version.go +++ /dev/null @@ -1,106 +0,0 @@ -package rds - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// UpgradeDBProxyInstanceKernelVersion invokes the rds.UpgradeDBProxyInstanceKernelVersion API synchronously -func (client *Client) UpgradeDBProxyInstanceKernelVersion(request *UpgradeDBProxyInstanceKernelVersionRequest) (response *UpgradeDBProxyInstanceKernelVersionResponse, err error) { - response = CreateUpgradeDBProxyInstanceKernelVersionResponse() - err = client.DoAction(request, response) - return -} - -// UpgradeDBProxyInstanceKernelVersionWithChan invokes the rds.UpgradeDBProxyInstanceKernelVersion API asynchronously -func (client *Client) UpgradeDBProxyInstanceKernelVersionWithChan(request *UpgradeDBProxyInstanceKernelVersionRequest) (<-chan *UpgradeDBProxyInstanceKernelVersionResponse, <-chan error) { - responseChan := make(chan *UpgradeDBProxyInstanceKernelVersionResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.UpgradeDBProxyInstanceKernelVersion(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// UpgradeDBProxyInstanceKernelVersionWithCallback invokes the rds.UpgradeDBProxyInstanceKernelVersion API asynchronously -func (client *Client) UpgradeDBProxyInstanceKernelVersionWithCallback(request *UpgradeDBProxyInstanceKernelVersionRequest, callback func(response *UpgradeDBProxyInstanceKernelVersionResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *UpgradeDBProxyInstanceKernelVersionResponse - var err error - defer close(result) - response, err = client.UpgradeDBProxyInstanceKernelVersion(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// UpgradeDBProxyInstanceKernelVersionRequest is the request struct for api UpgradeDBProxyInstanceKernelVersion -type UpgradeDBProxyInstanceKernelVersionRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` - ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` - OwnerId requests.Integer `position:"Query" name:"OwnerId"` - UpgradeTime string `position:"Query" name:"UpgradeTime"` - DBInstanceId string `position:"Query" name:"DBInstanceId"` - SwitchTime string `position:"Query" name:"SwitchTime"` -} - -// UpgradeDBProxyInstanceKernelVersionResponse is the response struct for api UpgradeDBProxyInstanceKernelVersion -type UpgradeDBProxyInstanceKernelVersionResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DBInstanceName string `json:"DBInstanceName" xml:"DBInstanceName"` - TaskId string `json:"TaskId" xml:"TaskId"` -} - -// CreateUpgradeDBProxyInstanceKernelVersionRequest creates a request to invoke UpgradeDBProxyInstanceKernelVersion API -func CreateUpgradeDBProxyInstanceKernelVersionRequest() (request *UpgradeDBProxyInstanceKernelVersionRequest) { - request = &UpgradeDBProxyInstanceKernelVersionRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Rds", "2014-08-15", "UpgradeDBProxyInstanceKernelVersion", "rds", "openAPI") - request.Method = requests.POST - return -} - -// CreateUpgradeDBProxyInstanceKernelVersionResponse creates a response to parse from UpgradeDBProxyInstanceKernelVersion response -func CreateUpgradeDBProxyInstanceKernelVersionResponse() (response *UpgradeDBProxyInstanceKernelVersionResponse) { - response = &UpgradeDBProxyInstanceKernelVersionResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/slb/create_load_balancer.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/slb/create_load_balancer.go index 3a6d520b930..b587b390a7b 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/slb/create_load_balancer.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/slb/create_load_balancer.go @@ -75,6 +75,7 @@ type CreateLoadBalancerRequest struct { AddressIPVersion string `position:"Query" name:"AddressIPVersion"` MasterZoneId string `position:"Query" name:"MasterZoneId"` ResourceGroupId string `position:"Query" name:"ResourceGroupId"` + SpecType string `position:"Query" name:"SpecType"` LoadBalancerName string `position:"Query" name:"LoadBalancerName"` SlaveZoneId string `position:"Query" name:"SlaveZoneId"` LoadBalancerSpec string `position:"Query" name:"LoadBalancerSpec"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/slb/describe_load_balancer_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/slb/describe_load_balancer_attribute.go index ee6e6f18b2f..08d40f04836 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/slb/describe_load_balancer_attribute.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/slb/describe_load_balancer_attribute.go @@ -128,6 +128,8 @@ type DescribeLoadBalancerAttributeResponse struct { BusinessStatus string `json:"BusinessStatus" xml:"BusinessStatus"` ModificationProtectionStatus string `json:"ModificationProtectionStatus" xml:"ModificationProtectionStatus"` ModificationProtectionReason string `json:"ModificationProtectionReason" xml:"ModificationProtectionReason"` + SpecBpsFlag bool `json:"SpecBpsFlag" xml:"SpecBpsFlag"` + SpecType string `json:"SpecType" xml:"SpecType"` ListenerPorts ListenerPorts `json:"ListenerPorts" xml:"ListenerPorts"` Labels Labels `json:"Labels" xml:"Labels"` ListenerPortsAndProtocal ListenerPortsAndProtocal `json:"ListenerPortsAndProtocal" xml:"ListenerPortsAndProtocal"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/slb/struct_load_balancer.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/slb/struct_load_balancer.go index 450151957b9..7daf31ebc04 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/slb/struct_load_balancer.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/slb/struct_load_balancer.go @@ -42,5 +42,7 @@ type LoadBalancer struct { InternetChargeTypeAlias string `json:"InternetChargeTypeAlias" xml:"InternetChargeTypeAlias"` LoadBalancerSpec string `json:"LoadBalancerSpec" xml:"LoadBalancerSpec"` DeleteProtection string `json:"DeleteProtection" xml:"DeleteProtection"` + SpecBpsFlag bool `json:"SpecBpsFlag" xml:"SpecBpsFlag"` + SpecType string `json:"SpecType" xml:"SpecType"` Tags TagsInDescribeLoadBalancers `json:"Tags" xml:"Tags"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/analyze_product_log.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/analyze_product_log.go index abdea785a05..36944d7c18d 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/analyze_product_log.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/analyze_product_log.go @@ -77,8 +77,8 @@ type AnalyzeProductLogRequest struct { VariableMap string `position:"Query" name:"VariableMap"` TTL requests.Integer `position:"Query" name:"TTL"` ClientIp string `position:"Query" name:"ClientIp"` - Region string `position:"Query" name:"Region"` Lang string `position:"Query" name:"Lang"` + Region string `position:"Query" name:"Region"` Logstore string `position:"Query" name:"Logstore"` Overwrite requests.Boolean `position:"Query" name:"Overwrite"` } @@ -97,7 +97,7 @@ func CreateAnalyzeProductLogRequest() (request *AnalyzeProductLogRequest) { request = &AnalyzeProductLogRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Sls", "2018-06-13", "AnalyzeProductLog", "", "") + request.InitWithApiInfo("Sls", "2019-10-23", "AnalyzeProductLog", "", "") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/create_app.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/create_app.go index e2e61abc0b3..3442e7a7b37 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/create_app.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/create_app.go @@ -71,8 +71,10 @@ func (client *Client) CreateAppWithCallback(request *CreateAppRequest, callback // CreateAppRequest is the request struct for api CreateApp type CreateAppRequest struct { *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` AppName string `position:"Query" name:"AppName"` DisplayName string `position:"Query" name:"DisplayName"` + ClientIp string `position:"Query" name:"ClientIp"` Config string `position:"Body" name:"Config"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/create_import_ingestion_job.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/create_import_ingestion_job.go new file mode 100644 index 00000000000..0192d5fc982 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/create_import_ingestion_job.go @@ -0,0 +1,113 @@ +package sls + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// CreateImportIngestionJob invokes the sls.CreateImportIngestionJob API synchronously +func (client *Client) CreateImportIngestionJob(request *CreateImportIngestionJobRequest) (response *CreateImportIngestionJobResponse, err error) { + response = CreateCreateImportIngestionJobResponse() + err = client.DoAction(request, response) + return +} + +// CreateImportIngestionJobWithChan invokes the sls.CreateImportIngestionJob API asynchronously +func (client *Client) CreateImportIngestionJobWithChan(request *CreateImportIngestionJobRequest) (<-chan *CreateImportIngestionJobResponse, <-chan error) { + responseChan := make(chan *CreateImportIngestionJobResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.CreateImportIngestionJob(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// CreateImportIngestionJobWithCallback invokes the sls.CreateImportIngestionJob API asynchronously +func (client *Client) CreateImportIngestionJobWithCallback(request *CreateImportIngestionJobRequest, callback func(response *CreateImportIngestionJobResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *CreateImportIngestionJobResponse + var err error + defer close(result) + response, err = client.CreateImportIngestionJob(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// CreateImportIngestionJobRequest is the request struct for api CreateImportIngestionJob +type CreateImportIngestionJobRequest struct { + *requests.RpcRequest + Args string `position:"Body" name:"Args"` + Image string `position:"Body" name:"Image"` + EnvFromSecret string `position:"Body" name:"EnvFromSecret"` + RestartPolicy string `position:"Body" name:"RestartPolicy"` + Parallelism requests.Integer `position:"Body" name:"Parallelism"` + Namespace string `position:"Body" name:"Namespace"` + Completions requests.Integer `position:"Body" name:"Completions"` + EnvVars string `position:"Body" name:"EnvVars"` + ImagePullSecret string `position:"Body" name:"ImagePullSecret"` + CallerId string `position:"Body" name:"CallerId"` + Region string `position:"Body" name:"Region"` + JobName string `position:"Body" name:"JobName"` +} + +// CreateImportIngestionJobResponse is the response struct for api CreateImportIngestionJob +type CreateImportIngestionJobResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` +} + +// CreateCreateImportIngestionJobRequest creates a request to invoke CreateImportIngestionJob API +func CreateCreateImportIngestionJobRequest() (request *CreateImportIngestionJobRequest) { + request = &CreateImportIngestionJobRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Sls", "2019-10-23", "CreateImportIngestionJob", "", "") + request.Method = requests.POST + return +} + +// CreateCreateImportIngestionJobResponse creates a response to parse from CreateImportIngestionJob response +func CreateCreateImportIngestionJobResponse() (response *CreateImportIngestionJobResponse) { + response = &CreateImportIngestionJobResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/create_ingestion_job.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/create_ingestion_job.go new file mode 100644 index 00000000000..bfc717a3956 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/create_ingestion_job.go @@ -0,0 +1,113 @@ +package sls + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// CreateIngestionJob invokes the sls.CreateIngestionJob API synchronously +func (client *Client) CreateIngestionJob(request *CreateIngestionJobRequest) (response *CreateIngestionJobResponse, err error) { + response = CreateCreateIngestionJobResponse() + err = client.DoAction(request, response) + return +} + +// CreateIngestionJobWithChan invokes the sls.CreateIngestionJob API asynchronously +func (client *Client) CreateIngestionJobWithChan(request *CreateIngestionJobRequest) (<-chan *CreateIngestionJobResponse, <-chan error) { + responseChan := make(chan *CreateIngestionJobResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.CreateIngestionJob(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// CreateIngestionJobWithCallback invokes the sls.CreateIngestionJob API asynchronously +func (client *Client) CreateIngestionJobWithCallback(request *CreateIngestionJobRequest, callback func(response *CreateIngestionJobResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *CreateIngestionJobResponse + var err error + defer close(result) + response, err = client.CreateIngestionJob(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// CreateIngestionJobRequest is the request struct for api CreateIngestionJob +type CreateIngestionJobRequest struct { + *requests.RpcRequest + Args string `position:"Body" name:"Args"` + Image string `position:"Body" name:"Image"` + EnvFromSecret string `position:"Body" name:"EnvFromSecret"` + RestartPolicy string `position:"Body" name:"RestartPolicy"` + Parallelism requests.Integer `position:"Body" name:"Parallelism"` + Namespace string `position:"Body" name:"Namespace"` + Completions requests.Integer `position:"Body" name:"Completions"` + EnvVars string `position:"Body" name:"EnvVars"` + ImagePullSecret string `position:"Body" name:"ImagePullSecret"` + CallerId string `position:"Body" name:"CallerId"` + Region string `position:"Body" name:"Region"` + JobName string `position:"Body" name:"JobName"` +} + +// CreateIngestionJobResponse is the response struct for api CreateIngestionJob +type CreateIngestionJobResponse struct { + *responses.BaseResponse + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateCreateIngestionJobRequest creates a request to invoke CreateIngestionJob API +func CreateCreateIngestionJobRequest() (request *CreateIngestionJobRequest) { + request = &CreateIngestionJobRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Sls", "2019-10-23", "CreateIngestionJob", "", "") + request.Method = requests.POST + return +} + +// CreateCreateIngestionJobResponse creates a response to parse from CreateIngestionJob response +func CreateCreateIngestionJobResponse() (response *CreateIngestionJobResponse) { + response = &CreateIngestionJobResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/delete_app.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/delete_app.go index b2ac92465af..06daa1fd5b1 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/delete_app.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/delete_app.go @@ -71,7 +71,8 @@ func (client *Client) DeleteAppWithCallback(request *DeleteAppRequest, callback // DeleteAppRequest is the request struct for api DeleteApp type DeleteAppRequest struct { *requests.RpcRequest - AppName string `position:"Query" name:"AppName"` + AppName string `position:"Query" name:"AppName"` + ClientIp string `position:"Query" name:"ClientIp"` } // DeleteAppResponse is the response struct for api DeleteApp diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/delete_import_ingestion_job.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/delete_import_ingestion_job.go new file mode 100644 index 00000000000..b972d26a12f --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/delete_import_ingestion_job.go @@ -0,0 +1,104 @@ +package sls + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DeleteImportIngestionJob invokes the sls.DeleteImportIngestionJob API synchronously +func (client *Client) DeleteImportIngestionJob(request *DeleteImportIngestionJobRequest) (response *DeleteImportIngestionJobResponse, err error) { + response = CreateDeleteImportIngestionJobResponse() + err = client.DoAction(request, response) + return +} + +// DeleteImportIngestionJobWithChan invokes the sls.DeleteImportIngestionJob API asynchronously +func (client *Client) DeleteImportIngestionJobWithChan(request *DeleteImportIngestionJobRequest) (<-chan *DeleteImportIngestionJobResponse, <-chan error) { + responseChan := make(chan *DeleteImportIngestionJobResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DeleteImportIngestionJob(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DeleteImportIngestionJobWithCallback invokes the sls.DeleteImportIngestionJob API asynchronously +func (client *Client) DeleteImportIngestionJobWithCallback(request *DeleteImportIngestionJobRequest, callback func(response *DeleteImportIngestionJobResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DeleteImportIngestionJobResponse + var err error + defer close(result) + response, err = client.DeleteImportIngestionJob(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DeleteImportIngestionJobRequest is the request struct for api DeleteImportIngestionJob +type DeleteImportIngestionJobRequest struct { + *requests.RpcRequest + Namespace string `position:"Body" name:"Namespace"` + Region string `position:"Body" name:"Region"` + JobName string `position:"Body" name:"JobName"` +} + +// DeleteImportIngestionJobResponse is the response struct for api DeleteImportIngestionJob +type DeleteImportIngestionJobResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` +} + +// CreateDeleteImportIngestionJobRequest creates a request to invoke DeleteImportIngestionJob API +func CreateDeleteImportIngestionJobRequest() (request *DeleteImportIngestionJobRequest) { + request = &DeleteImportIngestionJobRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Sls", "2019-10-23", "DeleteImportIngestionJob", "", "") + request.Method = requests.POST + return +} + +// CreateDeleteImportIngestionJobResponse creates a response to parse from DeleteImportIngestionJob response +func CreateDeleteImportIngestionJobResponse() (response *DeleteImportIngestionJobResponse) { + response = &DeleteImportIngestionJobResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/delete_ingestion_job.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/delete_ingestion_job.go new file mode 100644 index 00000000000..ecf3d208273 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/delete_ingestion_job.go @@ -0,0 +1,104 @@ +package sls + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DeleteIngestionJob invokes the sls.DeleteIngestionJob API synchronously +func (client *Client) DeleteIngestionJob(request *DeleteIngestionJobRequest) (response *DeleteIngestionJobResponse, err error) { + response = CreateDeleteIngestionJobResponse() + err = client.DoAction(request, response) + return +} + +// DeleteIngestionJobWithChan invokes the sls.DeleteIngestionJob API asynchronously +func (client *Client) DeleteIngestionJobWithChan(request *DeleteIngestionJobRequest) (<-chan *DeleteIngestionJobResponse, <-chan error) { + responseChan := make(chan *DeleteIngestionJobResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DeleteIngestionJob(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DeleteIngestionJobWithCallback invokes the sls.DeleteIngestionJob API asynchronously +func (client *Client) DeleteIngestionJobWithCallback(request *DeleteIngestionJobRequest, callback func(response *DeleteIngestionJobResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DeleteIngestionJobResponse + var err error + defer close(result) + response, err = client.DeleteIngestionJob(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DeleteIngestionJobRequest is the request struct for api DeleteIngestionJob +type DeleteIngestionJobRequest struct { + *requests.RpcRequest + Namespace string `position:"Body" name:"Namespace"` + Region string `position:"Body" name:"Region"` + JobName string `position:"Body" name:"JobName"` +} + +// DeleteIngestionJobResponse is the response struct for api DeleteIngestionJob +type DeleteIngestionJobResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` +} + +// CreateDeleteIngestionJobRequest creates a request to invoke DeleteIngestionJob API +func CreateDeleteIngestionJobRequest() (request *DeleteIngestionJobRequest) { + request = &DeleteIngestionJobRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Sls", "2019-10-23", "DeleteIngestionJob", "", "") + request.Method = requests.POST + return +} + +// CreateDeleteIngestionJobResponse creates a response to parse from DeleteIngestionJob response +func CreateDeleteIngestionJobResponse() (response *DeleteIngestionJobResponse) { + response = &DeleteIngestionJobResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/delete_log_resource.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/delete_log_resource.go deleted file mode 100644 index 180c61de664..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/delete_log_resource.go +++ /dev/null @@ -1,104 +0,0 @@ -package sls - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DeleteLogResource invokes the sls.DeleteLogResource API synchronously -func (client *Client) DeleteLogResource(request *DeleteLogResourceRequest) (response *DeleteLogResourceResponse, err error) { - response = CreateDeleteLogResourceResponse() - err = client.DoAction(request, response) - return -} - -// DeleteLogResourceWithChan invokes the sls.DeleteLogResource API asynchronously -func (client *Client) DeleteLogResourceWithChan(request *DeleteLogResourceRequest) (<-chan *DeleteLogResourceResponse, <-chan error) { - responseChan := make(chan *DeleteLogResourceResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DeleteLogResource(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DeleteLogResourceWithCallback invokes the sls.DeleteLogResource API asynchronously -func (client *Client) DeleteLogResourceWithCallback(request *DeleteLogResourceRequest, callback func(response *DeleteLogResourceResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DeleteLogResourceResponse - var err error - defer close(result) - response, err = client.DeleteLogResource(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DeleteLogResourceRequest is the request struct for api DeleteLogResource -type DeleteLogResourceRequest struct { - *requests.RpcRequest - Project string `position:"Query" name:"Project"` - Region string `position:"Query" name:"Region"` - Logstore string `position:"Query" name:"Logstore"` -} - -// DeleteLogResourceResponse is the response struct for api DeleteLogResource -type DeleteLogResourceResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Code string `json:"Code" xml:"Code"` - Success string `json:"Success" xml:"Success"` - Message string `json:"Message" xml:"Message"` -} - -// CreateDeleteLogResourceRequest creates a request to invoke DeleteLogResource API -func CreateDeleteLogResourceRequest() (request *DeleteLogResourceRequest) { - request = &DeleteLogResourceRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Sls", "2018-06-13", "DeleteLogResource", "", "") - request.Method = requests.POST - return -} - -// CreateDeleteLogResourceResponse creates a response to parse from DeleteLogResource response -func CreateDeleteLogResourceResponse() (response *DeleteLogResourceResponse) { - response = &DeleteLogResourceResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/describe_app.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/describe_app.go index 95cb89fe40f..e72eb3aca6a 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/describe_app.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/describe_app.go @@ -71,7 +71,8 @@ func (client *Client) DescribeAppWithCallback(request *DescribeAppRequest, callb // DescribeAppRequest is the request struct for api DescribeApp type DescribeAppRequest struct { *requests.RpcRequest - AppName string `position:"Query" name:"AppName"` + AppName string `position:"Query" name:"AppName"` + ClientIp string `position:"Query" name:"ClientIp"` } // DescribeAppResponse is the response struct for api DescribeApp diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/init_project_alert_resource.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/init_project_alert_resource.go new file mode 100644 index 00000000000..2d6dd94e42c --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/init_project_alert_resource.go @@ -0,0 +1,104 @@ +package sls + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// InitProjectAlertResource invokes the sls.InitProjectAlertResource API synchronously +func (client *Client) InitProjectAlertResource(request *InitProjectAlertResourceRequest) (response *InitProjectAlertResourceResponse, err error) { + response = CreateInitProjectAlertResourceResponse() + err = client.DoAction(request, response) + return +} + +// InitProjectAlertResourceWithChan invokes the sls.InitProjectAlertResource API asynchronously +func (client *Client) InitProjectAlertResourceWithChan(request *InitProjectAlertResourceRequest) (<-chan *InitProjectAlertResourceResponse, <-chan error) { + responseChan := make(chan *InitProjectAlertResourceResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.InitProjectAlertResource(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// InitProjectAlertResourceWithCallback invokes the sls.InitProjectAlertResource API asynchronously +func (client *Client) InitProjectAlertResourceWithCallback(request *InitProjectAlertResourceRequest, callback func(response *InitProjectAlertResourceResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *InitProjectAlertResourceResponse + var err error + defer close(result) + response, err = client.InitProjectAlertResource(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// InitProjectAlertResourceRequest is the request struct for api InitProjectAlertResource +type InitProjectAlertResourceRequest struct { + *requests.RpcRequest + ProjectName string `position:"Body" name:"ProjectName"` + Region string `position:"Body" name:"Region"` +} + +// InitProjectAlertResourceResponse is the response struct for api InitProjectAlertResource +type InitProjectAlertResourceResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + HttpStatusCode int `json:"HttpStatusCode" xml:"HttpStatusCode"` +} + +// CreateInitProjectAlertResourceRequest creates a request to invoke InitProjectAlertResource API +func CreateInitProjectAlertResourceRequest() (request *InitProjectAlertResourceRequest) { + request = &InitProjectAlertResourceRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Sls", "2019-10-23", "InitProjectAlertResource", "", "") + request.Method = requests.POST + return +} + +// CreateInitProjectAlertResourceResponse creates a response to parse from InitProjectAlertResource response +func CreateInitProjectAlertResourceResponse() (response *InitProjectAlertResourceResponse) { + response = &InitProjectAlertResourceResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/init_user_alert_resource.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/init_user_alert_resource.go new file mode 100644 index 00000000000..2dbd7fbf741 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/init_user_alert_resource.go @@ -0,0 +1,105 @@ +package sls + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// InitUserAlertResource invokes the sls.InitUserAlertResource API synchronously +func (client *Client) InitUserAlertResource(request *InitUserAlertResourceRequest) (response *InitUserAlertResourceResponse, err error) { + response = CreateInitUserAlertResourceResponse() + err = client.DoAction(request, response) + return +} + +// InitUserAlertResourceWithChan invokes the sls.InitUserAlertResource API asynchronously +func (client *Client) InitUserAlertResourceWithChan(request *InitUserAlertResourceRequest) (<-chan *InitUserAlertResourceResponse, <-chan error) { + responseChan := make(chan *InitUserAlertResourceResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.InitUserAlertResource(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// InitUserAlertResourceWithCallback invokes the sls.InitUserAlertResource API asynchronously +func (client *Client) InitUserAlertResourceWithCallback(request *InitUserAlertResourceRequest, callback func(response *InitUserAlertResourceResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *InitUserAlertResourceResponse + var err error + defer close(result) + response, err = client.InitUserAlertResource(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// InitUserAlertResourceRequest is the request struct for api InitUserAlertResource +type InitUserAlertResourceRequest struct { + *requests.RpcRequest + App string `position:"Body" name:"App"` + Language string `position:"Body" name:"Language"` + Region string `position:"Body" name:"Region"` +} + +// InitUserAlertResourceResponse is the response struct for api InitUserAlertResource +type InitUserAlertResourceResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Message string `json:"Message" xml:"Message"` + Code string `json:"Code" xml:"Code"` + HttpStatusCode int `json:"HttpStatusCode" xml:"HttpStatusCode"` +} + +// CreateInitUserAlertResourceRequest creates a request to invoke InitUserAlertResource API +func CreateInitUserAlertResourceRequest() (request *InitUserAlertResourceRequest) { + request = &InitUserAlertResourceRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Sls", "2019-10-23", "InitUserAlertResource", "", "") + request.Method = requests.POST + return +} + +// CreateInitUserAlertResourceResponse creates a response to parse from InitUserAlertResource response +func CreateInitUserAlertResourceResponse() (response *InitUserAlertResourceResponse) { + response = &InitUserAlertResourceResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/set_alert_action_policy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/set_alert_action_policy.go index c3ca142a8bf..ef05d07e79d 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/set_alert_action_policy.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/set_alert_action_policy.go @@ -71,9 +71,10 @@ func (client *Client) SetAlertActionPolicyWithCallback(request *SetAlertActionPo // SetAlertActionPolicyRequest is the request struct for api SetAlertActionPolicy type SetAlertActionPolicyRequest struct { *requests.RpcRequest - App string `position:"Body" name:"App"` - PolicyId string `position:"Body" name:"PolicyId"` - Policy string `position:"Body" name:"Policy"` + App string `position:"Body" name:"App"` + PolicyId string `position:"Body" name:"PolicyId"` + PolicyName string `position:"Body" name:"PolicyName"` + Policy string `position:"Body" name:"Policy"` } // SetAlertActionPolicyResponse is the response struct for api SetAlertActionPolicy diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/set_alert_center_resource_by_console.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/set_alert_center_resource_by_console.go new file mode 100644 index 00000000000..89e55972bb7 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/set_alert_center_resource_by_console.go @@ -0,0 +1,104 @@ +package sls + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// SetAlertCenterResourceByConsole invokes the sls.SetAlertCenterResourceByConsole API synchronously +func (client *Client) SetAlertCenterResourceByConsole(request *SetAlertCenterResourceByConsoleRequest) (response *SetAlertCenterResourceByConsoleResponse, err error) { + response = CreateSetAlertCenterResourceByConsoleResponse() + err = client.DoAction(request, response) + return +} + +// SetAlertCenterResourceByConsoleWithChan invokes the sls.SetAlertCenterResourceByConsole API asynchronously +func (client *Client) SetAlertCenterResourceByConsoleWithChan(request *SetAlertCenterResourceByConsoleRequest) (<-chan *SetAlertCenterResourceByConsoleResponse, <-chan error) { + responseChan := make(chan *SetAlertCenterResourceByConsoleResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.SetAlertCenterResourceByConsole(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// SetAlertCenterResourceByConsoleWithCallback invokes the sls.SetAlertCenterResourceByConsole API asynchronously +func (client *Client) SetAlertCenterResourceByConsoleWithCallback(request *SetAlertCenterResourceByConsoleRequest, callback func(response *SetAlertCenterResourceByConsoleResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *SetAlertCenterResourceByConsoleResponse + var err error + defer close(result) + response, err = client.SetAlertCenterResourceByConsole(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// SetAlertCenterResourceByConsoleRequest is the request struct for api SetAlertCenterResourceByConsole +type SetAlertCenterResourceByConsoleRequest struct { + *requests.RpcRequest + App string `position:"Body" name:"App"` + Language string `position:"Body" name:"Language"` + Region string `position:"Body" name:"Region"` +} + +// SetAlertCenterResourceByConsoleResponse is the response struct for api SetAlertCenterResourceByConsole +type SetAlertCenterResourceByConsoleResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Message string `json:"Message" xml:"Message"` + Code string `json:"Code" xml:"Code"` +} + +// CreateSetAlertCenterResourceByConsoleRequest creates a request to invoke SetAlertCenterResourceByConsole API +func CreateSetAlertCenterResourceByConsoleRequest() (request *SetAlertCenterResourceByConsoleRequest) { + request = &SetAlertCenterResourceByConsoleRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Sls", "2019-10-23", "SetAlertCenterResourceByConsole", "", "") + request.Method = requests.POST + return +} + +// CreateSetAlertCenterResourceByConsoleResponse creates a response to parse from SetAlertCenterResourceByConsole response +func CreateSetAlertCenterResourceByConsoleResponse() (response *SetAlertCenterResourceByConsoleResponse) { + response = &SetAlertCenterResourceByConsoleResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/sync_alert_users.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/sync_alert_users.go index 7dd68e56fdb..afd8a356579 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/sync_alert_users.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/sync_alert_users.go @@ -78,11 +78,11 @@ type SyncAlertUsersRequest struct { // SyncAlertUsersResponse is the response struct for api SyncAlertUsers type SyncAlertUsersResponse struct { *responses.BaseResponse - Code bool `json:"Code" xml:"Code"` - Data string `json:"Data" xml:"Data"` - Message string `json:"Message" xml:"Message"` RequestId string `json:"RequestId" xml:"RequestId"` Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data string `json:"Data" xml:"Data"` } // CreateSyncAlertUsersRequest creates a request to invoke SyncAlertUsers API @@ -90,7 +90,7 @@ func CreateSyncAlertUsersRequest() (request *SyncAlertUsersRequest) { request = &SyncAlertUsersRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Sls", "2018-06-13", "SyncAlertUsers", "", "") + request.InitWithApiInfo("Sls", "2019-10-23", "SyncAlertUsers", "", "") request.Method = requests.POST return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/update_app.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/update_app.go index d4c1b060179..f2809161fce 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/update_app.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/update_app.go @@ -73,6 +73,7 @@ type UpdateAppRequest struct { *requests.RpcRequest AppName string `position:"Query" name:"AppName"` DisplayName string `position:"Query" name:"DisplayName"` + ClientIp string `position:"Query" name:"ClientIp"` Config string `position:"Body" name:"Config"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/activate_smart_access_gateway.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/activate_smart_access_gateway.go index e9cfdbce51a..75186b1c568 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/activate_smart_access_gateway.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/activate_smart_access_gateway.go @@ -71,11 +71,11 @@ func (client *Client) ActivateSmartAccessGatewayWithCallback(request *ActivateSm // ActivateSmartAccessGatewayRequest is the request struct for api ActivateSmartAccessGateway type ActivateSmartAccessGatewayRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // ActivateSmartAccessGatewayResponse is the response struct for api ActivateSmartAccessGateway diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/active_flow_log.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/active_flow_log.go index 64041e992e2..f23c92f4e21 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/active_flow_log.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/active_flow_log.go @@ -71,11 +71,11 @@ func (client *Client) ActiveFlowLogWithCallback(request *ActiveFlowLogRequest, c // ActiveFlowLogRequest is the request struct for api ActiveFlowLog type ActiveFlowLogRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - FlowLogId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + FlowLogId string `position:"Query" name:"FlowLogId"` } // ActiveFlowLogResponse is the response struct for api ActiveFlowLog diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/add_acl_rule.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/add_acl_rule.go index 2e164798649..d65a9cad5a5 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/add_acl_rule.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/add_acl_rule.go @@ -72,23 +72,23 @@ func (client *Client) AddACLRuleWithCallback(request *AddACLRuleRequest, callbac type AddACLRuleRequest struct { *requests.RpcRequest DpiGroupIds *[]string `position:"Query" name:"DpiGroupIds" type:"Repeated"` - ResourceOwnerId requests.Integer `position:"Query"` - SourcePortRange string `position:"Query"` - SourceCidr string `position:"Query"` - Description string `position:"Query"` - Type string `position:"Query"` - DestCidr string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + SourcePortRange string `position:"Query" name:"SourcePortRange"` + SourceCidr string `position:"Query" name:"SourceCidr"` + Description string `position:"Query" name:"Description"` + Type string `position:"Query" name:"Type"` + DestCidr string `position:"Query" name:"DestCidr"` DpiSignatureIds *[]string `position:"Query" name:"DpiSignatureIds" type:"Repeated"` - Direction string `position:"Query"` - Policy string `position:"Query"` - AclId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - IpProtocol string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - Priority requests.Integer `position:"Query"` - DestPortRange string `position:"Query"` - Name string `position:"Query"` + Direction string `position:"Query" name:"Direction"` + Policy string `position:"Query" name:"Policy"` + AclId string `position:"Query" name:"AclId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + IpProtocol string `position:"Query" name:"IpProtocol"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + Priority requests.Integer `position:"Query" name:"Priority"` + DestPortRange string `position:"Query" name:"DestPortRange"` + Name string `position:"Query" name:"Name"` } // AddACLRuleResponse is the response struct for api AddACLRule @@ -96,8 +96,8 @@ type AddACLRuleResponse struct { *responses.BaseResponse Policy string `json:"Policy" xml:"Policy"` Description string `json:"Description" xml:"Description"` - SourcePortRange string `json:"SourcePortRange" xml:"SourcePortRange"` RequestId string `json:"RequestId" xml:"RequestId"` + SourcePortRange string `json:"SourcePortRange" xml:"SourcePortRange"` SourceCidr string `json:"SourceCidr" xml:"SourceCidr"` Priority int `json:"Priority" xml:"Priority"` AclId string `json:"AclId" xml:"AclId"` @@ -105,12 +105,12 @@ type AddACLRuleResponse struct { DestPortRange string `json:"DestPortRange" xml:"DestPortRange"` Direction string `json:"Direction" xml:"Direction"` Name string `json:"Name" xml:"Name"` - GmtCreate int64 `json:"GmtCreate" xml:"GmtCreate"` Type string `json:"Type" xml:"Type"` + GmtCreate int64 `json:"GmtCreate" xml:"GmtCreate"` DestCidr string `json:"DestCidr" xml:"DestCidr"` IpProtocol string `json:"IpProtocol" xml:"IpProtocol"` - DpiSignatureIds DpiSignatureIdsInAddACLRule `json:"DpiSignatureIds" xml:"DpiSignatureIds"` DpiGroupIds DpiGroupIdsInAddACLRule `json:"DpiGroupIds" xml:"DpiGroupIds"` + DpiSignatureIds DpiSignatureIdsInAddACLRule `json:"DpiSignatureIds" xml:"DpiSignatureIds"` } // CreateAddACLRuleRequest creates a request to invoke AddACLRule API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/add_dnat_entry.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/add_dnat_entry.go index bb48b51f2ac..23c2b074d63 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/add_dnat_entry.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/add_dnat_entry.go @@ -71,17 +71,17 @@ func (client *Client) AddDnatEntryWithCallback(request *AddDnatEntryRequest, cal // AddDnatEntryRequest is the request struct for api AddDnatEntry type AddDnatEntryRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - Type string `position:"Query"` - InternalIp string `position:"Query"` - ExternalIp string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - IpProtocol string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SagId string `position:"Query"` - InternalPort string `position:"Query"` - ExternalPort string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + Type string `position:"Query" name:"Type"` + InternalIp string `position:"Query" name:"InternalIp"` + ExternalIp string `position:"Query" name:"ExternalIp"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + IpProtocol string `position:"Query" name:"IpProtocol"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SagId string `position:"Query" name:"SagId"` + InternalPort string `position:"Query" name:"InternalPort"` + ExternalPort string `position:"Query" name:"ExternalPort"` } // AddDnatEntryResponse is the response struct for api AddDnatEntry diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/add_network_optimization_setting.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/add_network_optimization_setting.go deleted file mode 100644 index a566f22103d..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/add_network_optimization_setting.go +++ /dev/null @@ -1,105 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// AddNetworkOptimizationSetting invokes the smartag.AddNetworkOptimizationSetting API synchronously -func (client *Client) AddNetworkOptimizationSetting(request *AddNetworkOptimizationSettingRequest) (response *AddNetworkOptimizationSettingResponse, err error) { - response = CreateAddNetworkOptimizationSettingResponse() - err = client.DoAction(request, response) - return -} - -// AddNetworkOptimizationSettingWithChan invokes the smartag.AddNetworkOptimizationSetting API asynchronously -func (client *Client) AddNetworkOptimizationSettingWithChan(request *AddNetworkOptimizationSettingRequest) (<-chan *AddNetworkOptimizationSettingResponse, <-chan error) { - responseChan := make(chan *AddNetworkOptimizationSettingResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.AddNetworkOptimizationSetting(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// AddNetworkOptimizationSettingWithCallback invokes the smartag.AddNetworkOptimizationSetting API asynchronously -func (client *Client) AddNetworkOptimizationSettingWithCallback(request *AddNetworkOptimizationSettingRequest, callback func(response *AddNetworkOptimizationSettingResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *AddNetworkOptimizationSettingResponse - var err error - defer close(result) - response, err = client.AddNetworkOptimizationSetting(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// AddNetworkOptimizationSettingRequest is the request struct for api AddNetworkOptimizationSetting -type AddNetworkOptimizationSettingRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - Type string `position:"Query"` - NetworkOptId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - Domain string `position:"Query"` -} - -// AddNetworkOptimizationSettingResponse is the response struct for api AddNetworkOptimizationSetting -type AddNetworkOptimizationSettingResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateAddNetworkOptimizationSettingRequest creates a request to invoke AddNetworkOptimizationSetting API -func CreateAddNetworkOptimizationSettingRequest() (request *AddNetworkOptimizationSettingRequest) { - request = &AddNetworkOptimizationSettingRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Smartag", "2018-03-13", "AddNetworkOptimizationSetting", "smartag", "openAPI") - request.Method = requests.POST - return -} - -// CreateAddNetworkOptimizationSettingResponse creates a response to parse from AddNetworkOptimizationSetting response -func CreateAddNetworkOptimizationSettingResponse() (response *AddNetworkOptimizationSettingResponse) { - response = &AddNetworkOptimizationSettingResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/add_sag_cidr.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/add_sag_cidr.go deleted file mode 100644 index e1b86c6bf7a..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/add_sag_cidr.go +++ /dev/null @@ -1,105 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// AddSagCidr invokes the smartag.AddSagCidr API synchronously -func (client *Client) AddSagCidr(request *AddSagCidrRequest) (response *AddSagCidrResponse, err error) { - response = CreateAddSagCidrResponse() - err = client.DoAction(request, response) - return -} - -// AddSagCidrWithChan invokes the smartag.AddSagCidr API asynchronously -func (client *Client) AddSagCidrWithChan(request *AddSagCidrRequest) (<-chan *AddSagCidrResponse, <-chan error) { - responseChan := make(chan *AddSagCidrResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.AddSagCidr(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// AddSagCidrWithCallback invokes the smartag.AddSagCidr API asynchronously -func (client *Client) AddSagCidrWithCallback(request *AddSagCidrRequest, callback func(response *AddSagCidrResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *AddSagCidrResponse - var err error - defer close(result) - response, err = client.AddSagCidr(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// AddSagCidrRequest is the request struct for api AddSagCidr -type AddSagCidrRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - Cidr string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - EnableBackup requests.Boolean `position:"Query"` - SmartAGId string `position:"Query"` -} - -// AddSagCidrResponse is the response struct for api AddSagCidr -type AddSagCidrResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateAddSagCidrRequest creates a request to invoke AddSagCidr API -func CreateAddSagCidrRequest() (request *AddSagCidrRequest) { - request = &AddSagCidrRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Smartag", "2018-03-13", "AddSagCidr", "smartag", "openAPI") - request.Method = requests.POST - return -} - -// CreateAddSagCidrResponse creates a response to parse from AddSagCidr response -func CreateAddSagCidrResponse() (response *AddSagCidrResponse) { - response = &AddSagCidrResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/add_snat_entry.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/add_snat_entry.go index 10663e674fb..9feddd5aaa9 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/add_snat_entry.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/add_snat_entry.go @@ -71,13 +71,13 @@ func (client *Client) AddSnatEntryWithCallback(request *AddSnatEntryRequest, cal // AddSnatEntryRequest is the request struct for api AddSnatEntry type AddSnatEntryRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - SnatIp string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - CidrBlock string `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + SnatIp string `position:"Query" name:"SnatIp"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + CidrBlock string `position:"Query" name:"CidrBlock"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // AddSnatEntryResponse is the response struct for api AddSnatEntry diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/associate_acl.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/associate_acl.go index 3e349b3bfa6..fb7e0b3a204 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/associate_acl.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/associate_acl.go @@ -71,12 +71,12 @@ func (client *Client) AssociateACLWithCallback(request *AssociateACLRequest, cal // AssociateACLRequest is the request struct for api AssociateACL type AssociateACLRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - AclId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + AclId string `position:"Query" name:"AclId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // AssociateACLResponse is the response struct for api AssociateACL diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/associate_flow_log.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/associate_flow_log.go index 0a1cd8d210e..faba90958c2 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/associate_flow_log.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/associate_flow_log.go @@ -71,12 +71,12 @@ func (client *Client) AssociateFlowLogWithCallback(request *AssociateFlowLogRequ // AssociateFlowLogRequest is the request struct for api AssociateFlowLog type AssociateFlowLogRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - FlowLogId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + FlowLogId string `position:"Query" name:"FlowLogId"` } // AssociateFlowLogResponse is the response struct for api AssociateFlowLog diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/associate_qos.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/associate_qos.go index 4118cb7c22b..e4b3f3787a0 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/associate_qos.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/associate_qos.go @@ -71,12 +71,12 @@ func (client *Client) AssociateQosWithCallback(request *AssociateQosRequest, cal // AssociateQosRequest is the request struct for api AssociateQos type AssociateQosRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - QosId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + QosId string `position:"Query" name:"QosId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // AssociateQosResponse is the response struct for api AssociateQos diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/attach_network_optimization_sags.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/attach_network_optimization_sags.go deleted file mode 100644 index 099448bf782..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/attach_network_optimization_sags.go +++ /dev/null @@ -1,104 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// AttachNetworkOptimizationSags invokes the smartag.AttachNetworkOptimizationSags API synchronously -func (client *Client) AttachNetworkOptimizationSags(request *AttachNetworkOptimizationSagsRequest) (response *AttachNetworkOptimizationSagsResponse, err error) { - response = CreateAttachNetworkOptimizationSagsResponse() - err = client.DoAction(request, response) - return -} - -// AttachNetworkOptimizationSagsWithChan invokes the smartag.AttachNetworkOptimizationSags API asynchronously -func (client *Client) AttachNetworkOptimizationSagsWithChan(request *AttachNetworkOptimizationSagsRequest) (<-chan *AttachNetworkOptimizationSagsResponse, <-chan error) { - responseChan := make(chan *AttachNetworkOptimizationSagsResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.AttachNetworkOptimizationSags(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// AttachNetworkOptimizationSagsWithCallback invokes the smartag.AttachNetworkOptimizationSags API asynchronously -func (client *Client) AttachNetworkOptimizationSagsWithCallback(request *AttachNetworkOptimizationSagsRequest, callback func(response *AttachNetworkOptimizationSagsResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *AttachNetworkOptimizationSagsResponse - var err error - defer close(result) - response, err = client.AttachNetworkOptimizationSags(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// AttachNetworkOptimizationSagsRequest is the request struct for api AttachNetworkOptimizationSags -type AttachNetworkOptimizationSagsRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - NetworkOptId string `position:"Query"` - SmartAGIds *[]string `position:"Query" name:"SmartAGIds" type:"Repeated"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` -} - -// AttachNetworkOptimizationSagsResponse is the response struct for api AttachNetworkOptimizationSags -type AttachNetworkOptimizationSagsResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateAttachNetworkOptimizationSagsRequest creates a request to invoke AttachNetworkOptimizationSags API -func CreateAttachNetworkOptimizationSagsRequest() (request *AttachNetworkOptimizationSagsRequest) { - request = &AttachNetworkOptimizationSagsRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Smartag", "2018-03-13", "AttachNetworkOptimizationSags", "smartag", "openAPI") - request.Method = requests.POST - return -} - -// CreateAttachNetworkOptimizationSagsResponse creates a response to parse from AttachNetworkOptimizationSags response -func CreateAttachNetworkOptimizationSagsResponse() (response *AttachNetworkOptimizationSagsResponse) { - response = &AttachNetworkOptimizationSagsResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/bind_serial_number.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/bind_serial_number.go index 745fa8c97ae..099abc291ea 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/bind_serial_number.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/bind_serial_number.go @@ -71,12 +71,12 @@ func (client *Client) BindSerialNumberWithCallback(request *BindSerialNumberRequ // BindSerialNumberRequest is the request struct for api BindSerialNumber type BindSerialNumberRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - SerialNumber string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + SerialNumber string `position:"Query" name:"SerialNumber"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // BindSerialNumberResponse is the response struct for api BindSerialNumber diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/bind_smart_access_gateway.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/bind_smart_access_gateway.go index c0e43eb661c..07a4714779e 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/bind_smart_access_gateway.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/bind_smart_access_gateway.go @@ -71,13 +71,13 @@ func (client *Client) BindSmartAccessGatewayWithCallback(request *BindSmartAcces // BindSmartAccessGatewayRequest is the request struct for api BindSmartAccessGateway type BindSmartAccessGatewayRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - CcnId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGUid requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + CcnId string `position:"Query" name:"CcnId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGUid requests.Integer `position:"Query" name:"SmartAGUid"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // BindSmartAccessGatewayResponse is the response struct for api BindSmartAccessGateway diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/bind_vbr.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/bind_vbr.go index 8683fb84e05..d5923af6552 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/bind_vbr.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/bind_vbr.go @@ -71,14 +71,14 @@ func (client *Client) BindVbrWithCallback(request *BindVbrRequest, callback func // BindVbrRequest is the request struct for api BindVbr type BindVbrRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - VbrId string `position:"Query"` - VbrRegionId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGUid requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + VbrId string `position:"Query" name:"VbrId"` + VbrRegionId string `position:"Query" name:"VbrRegionId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGUid requests.Integer `position:"Query" name:"SmartAGUid"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // BindVbrResponse is the response struct for api BindVbr diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/clear_sag_cipher.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/clear_sag_cipher.go index b38cae5bb30..0423d32c1d6 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/clear_sag_cipher.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/clear_sag_cipher.go @@ -71,12 +71,12 @@ func (client *Client) ClearSagCipherWithCallback(request *ClearSagCipherRequest, // ClearSagCipherRequest is the request struct for api ClearSagCipher type ClearSagCipherRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - SnNumber string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SagId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + SnNumber string `position:"Query" name:"SnNumber"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SagId string `position:"Query" name:"SagId"` } // ClearSagCipherResponse is the response struct for api ClearSagCipher diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/clear_sag_routeable_address.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/clear_sag_routeable_address.go index 880a36506a0..bf3a81aa45d 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/clear_sag_routeable_address.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/clear_sag_routeable_address.go @@ -71,12 +71,12 @@ func (client *Client) ClearSagRouteableAddressWithCallback(request *ClearSagRout // ClearSagRouteableAddressRequest is the request struct for api ClearSagRouteableAddress type ClearSagRouteableAddressRequest struct { *requests.RpcRequest - AccessKeyId string `position:"Query"` - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SagId string `position:"Query"` + AccessKeyId string `position:"Query" name:"access_key_id"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SagId string `position:"Query" name:"SagId"` } // ClearSagRouteableAddressResponse is the response struct for api ClearSagRouteableAddress diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_acl.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_acl.go index b807c18fc45..1f1534e0dc0 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_acl.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_acl.go @@ -71,18 +71,20 @@ func (client *Client) CreateACLWithCallback(request *CreateACLRequest, callback // CreateACLRequest is the request struct for api CreateACL type CreateACLRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - Name string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + Name string `position:"Query" name:"Name"` } // CreateACLResponse is the response struct for api CreateACL type CreateACLResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - AclId string `json:"AclId" xml:"AclId"` + RequestId string `json:"RequestId" xml:"RequestId"` + AclId string `json:"AclId" xml:"AclId"` + ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` } // CreateCreateACLRequest creates a request to invoke CreateACL API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_cloud_connect_network.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_cloud_connect_network.go index 8e74fa9d15c..dd75d64c049 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_cloud_connect_network.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_cloud_connect_network.go @@ -71,27 +71,29 @@ func (client *Client) CreateCloudConnectNetworkWithCallback(request *CreateCloud // CreateCloudConnectNetworkRequest is the request struct for api CreateCloudConnectNetwork type CreateCloudConnectNetworkRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - Description string `position:"Query"` - SnatCidrBlock string `position:"Query"` - IsDefault requests.Boolean `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - Name string `position:"Query"` - CidrBlock string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + Description string `position:"Query" name:"Description"` + SnatCidrBlock string `position:"Query" name:"SnatCidrBlock"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` + IsDefault requests.Boolean `position:"Query" name:"IsDefault"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + Name string `position:"Query" name:"Name"` + CidrBlock string `position:"Query" name:"CidrBlock"` } // CreateCloudConnectNetworkResponse is the response struct for api CreateCloudConnectNetwork type CreateCloudConnectNetworkResponse struct { *responses.BaseResponse - Status string `json:"Status" xml:"Status"` - Description string `json:"Description" xml:"Description"` - RequestId string `json:"RequestId" xml:"RequestId"` - CcnId string `json:"CcnId" xml:"CcnId"` - CidrBlock string `json:"CidrBlock" xml:"CidrBlock"` - SnatCidrBlock string `json:"SnatCidrBlock" xml:"SnatCidrBlock"` - Name string `json:"Name" xml:"Name"` + Status string `json:"Status" xml:"Status"` + Description string `json:"Description" xml:"Description"` + RequestId string `json:"RequestId" xml:"RequestId"` + CcnId string `json:"CcnId" xml:"CcnId"` + CidrBlock string `json:"CidrBlock" xml:"CidrBlock"` + SnatCidrBlock string `json:"SnatCidrBlock" xml:"SnatCidrBlock"` + Name string `json:"Name" xml:"Name"` + ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` } // CreateCreateCloudConnectNetworkRequest creates a request to invoke CreateCloudConnectNetwork API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_enterprise_code.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_enterprise_code.go index d9f361d98f1..d2320ed8ecb 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_enterprise_code.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_enterprise_code.go @@ -71,9 +71,9 @@ func (client *Client) CreateEnterpriseCodeWithCallback(request *CreateEnterprise // CreateEnterpriseCodeRequest is the request struct for api CreateEnterpriseCode type CreateEnterpriseCodeRequest struct { *requests.RpcRequest - ClientToken string `position:"Query"` - EnterpriseCode string `position:"Query"` - DryRun requests.Boolean `position:"Query"` + ClientToken string `position:"Query" name:"ClientToken"` + EnterpriseCode string `position:"Query" name:"EnterpriseCode"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` } // CreateEnterpriseCodeResponse is the response struct for api CreateEnterpriseCode diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_flow_log.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_flow_log.go index aa7f71a0b01..63478caed19 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_flow_log.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_flow_log.go @@ -71,28 +71,30 @@ func (client *Client) CreateFlowLogWithCallback(request *CreateFlowLogRequest, c // CreateFlowLogRequest is the request struct for api CreateFlowLog type CreateFlowLogRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - NetflowVersion string `position:"Query"` - Description string `position:"Query"` - InactiveAging requests.Integer `position:"Query"` - SlsRegionId string `position:"Query"` - ActiveAging requests.Integer `position:"Query"` - OutputType string `position:"Query"` - ProjectName string `position:"Query"` - LogstoreName string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - NetflowServerPort requests.Integer `position:"Query"` - OwnerId requests.Integer `position:"Query"` - NetflowServerIp string `position:"Query"` - Name string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + NetflowVersion string `position:"Query" name:"NetflowVersion"` + Description string `position:"Query" name:"Description"` + InactiveAging requests.Integer `position:"Query" name:"InactiveAging"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` + SlsRegionId string `position:"Query" name:"SlsRegionId"` + ActiveAging requests.Integer `position:"Query" name:"ActiveAging"` + OutputType string `position:"Query" name:"OutputType"` + ProjectName string `position:"Query" name:"ProjectName"` + LogstoreName string `position:"Query" name:"LogstoreName"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + NetflowServerPort requests.Integer `position:"Query" name:"NetflowServerPort"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + NetflowServerIp string `position:"Query" name:"NetflowServerIp"` + Name string `position:"Query" name:"Name"` } // CreateFlowLogResponse is the response struct for api CreateFlowLog type CreateFlowLogResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - FlowLogId string `json:"FlowLogId" xml:"FlowLogId"` + RequestId string `json:"RequestId" xml:"RequestId"` + FlowLogId string `json:"FlowLogId" xml:"FlowLogId"` + ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` } // CreateCreateFlowLogRequest creates a request to invoke CreateFlowLog API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_health_check.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_health_check.go index 2d7244a17f7..ccdcad4705d 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_health_check.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_health_check.go @@ -71,31 +71,31 @@ func (client *Client) CreateHealthCheckWithCallback(request *CreateHealthCheckRe // CreateHealthCheckRequest is the request struct for api CreateHealthCheck type CreateHealthCheckRequest struct { *requests.RpcRequest - ProbeInterval requests.Integer `position:"Query"` - ResourceOwnerId requests.Integer `position:"Query"` - DstPort requests.Integer `position:"Query"` - Description string `position:"Query"` - Type string `position:"Query"` - FailCountThreshold requests.Integer `position:"Query"` - ProbeTimeout requests.Integer `position:"Query"` - RttFailThreshold requests.Integer `position:"Query"` - RttThreshold requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - DstIpAddr string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SrcIpAddr string `position:"Query"` - Name string `position:"Query"` - SmartAGId string `position:"Query"` - SrcPort requests.Integer `position:"Query"` - ProbeCount requests.Integer `position:"Query"` + ProbeInterval requests.Integer `position:"Query" name:"ProbeInterval"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + DstPort requests.Integer `position:"Query" name:"DstPort"` + Description string `position:"Query" name:"Description"` + Type string `position:"Query" name:"Type"` + FailCountThreshold requests.Integer `position:"Query" name:"FailCountThreshold"` + ProbeTimeout requests.Integer `position:"Query" name:"ProbeTimeout"` + RttFailThreshold requests.Integer `position:"Query" name:"RttFailThreshold"` + RttThreshold requests.Integer `position:"Query" name:"RttThreshold"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + DstIpAddr string `position:"Query" name:"DstIpAddr"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SrcIpAddr string `position:"Query" name:"SrcIpAddr"` + Name string `position:"Query" name:"Name"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SrcPort requests.Integer `position:"Query" name:"SrcPort"` + ProbeCount requests.Integer `position:"Query" name:"ProbeCount"` } // CreateHealthCheckResponse is the response struct for api CreateHealthCheck type CreateHealthCheckResponse struct { *responses.BaseResponse - Description string `json:"Description" xml:"Description"` SrcPort int `json:"SrcPort" xml:"SrcPort"` + Description string `json:"Description" xml:"Description"` RequestId string `json:"RequestId" xml:"RequestId"` InstanceId string `json:"InstanceId" xml:"InstanceId"` SrcIpAddr string `json:"SrcIpAddr" xml:"SrcIpAddr"` @@ -107,8 +107,8 @@ type CreateHealthCheckResponse struct { Type string `json:"Type" xml:"Type"` ProbeTimeout int `json:"ProbeTimeout" xml:"ProbeTimeout"` RttThreshold int `json:"RttThreshold" xml:"RttThreshold"` - ProbeInterval int `json:"ProbeInterval" xml:"ProbeInterval"` RegionId string `json:"RegionId" xml:"RegionId"` + ProbeInterval int `json:"ProbeInterval" xml:"ProbeInterval"` SmartAGId string `json:"SmartAGId" xml:"SmartAGId"` RttFailThreshold int `json:"RttFailThreshold" xml:"RttFailThreshold"` DstIpAddr string `json:"DstIpAddr" xml:"DstIpAddr"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_network_optimization.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_network_optimization.go deleted file mode 100644 index 8d630a84817..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_network_optimization.go +++ /dev/null @@ -1,107 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// CreateNetworkOptimization invokes the smartag.CreateNetworkOptimization API synchronously -func (client *Client) CreateNetworkOptimization(request *CreateNetworkOptimizationRequest) (response *CreateNetworkOptimizationResponse, err error) { - response = CreateCreateNetworkOptimizationResponse() - err = client.DoAction(request, response) - return -} - -// CreateNetworkOptimizationWithChan invokes the smartag.CreateNetworkOptimization API asynchronously -func (client *Client) CreateNetworkOptimizationWithChan(request *CreateNetworkOptimizationRequest) (<-chan *CreateNetworkOptimizationResponse, <-chan error) { - responseChan := make(chan *CreateNetworkOptimizationResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.CreateNetworkOptimization(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// CreateNetworkOptimizationWithCallback invokes the smartag.CreateNetworkOptimization API asynchronously -func (client *Client) CreateNetworkOptimizationWithCallback(request *CreateNetworkOptimizationRequest, callback func(response *CreateNetworkOptimizationResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *CreateNetworkOptimizationResponse - var err error - defer close(result) - response, err = client.CreateNetworkOptimization(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// CreateNetworkOptimizationRequest is the request struct for api CreateNetworkOptimization -type CreateNetworkOptimizationRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - CcnId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - Name string `position:"Query"` -} - -// CreateNetworkOptimizationResponse is the response struct for api CreateNetworkOptimization -type CreateNetworkOptimizationResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - State string `json:"State" xml:"State"` - Name string `json:"Name" xml:"Name"` - NetworkOptId string `json:"NetworkOptId" xml:"NetworkOptId"` -} - -// CreateCreateNetworkOptimizationRequest creates a request to invoke CreateNetworkOptimization API -func CreateCreateNetworkOptimizationRequest() (request *CreateNetworkOptimizationRequest) { - request = &CreateNetworkOptimizationRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Smartag", "2018-03-13", "CreateNetworkOptimization", "smartag", "openAPI") - request.Method = requests.POST - return -} - -// CreateCreateNetworkOptimizationResponse creates a response to parse from CreateNetworkOptimization response -func CreateCreateNetworkOptimizationResponse() (response *CreateNetworkOptimizationResponse) { - response = &CreateNetworkOptimizationResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_qos.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_qos.go index 82723655438..0d352d83112 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_qos.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_qos.go @@ -71,19 +71,21 @@ func (client *Client) CreateQosWithCallback(request *CreateQosRequest, callback // CreateQosRequest is the request struct for api CreateQos type CreateQosRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - QosName string `position:"Query"` - QosDescription string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + QosName string `position:"Query" name:"QosName"` + QosDescription string `position:"Query" name:"QosDescription"` } // CreateQosResponse is the response struct for api CreateQos type CreateQosResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - QosId string `json:"QosId" xml:"QosId"` + RequestId string `json:"RequestId" xml:"RequestId"` + QosId string `json:"QosId" xml:"QosId"` + ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` } // CreateCreateQosRequest creates a request to invoke CreateQos API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_qos_car.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_qos_car.go index 0e945fbaf0d..cc81d8959bb 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_qos_car.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_qos_car.go @@ -71,20 +71,20 @@ func (client *Client) CreateQosCarWithCallback(request *CreateQosCarRequest, cal // CreateQosCarRequest is the request struct for api CreateQosCar type CreateQosCarRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - MinBandwidthAbs requests.Integer `position:"Query"` - Description string `position:"Query"` - PercentSourceType string `position:"Query"` - QosId string `position:"Query"` - MaxBandwidthAbs requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - MaxBandwidthPercent requests.Integer `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - Priority requests.Integer `position:"Query"` - MinBandwidthPercent requests.Integer `position:"Query"` - LimitType string `position:"Query"` - Name string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + MinBandwidthAbs requests.Integer `position:"Query" name:"MinBandwidthAbs"` + Description string `position:"Query" name:"Description"` + PercentSourceType string `position:"Query" name:"PercentSourceType"` + QosId string `position:"Query" name:"QosId"` + MaxBandwidthAbs requests.Integer `position:"Query" name:"MaxBandwidthAbs"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + MaxBandwidthPercent requests.Integer `position:"Query" name:"MaxBandwidthPercent"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + Priority requests.Integer `position:"Query" name:"Priority"` + MinBandwidthPercent requests.Integer `position:"Query" name:"MinBandwidthPercent"` + LimitType string `position:"Query" name:"LimitType"` + Name string `position:"Query" name:"Name"` } // CreateQosCarResponse is the response struct for api CreateQosCar @@ -92,11 +92,11 @@ type CreateQosCarResponse struct { *responses.BaseResponse MinBandwidthAbs int `json:"MinBandwidthAbs" xml:"MinBandwidthAbs"` Description string `json:"Description" xml:"Description"` - QosCarId string `json:"QosCarId" xml:"QosCarId"` RequestId string `json:"RequestId" xml:"RequestId"` - Priority int `json:"Priority" xml:"Priority"` - MaxBandwidthPercent int `json:"MaxBandwidthPercent" xml:"MaxBandwidthPercent"` + QosCarId string `json:"QosCarId" xml:"QosCarId"` MaxBandwidthAbs int `json:"MaxBandwidthAbs" xml:"MaxBandwidthAbs"` + MaxBandwidthPercent int `json:"MaxBandwidthPercent" xml:"MaxBandwidthPercent"` + Priority int `json:"Priority" xml:"Priority"` QosId string `json:"QosId" xml:"QosId"` PercentSourceType string `json:"PercentSourceType" xml:"PercentSourceType"` MinBandwidthPercent int `json:"MinBandwidthPercent" xml:"MinBandwidthPercent"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_qos_policy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_qos_policy.go index 3f5a95acece..dffd0686e27 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_qos_policy.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_qos_policy.go @@ -72,42 +72,42 @@ func (client *Client) CreateQosPolicyWithCallback(request *CreateQosPolicyReques type CreateQosPolicyRequest struct { *requests.RpcRequest DpiGroupIds *[]string `position:"Query" name:"DpiGroupIds" type:"Repeated"` - ResourceOwnerId requests.Integer `position:"Query"` - SourcePortRange string `position:"Query"` - SourceCidr string `position:"Query"` - Description string `position:"Query"` - StartTime string `position:"Query"` - DestCidr string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + SourcePortRange string `position:"Query" name:"SourcePortRange"` + SourceCidr string `position:"Query" name:"SourceCidr"` + Description string `position:"Query" name:"Description"` + StartTime string `position:"Query" name:"StartTime"` + DestCidr string `position:"Query" name:"DestCidr"` DpiSignatureIds *[]string `position:"Query" name:"DpiSignatureIds" type:"Repeated"` - QosId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - IpProtocol string `position:"Query"` - OwnerAccount string `position:"Query"` - EndTime string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - Priority requests.Integer `position:"Query"` - DestPortRange string `position:"Query"` - Name string `position:"Query"` + QosId string `position:"Query" name:"QosId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + IpProtocol string `position:"Query" name:"IpProtocol"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + EndTime string `position:"Query" name:"EndTime"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + Priority requests.Integer `position:"Query" name:"Priority"` + DestPortRange string `position:"Query" name:"DestPortRange"` + Name string `position:"Query" name:"Name"` } // CreateQosPolicyResponse is the response struct for api CreateQosPolicy type CreateQosPolicyResponse struct { *responses.BaseResponse - DestCidr string `json:"DestCidr" xml:"DestCidr"` Description string `json:"Description" xml:"Description"` - SourcePortRange string `json:"SourcePortRange" xml:"SourcePortRange"` - QosPolicyId string `json:"QosPolicyId" xml:"QosPolicyId"` - RequestId string `json:"RequestId" xml:"RequestId"` EndTime string `json:"EndTime" xml:"EndTime"` + RequestId string `json:"RequestId" xml:"RequestId"` + QosPolicyId string `json:"QosPolicyId" xml:"QosPolicyId"` + SourcePortRange string `json:"SourcePortRange" xml:"SourcePortRange"` SourceCidr string `json:"SourceCidr" xml:"SourceCidr"` Priority int `json:"Priority" xml:"Priority"` StartTime string `json:"StartTime" xml:"StartTime"` - IpProtocol string `json:"IpProtocol" xml:"IpProtocol"` - QosId string `json:"QosId" xml:"QosId"` DestPortRange string `json:"DestPortRange" xml:"DestPortRange"` Name string `json:"Name" xml:"Name"` - DpiSignatureIds DpiSignatureIdsInCreateQosPolicy `json:"DpiSignatureIds" xml:"DpiSignatureIds"` + DestCidr string `json:"DestCidr" xml:"DestCidr"` + QosId string `json:"QosId" xml:"QosId"` + IpProtocol string `json:"IpProtocol" xml:"IpProtocol"` DpiGroupIds DpiGroupIdsInCreateQosPolicy `json:"DpiGroupIds" xml:"DpiGroupIds"` + DpiSignatureIds DpiSignatureIdsInCreateQosPolicy `json:"DpiSignatureIds" xml:"DpiSignatureIds"` } // CreateCreateQosPolicyRequest creates a request to invoke CreateQosPolicy API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_sag_express_connect_interface.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_sag_express_connect_interface.go index bcafbde69a0..6e43313c344 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_sag_express_connect_interface.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_sag_express_connect_interface.go @@ -71,16 +71,16 @@ func (client *Client) CreateSagExpressConnectInterfaceWithCallback(request *Crea // CreateSagExpressConnectInterfaceRequest is the request struct for api CreateSagExpressConnectInterface type CreateSagExpressConnectInterfaceRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - Vlan string `position:"Query"` - Mask string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - IP string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` - PortName string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + Vlan string `position:"Query" name:"Vlan"` + Mask string `position:"Query" name:"Mask"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + IP string `position:"Query" name:"IP"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` + PortName string `position:"Query" name:"PortName"` } // CreateSagExpressConnectInterfaceResponse is the response struct for api CreateSagExpressConnectInterface diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_sag_static_route.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_sag_static_route.go index 425fa13fa44..aed7ec1c73d 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_sag_static_route.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_sag_static_route.go @@ -71,16 +71,16 @@ func (client *Client) CreateSagStaticRouteWithCallback(request *CreateSagStaticR // CreateSagStaticRouteRequest is the request struct for api CreateSagStaticRoute type CreateSagStaticRouteRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - Vlan string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - NextHop string `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` - PortName string `position:"Query"` - DestinationCidr string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + Vlan string `position:"Query" name:"Vlan"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + NextHop string `position:"Query" name:"NextHop"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` + PortName string `position:"Query" name:"PortName"` + DestinationCidr string `position:"Query" name:"DestinationCidr"` } // CreateSagStaticRouteResponse is the response struct for api CreateSagStaticRoute diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_smart_access_gateway.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_smart_access_gateway.go index e96b665a961..db8574be6ac 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_smart_access_gateway.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_smart_access_gateway.go @@ -71,45 +71,47 @@ func (client *Client) CreateSmartAccessGatewayWithCallback(request *CreateSmartA // CreateSmartAccessGatewayRequest is the request struct for api CreateSmartAccessGateway type CreateSmartAccessGatewayRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ReceiverTown string `position:"Query"` - ReceiverDistrict string `position:"Query"` - BuyerMessage string `position:"Query"` - ReceiverState string `position:"Query"` - Period requests.Integer `position:"Query"` - OwnerId requests.Integer `position:"Query"` - ReceiverPhone string `position:"Query"` - HaType string `position:"Query"` - Name string `position:"Query"` - ReceiverCountry string `position:"Query"` - MaxBandWidth requests.Integer `position:"Query"` - Description string `position:"Query"` - UserCount requests.Integer `position:"Query"` - ReceiverAddress string `position:"Query"` - InstanceType string `position:"Query"` - HardWareSpec string `position:"Query"` - ReceiverEmail string `position:"Query"` - ReceiverCity string `position:"Query"` - AutoPay requests.Boolean `position:"Query"` - CPEVersion string `position:"Query"` - ReceiverMobile string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - ReceiverName string `position:"Query"` - AlreadyHaveSag requests.Boolean `position:"Query"` - ChargeType string `position:"Query"` - DataPlan requests.Integer `position:"Query"` - ReceiverZip string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ReceiverTown string `position:"Query" name:"ReceiverTown"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` + ReceiverDistrict string `position:"Query" name:"ReceiverDistrict"` + BuyerMessage string `position:"Query" name:"BuyerMessage"` + ReceiverState string `position:"Query" name:"ReceiverState"` + Period requests.Integer `position:"Query" name:"Period"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + ReceiverPhone string `position:"Query" name:"ReceiverPhone"` + HaType string `position:"Query" name:"HaType"` + Name string `position:"Query" name:"Name"` + ReceiverCountry string `position:"Query" name:"ReceiverCountry"` + MaxBandWidth requests.Integer `position:"Query" name:"MaxBandWidth"` + Description string `position:"Query" name:"Description"` + UserCount requests.Integer `position:"Query" name:"UserCount"` + ReceiverAddress string `position:"Query" name:"ReceiverAddress"` + InstanceType string `position:"Query" name:"InstanceType"` + HardWareSpec string `position:"Query" name:"HardWareSpec"` + ReceiverEmail string `position:"Query" name:"ReceiverEmail"` + ReceiverCity string `position:"Query" name:"ReceiverCity"` + AutoPay requests.Boolean `position:"Query" name:"AutoPay"` + CPEVersion string `position:"Query" name:"CPEVersion"` + ReceiverMobile string `position:"Query" name:"ReceiverMobile"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + ReceiverName string `position:"Query" name:"ReceiverName"` + AlreadyHaveSag requests.Boolean `position:"Query" name:"AlreadyHaveSag"` + ChargeType string `position:"Query" name:"ChargeType"` + DataPlan requests.Integer `position:"Query" name:"DataPlan"` + ReceiverZip string `position:"Query" name:"ReceiverZip"` } // CreateSmartAccessGatewayResponse is the response struct for api CreateSmartAccessGateway type CreateSmartAccessGatewayResponse struct { *responses.BaseResponse - Description string `json:"Description" xml:"Description"` - RequestId string `json:"RequestId" xml:"RequestId"` - SmartAGId string `json:"SmartAGId" xml:"SmartAGId"` - OrderId string `json:"OrderId" xml:"OrderId"` - Name string `json:"Name" xml:"Name"` + Description string `json:"Description" xml:"Description"` + RequestId string `json:"RequestId" xml:"RequestId"` + OrderId string `json:"OrderId" xml:"OrderId"` + SmartAGId string `json:"SmartAGId" xml:"SmartAGId"` + Name string `json:"Name" xml:"Name"` + ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` } // CreateCreateSmartAccessGatewayRequest creates a request to invoke CreateSmartAccessGateway API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_smart_access_gateway_client_user.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_smart_access_gateway_client_user.go index 0aa74c6feba..f86954bd2c5 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_smart_access_gateway_client_user.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_smart_access_gateway_client_user.go @@ -71,16 +71,16 @@ func (client *Client) CreateSmartAccessGatewayClientUserWithCallback(request *Cr // CreateSmartAccessGatewayClientUserRequest is the request struct for api CreateSmartAccessGatewayClientUser type CreateSmartAccessGatewayClientUserRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - Password string `position:"Query"` - ClientIp string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - Bandwidth requests.Integer `position:"Query"` - OwnerAccount string `position:"Query"` - UserMail string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - UserName string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + Password string `position:"Query" name:"Password"` + ClientIp string `position:"Query" name:"ClientIp"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + Bandwidth requests.Integer `position:"Query" name:"Bandwidth"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + UserMail string `position:"Query" name:"UserMail"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + UserName string `position:"Query" name:"UserName"` } // CreateSmartAccessGatewayClientUserResponse is the response struct for api CreateSmartAccessGatewayClientUser diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_smart_access_gateway_software.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_smart_access_gateway_software.go index cc68c0c174e..753738e66b1 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_smart_access_gateway_software.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/create_smart_access_gateway_software.go @@ -71,23 +71,25 @@ func (client *Client) CreateSmartAccessGatewaySoftwareWithCallback(request *Crea // CreateSmartAccessGatewaySoftwareRequest is the request struct for api CreateSmartAccessGatewaySoftware type CreateSmartAccessGatewaySoftwareRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - UserCount requests.Integer `position:"Query"` - Period requests.Integer `position:"Query"` - AutoPay requests.Boolean `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - ChargeType string `position:"Query"` - DataPlan requests.Integer `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` + UserCount requests.Integer `position:"Query" name:"UserCount"` + Period requests.Integer `position:"Query" name:"Period"` + AutoPay requests.Boolean `position:"Query" name:"AutoPay"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + ChargeType string `position:"Query" name:"ChargeType"` + DataPlan requests.Integer `position:"Query" name:"DataPlan"` } // CreateSmartAccessGatewaySoftwareResponse is the response struct for api CreateSmartAccessGatewaySoftware type CreateSmartAccessGatewaySoftwareResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - SmartAGId string `json:"SmartAGId" xml:"SmartAGId"` - OrderId string `json:"OrderId" xml:"OrderId"` + RequestId string `json:"RequestId" xml:"RequestId"` + OrderId string `json:"OrderId" xml:"OrderId"` + SmartAGId string `json:"SmartAGId" xml:"SmartAGId"` + ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` } // CreateCreateSmartAccessGatewaySoftwareRequest creates a request to invoke CreateSmartAccessGatewaySoftware API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/deactive_flow_log.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/deactive_flow_log.go index 48e101fba55..8b4f4b0d721 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/deactive_flow_log.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/deactive_flow_log.go @@ -71,11 +71,11 @@ func (client *Client) DeactiveFlowLogWithCallback(request *DeactiveFlowLogReques // DeactiveFlowLogRequest is the request struct for api DeactiveFlowLog type DeactiveFlowLogRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - FlowLogId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + FlowLogId string `position:"Query" name:"FlowLogId"` } // DeactiveFlowLogResponse is the response struct for api DeactiveFlowLog diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_acl.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_acl.go index ca0267131b0..ecc39d6c5a8 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_acl.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_acl.go @@ -71,11 +71,11 @@ func (client *Client) DeleteACLWithCallback(request *DeleteACLRequest, callback // DeleteACLRequest is the request struct for api DeleteACL type DeleteACLRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - AclId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + AclId string `position:"Query" name:"AclId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` } // DeleteACLResponse is the response struct for api DeleteACL diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_acl_rule.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_acl_rule.go index 9b0bcdfcd98..12f869fd41b 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_acl_rule.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_acl_rule.go @@ -71,12 +71,12 @@ func (client *Client) DeleteACLRuleWithCallback(request *DeleteACLRuleRequest, c // DeleteACLRuleRequest is the request struct for api DeleteACLRule type DeleteACLRuleRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - AclId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - AcrId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + AclId string `position:"Query" name:"AclId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + AcrId string `position:"Query" name:"AcrId"` } // DeleteACLRuleResponse is the response struct for api DeleteACLRule diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_cloud_connect_network.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_cloud_connect_network.go index b7bb0e71f8e..b13d563a4f0 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_cloud_connect_network.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_cloud_connect_network.go @@ -71,11 +71,11 @@ func (client *Client) DeleteCloudConnectNetworkWithCallback(request *DeleteCloud // DeleteCloudConnectNetworkRequest is the request struct for api DeleteCloudConnectNetwork type DeleteCloudConnectNetworkRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - CcnId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + CcnId string `position:"Query" name:"CcnId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` } // DeleteCloudConnectNetworkResponse is the response struct for api DeleteCloudConnectNetwork diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_dnat_entry.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_dnat_entry.go index bf7202d9d9c..74ea8297743 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_dnat_entry.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_dnat_entry.go @@ -71,12 +71,12 @@ func (client *Client) DeleteDnatEntryWithCallback(request *DeleteDnatEntryReques // DeleteDnatEntryRequest is the request struct for api DeleteDnatEntry type DeleteDnatEntryRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - DnatEntryId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SagId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + DnatEntryId string `position:"Query" name:"DnatEntryId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SagId string `position:"Query" name:"SagId"` } // DeleteDnatEntryResponse is the response struct for api DeleteDnatEntry diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_enterprise_code.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_enterprise_code.go index bcddcfcacf7..f384d2156dd 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_enterprise_code.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_enterprise_code.go @@ -71,9 +71,9 @@ func (client *Client) DeleteEnterpriseCodeWithCallback(request *DeleteEnterprise // DeleteEnterpriseCodeRequest is the request struct for api DeleteEnterpriseCode type DeleteEnterpriseCodeRequest struct { *requests.RpcRequest - ClientToken string `position:"Query"` - EnterpriseCode string `position:"Query"` - DryRun requests.Boolean `position:"Query"` + ClientToken string `position:"Query" name:"ClientToken"` + EnterpriseCode string `position:"Query" name:"EnterpriseCode"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` } // DeleteEnterpriseCodeResponse is the response struct for api DeleteEnterpriseCode diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_flow_log.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_flow_log.go index eab95ee1030..14943b60040 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_flow_log.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_flow_log.go @@ -71,11 +71,11 @@ func (client *Client) DeleteFlowLogWithCallback(request *DeleteFlowLogRequest, c // DeleteFlowLogRequest is the request struct for api DeleteFlowLog type DeleteFlowLogRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - FlowLogId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + FlowLogId string `position:"Query" name:"FlowLogId"` } // DeleteFlowLogResponse is the response struct for api DeleteFlowLog diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_health_check.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_health_check.go index 892e7d36d1c..a9618084ad4 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_health_check.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_health_check.go @@ -71,11 +71,11 @@ func (client *Client) DeleteHealthCheckWithCallback(request *DeleteHealthCheckRe // DeleteHealthCheckRequest is the request struct for api DeleteHealthCheck type DeleteHealthCheckRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - HcInstanceId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + HcInstanceId string `position:"Query" name:"HcInstanceId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` } // DeleteHealthCheckResponse is the response struct for api DeleteHealthCheck diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_network_optimization.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_network_optimization.go deleted file mode 100644 index 03ec91c4b93..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_network_optimization.go +++ /dev/null @@ -1,103 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DeleteNetworkOptimization invokes the smartag.DeleteNetworkOptimization API synchronously -func (client *Client) DeleteNetworkOptimization(request *DeleteNetworkOptimizationRequest) (response *DeleteNetworkOptimizationResponse, err error) { - response = CreateDeleteNetworkOptimizationResponse() - err = client.DoAction(request, response) - return -} - -// DeleteNetworkOptimizationWithChan invokes the smartag.DeleteNetworkOptimization API asynchronously -func (client *Client) DeleteNetworkOptimizationWithChan(request *DeleteNetworkOptimizationRequest) (<-chan *DeleteNetworkOptimizationResponse, <-chan error) { - responseChan := make(chan *DeleteNetworkOptimizationResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DeleteNetworkOptimization(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DeleteNetworkOptimizationWithCallback invokes the smartag.DeleteNetworkOptimization API asynchronously -func (client *Client) DeleteNetworkOptimizationWithCallback(request *DeleteNetworkOptimizationRequest, callback func(response *DeleteNetworkOptimizationResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DeleteNetworkOptimizationResponse - var err error - defer close(result) - response, err = client.DeleteNetworkOptimization(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DeleteNetworkOptimizationRequest is the request struct for api DeleteNetworkOptimization -type DeleteNetworkOptimizationRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - NetworkOptId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` -} - -// DeleteNetworkOptimizationResponse is the response struct for api DeleteNetworkOptimization -type DeleteNetworkOptimizationResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateDeleteNetworkOptimizationRequest creates a request to invoke DeleteNetworkOptimization API -func CreateDeleteNetworkOptimizationRequest() (request *DeleteNetworkOptimizationRequest) { - request = &DeleteNetworkOptimizationRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Smartag", "2018-03-13", "DeleteNetworkOptimization", "smartag", "openAPI") - request.Method = requests.POST - return -} - -// CreateDeleteNetworkOptimizationResponse creates a response to parse from DeleteNetworkOptimization response -func CreateDeleteNetworkOptimizationResponse() (response *DeleteNetworkOptimizationResponse) { - response = &DeleteNetworkOptimizationResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_network_optimization_setting.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_network_optimization_setting.go deleted file mode 100644 index f93c2642d4b..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_network_optimization_setting.go +++ /dev/null @@ -1,105 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DeleteNetworkOptimizationSetting invokes the smartag.DeleteNetworkOptimizationSetting API synchronously -func (client *Client) DeleteNetworkOptimizationSetting(request *DeleteNetworkOptimizationSettingRequest) (response *DeleteNetworkOptimizationSettingResponse, err error) { - response = CreateDeleteNetworkOptimizationSettingResponse() - err = client.DoAction(request, response) - return -} - -// DeleteNetworkOptimizationSettingWithChan invokes the smartag.DeleteNetworkOptimizationSetting API asynchronously -func (client *Client) DeleteNetworkOptimizationSettingWithChan(request *DeleteNetworkOptimizationSettingRequest) (<-chan *DeleteNetworkOptimizationSettingResponse, <-chan error) { - responseChan := make(chan *DeleteNetworkOptimizationSettingResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DeleteNetworkOptimizationSetting(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DeleteNetworkOptimizationSettingWithCallback invokes the smartag.DeleteNetworkOptimizationSetting API asynchronously -func (client *Client) DeleteNetworkOptimizationSettingWithCallback(request *DeleteNetworkOptimizationSettingRequest, callback func(response *DeleteNetworkOptimizationSettingResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DeleteNetworkOptimizationSettingResponse - var err error - defer close(result) - response, err = client.DeleteNetworkOptimizationSetting(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DeleteNetworkOptimizationSettingRequest is the request struct for api DeleteNetworkOptimizationSetting -type DeleteNetworkOptimizationSettingRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - Type string `position:"Query"` - NetworkOptId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - Domain string `position:"Query"` -} - -// DeleteNetworkOptimizationSettingResponse is the response struct for api DeleteNetworkOptimizationSetting -type DeleteNetworkOptimizationSettingResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateDeleteNetworkOptimizationSettingRequest creates a request to invoke DeleteNetworkOptimizationSetting API -func CreateDeleteNetworkOptimizationSettingRequest() (request *DeleteNetworkOptimizationSettingRequest) { - request = &DeleteNetworkOptimizationSettingRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Smartag", "2018-03-13", "DeleteNetworkOptimizationSetting", "smartag", "openAPI") - request.Method = requests.POST - return -} - -// CreateDeleteNetworkOptimizationSettingResponse creates a response to parse from DeleteNetworkOptimizationSetting response -func CreateDeleteNetworkOptimizationSettingResponse() (response *DeleteNetworkOptimizationSettingResponse) { - response = &DeleteNetworkOptimizationSettingResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_qos.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_qos.go index 19faad68be0..9966fff37bd 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_qos.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_qos.go @@ -71,11 +71,11 @@ func (client *Client) DeleteQosWithCallback(request *DeleteQosRequest, callback // DeleteQosRequest is the request struct for api DeleteQos type DeleteQosRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - QosId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + QosId string `position:"Query" name:"QosId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` } // DeleteQosResponse is the response struct for api DeleteQos diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_qos_car.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_qos_car.go index 6d4913cdfa5..52efb462d8b 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_qos_car.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_qos_car.go @@ -71,12 +71,12 @@ func (client *Client) DeleteQosCarWithCallback(request *DeleteQosCarRequest, cal // DeleteQosCarRequest is the request struct for api DeleteQosCar type DeleteQosCarRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - QosId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - QosCarId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + QosId string `position:"Query" name:"QosId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + QosCarId string `position:"Query" name:"QosCarId"` } // DeleteQosCarResponse is the response struct for api DeleteQosCar diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_qos_policy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_qos_policy.go index 826d6c92e8b..01974884238 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_qos_policy.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_qos_policy.go @@ -71,12 +71,12 @@ func (client *Client) DeleteQosPolicyWithCallback(request *DeleteQosPolicyReques // DeleteQosPolicyRequest is the request struct for api DeleteQosPolicy type DeleteQosPolicyRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - QosPolicyId string `position:"Query"` - QosId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + QosPolicyId string `position:"Query" name:"QosPolicyId"` + QosId string `position:"Query" name:"QosId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` } // DeleteQosPolicyResponse is the response struct for api DeleteQosPolicy diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_route_distribution_strategy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_route_distribution_strategy.go index 53728b24090..9b4dda4bf35 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_route_distribution_strategy.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_route_distribution_strategy.go @@ -71,14 +71,14 @@ func (client *Client) DeleteRouteDistributionStrategyWithCallback(request *Delet // DeleteRouteDistributionStrategyRequest is the request struct for api DeleteRouteDistributionStrategy type DeleteRouteDistributionStrategyRequest struct { *requests.RpcRequest - RouteSource string `position:"Query"` - ResourceOwnerId requests.Integer `position:"Query"` - SourceType string `position:"Query"` - DestCidrBlock string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + RouteSource string `position:"Query" name:"RouteSource"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + SourceType string `position:"Query" name:"SourceType"` + DestCidrBlock string `position:"Query" name:"DestCidrBlock"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // DeleteRouteDistributionStrategyResponse is the response struct for api DeleteRouteDistributionStrategy diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_sag_cidr.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_sag_cidr.go deleted file mode 100644 index f32476e7a2e..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_sag_cidr.go +++ /dev/null @@ -1,104 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DeleteSagCidr invokes the smartag.DeleteSagCidr API synchronously -func (client *Client) DeleteSagCidr(request *DeleteSagCidrRequest) (response *DeleteSagCidrResponse, err error) { - response = CreateDeleteSagCidrResponse() - err = client.DoAction(request, response) - return -} - -// DeleteSagCidrWithChan invokes the smartag.DeleteSagCidr API asynchronously -func (client *Client) DeleteSagCidrWithChan(request *DeleteSagCidrRequest) (<-chan *DeleteSagCidrResponse, <-chan error) { - responseChan := make(chan *DeleteSagCidrResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DeleteSagCidr(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DeleteSagCidrWithCallback invokes the smartag.DeleteSagCidr API asynchronously -func (client *Client) DeleteSagCidrWithCallback(request *DeleteSagCidrRequest, callback func(response *DeleteSagCidrResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DeleteSagCidrResponse - var err error - defer close(result) - response, err = client.DeleteSagCidr(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DeleteSagCidrRequest is the request struct for api DeleteSagCidr -type DeleteSagCidrRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - Cidr string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` -} - -// DeleteSagCidrResponse is the response struct for api DeleteSagCidr -type DeleteSagCidrResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateDeleteSagCidrRequest creates a request to invoke DeleteSagCidr API -func CreateDeleteSagCidrRequest() (request *DeleteSagCidrRequest) { - request = &DeleteSagCidrRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Smartag", "2018-03-13", "DeleteSagCidr", "smartag", "openAPI") - request.Method = requests.POST - return -} - -// CreateDeleteSagCidrResponse creates a response to parse from DeleteSagCidr response -func CreateDeleteSagCidrResponse() (response *DeleteSagCidrResponse) { - response = &DeleteSagCidrResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_sag_express_connect_interface.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_sag_express_connect_interface.go index 24753cc5cab..7a81fbe248a 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_sag_express_connect_interface.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_sag_express_connect_interface.go @@ -71,14 +71,14 @@ func (client *Client) DeleteSagExpressConnectInterfaceWithCallback(request *Dele // DeleteSagExpressConnectInterfaceRequest is the request struct for api DeleteSagExpressConnectInterface type DeleteSagExpressConnectInterfaceRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - Vlan string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` - PortName string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + Vlan string `position:"Query" name:"Vlan"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` + PortName string `position:"Query" name:"PortName"` } // DeleteSagExpressConnectInterfaceResponse is the response struct for api DeleteSagExpressConnectInterface diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_sag_static_route.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_sag_static_route.go index 6e52ec360c7..9df77508e03 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_sag_static_route.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_sag_static_route.go @@ -71,15 +71,15 @@ func (client *Client) DeleteSagStaticRouteWithCallback(request *DeleteSagStaticR // DeleteSagStaticRouteRequest is the request struct for api DeleteSagStaticRoute type DeleteSagStaticRouteRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - Vlan string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` - PortName string `position:"Query"` - DestinationCidr string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + Vlan string `position:"Query" name:"Vlan"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` + PortName string `position:"Query" name:"PortName"` + DestinationCidr string `position:"Query" name:"DestinationCidr"` } // DeleteSagStaticRouteResponse is the response struct for api DeleteSagStaticRoute diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_smart_access_gateway.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_smart_access_gateway.go index fbb134bf037..9644bc14728 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_smart_access_gateway.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_smart_access_gateway.go @@ -71,8 +71,8 @@ func (client *Client) DeleteSmartAccessGatewayWithCallback(request *DeleteSmartA // DeleteSmartAccessGatewayRequest is the request struct for api DeleteSmartAccessGateway type DeleteSmartAccessGatewayRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - InstanceId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + InstanceId string `position:"Query" name:"InstanceId"` } // DeleteSmartAccessGatewayResponse is the response struct for api DeleteSmartAccessGateway diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_smart_access_gateway_client_user.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_smart_access_gateway_client_user.go index 10a75675aa4..8fd526686e1 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_smart_access_gateway_client_user.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_smart_access_gateway_client_user.go @@ -71,12 +71,12 @@ func (client *Client) DeleteSmartAccessGatewayClientUserWithCallback(request *De // DeleteSmartAccessGatewayClientUserRequest is the request struct for api DeleteSmartAccessGatewayClientUser type DeleteSmartAccessGatewayClientUserRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - UserName string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + UserName string `position:"Query" name:"UserName"` } // DeleteSmartAccessGatewayClientUserResponse is the response struct for api DeleteSmartAccessGatewayClientUser diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_snat_entry.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_snat_entry.go index f39e7d8db11..cb88d3d9ea4 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_snat_entry.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/delete_snat_entry.go @@ -71,12 +71,12 @@ func (client *Client) DeleteSnatEntryWithCallback(request *DeleteSnatEntryReques // DeleteSnatEntryRequest is the request struct for api DeleteSnatEntry type DeleteSnatEntryRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - InstanceId string `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + InstanceId string `position:"Query" name:"InstanceId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // DeleteSnatEntryResponse is the response struct for api DeleteSnatEntry diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_ac_ls.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_ac_ls.go index 799071d6cad..2d70aaa7fad 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_ac_ls.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_ac_ls.go @@ -71,22 +71,23 @@ func (client *Client) DescribeACLsWithCallback(request *DescribeACLsRequest, cal // DescribeACLsRequest is the request struct for api DescribeACLs type DescribeACLsRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - AclIds string `position:"Query"` - PageNumber requests.Integer `position:"Query"` - PageSize requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - Name string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + AclIds string `position:"Query" name:"AclIds"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + Name string `position:"Query" name:"Name"` } // DescribeACLsResponse is the response struct for api DescribeACLs type DescribeACLsResponse struct { *responses.BaseResponse TotalCount int `json:"TotalCount" xml:"TotalCount"` - RequestId string `json:"RequestId" xml:"RequestId"` PageSize int `json:"PageSize" xml:"PageSize"` + RequestId string `json:"RequestId" xml:"RequestId"` PageNumber int `json:"PageNumber" xml:"PageNumber"` Acls Acls `json:"Acls" xml:"Acls"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_acl_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_acl_attribute.go index 3f841759428..8427e46f1e3 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_acl_attribute.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_acl_attribute.go @@ -71,24 +71,24 @@ func (client *Client) DescribeACLAttributeWithCallback(request *DescribeACLAttri // DescribeACLAttributeRequest is the request struct for api DescribeACLAttribute type DescribeACLAttributeRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - PageNumber requests.Integer `position:"Query"` - PageSize requests.Integer `position:"Query"` - Direction string `position:"Query"` - Order string `position:"Query"` - AclId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - Name string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + Direction string `position:"Query" name:"Direction"` + Order string `position:"Query" name:"Order"` + AclId string `position:"Query" name:"AclId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + Name string `position:"Query" name:"Name"` } // DescribeACLAttributeResponse is the response struct for api DescribeACLAttribute type DescribeACLAttributeResponse struct { *responses.BaseResponse TotalCount int `json:"TotalCount" xml:"TotalCount"` - RequestId string `json:"RequestId" xml:"RequestId"` PageSize int `json:"PageSize" xml:"PageSize"` + RequestId string `json:"RequestId" xml:"RequestId"` PageNumber int `json:"PageNumber" xml:"PageNumber"` Acrs Acrs `json:"Acrs" xml:"Acrs"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_bindable_smart_access_gateways.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_bindable_smart_access_gateways.go index e12f4d6b9aa..106f8b4eeae 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_bindable_smart_access_gateways.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_bindable_smart_access_gateways.go @@ -71,24 +71,25 @@ func (client *Client) DescribeBindableSmartAccessGatewaysWithCallback(request *D // DescribeBindableSmartAccessGatewaysRequest is the request struct for api DescribeBindableSmartAccessGateways type DescribeBindableSmartAccessGatewaysRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - CcnId string `position:"Query"` - PageNumber requests.Integer `position:"Query"` - PageSize requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - CrossAccount requests.Boolean `position:"Query"` - Name string `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + CcnId string `position:"Query" name:"CcnId"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + CrossAccount requests.Boolean `position:"Query" name:"CrossAccount"` + Name string `position:"Query" name:"Name"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // DescribeBindableSmartAccessGatewaysResponse is the response struct for api DescribeBindableSmartAccessGateways type DescribeBindableSmartAccessGatewaysResponse struct { *responses.BaseResponse TotalCount int `json:"TotalCount" xml:"TotalCount"` - RequestId string `json:"RequestId" xml:"RequestId"` PageSize int `json:"PageSize" xml:"PageSize"` + RequestId string `json:"RequestId" xml:"RequestId"` PageNumber int `json:"PageNumber" xml:"PageNumber"` SmartAccessGateways SmartAccessGatewaysInDescribeBindableSmartAccessGateways `json:"SmartAccessGateways" xml:"SmartAccessGateways"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_client_user_dns.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_client_user_dns.go index 42cc11c9a5d..6070e740320 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_client_user_dns.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_client_user_dns.go @@ -71,11 +71,11 @@ func (client *Client) DescribeClientUserDNSWithCallback(request *DescribeClientU // DescribeClientUserDNSRequest is the request struct for api DescribeClientUserDNS type DescribeClientUserDNSRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // DescribeClientUserDNSResponse is the response struct for api DescribeClientUserDNS diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_cloud_connect_networks.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_cloud_connect_networks.go index 1075137b52c..b25e972a994 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_cloud_connect_networks.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_cloud_connect_networks.go @@ -71,15 +71,16 @@ func (client *Client) DescribeCloudConnectNetworksWithCallback(request *Describe // DescribeCloudConnectNetworksRequest is the request struct for api DescribeCloudConnectNetworks type DescribeCloudConnectNetworksRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - CcnId string `position:"Query"` - PageNumber requests.Integer `position:"Query"` - PageSize requests.Integer `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + CcnId string `position:"Query" name:"CcnId"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` + PageSize requests.Integer `position:"Query" name:"PageSize"` Tag *[]DescribeCloudConnectNetworksTag `position:"Query" name:"Tag" type:"Repeated"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - Name string `position:"Query"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + Name string `position:"Query" name:"Name"` } // DescribeCloudConnectNetworksTag is a repeated param struct in DescribeCloudConnectNetworksRequest @@ -92,8 +93,8 @@ type DescribeCloudConnectNetworksTag struct { type DescribeCloudConnectNetworksResponse struct { *responses.BaseResponse TotalCount int `json:"TotalCount" xml:"TotalCount"` - RequestId string `json:"RequestId" xml:"RequestId"` PageSize int `json:"PageSize" xml:"PageSize"` + RequestId string `json:"RequestId" xml:"RequestId"` PageNumber int `json:"PageNumber" xml:"PageNumber"` CloudConnectNetworks CloudConnectNetworks `json:"CloudConnectNetworks" xml:"CloudConnectNetworks"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_device_auto_upgrade_policy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_device_auto_upgrade_policy.go index 683308a352d..cb5d1c4efd2 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_device_auto_upgrade_policy.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_device_auto_upgrade_policy.go @@ -71,13 +71,13 @@ func (client *Client) DescribeDeviceAutoUpgradePolicyWithCallback(request *Descr // DescribeDeviceAutoUpgradePolicyRequest is the request struct for api DescribeDeviceAutoUpgradePolicy type DescribeDeviceAutoUpgradePolicyRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - SerialNumber string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - VersionType string `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + SerialNumber string `position:"Query" name:"SerialNumber"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + VersionType string `position:"Query" name:"VersionType"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // DescribeDeviceAutoUpgradePolicyResponse is the response struct for api DescribeDeviceAutoUpgradePolicy @@ -85,8 +85,8 @@ type DescribeDeviceAutoUpgradePolicyResponse struct { *responses.BaseResponse UpgradeType string `json:"UpgradeType" xml:"UpgradeType"` TimeZone string `json:"TimeZone" xml:"TimeZone"` - RequestId string `json:"RequestId" xml:"RequestId"` SerialNumber string `json:"SerialNumber" xml:"SerialNumber"` + RequestId string `json:"RequestId" xml:"RequestId"` Jitter string `json:"Jitter" xml:"Jitter"` Duration string `json:"Duration" xml:"Duration"` CronExpression string `json:"CronExpression" xml:"CronExpression"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_dnat_entries.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_dnat_entries.go index 67ba25015e9..932fbac2684 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_dnat_entries.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_dnat_entries.go @@ -71,22 +71,22 @@ func (client *Client) DescribeDnatEntriesWithCallback(request *DescribeDnatEntri // DescribeDnatEntriesRequest is the request struct for api DescribeDnatEntries type DescribeDnatEntriesRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - Type string `position:"Query"` - PageNumber requests.Integer `position:"Query"` - PageSize requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SagId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + Type string `position:"Query" name:"Type"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SagId string `position:"Query" name:"SagId"` } // DescribeDnatEntriesResponse is the response struct for api DescribeDnatEntries type DescribeDnatEntriesResponse struct { *responses.BaseResponse TotalCount int `json:"TotalCount" xml:"TotalCount"` - RequestId string `json:"RequestId" xml:"RequestId"` PageSize int `json:"PageSize" xml:"PageSize"` + RequestId string `json:"RequestId" xml:"RequestId"` PageNumber int `json:"PageNumber" xml:"PageNumber"` DnatEntries DnatEntries `json:"DnatEntries" xml:"DnatEntries"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_flow_log_sags.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_flow_log_sags.go index 43ccad550ca..017b8fd961f 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_flow_log_sags.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_flow_log_sags.go @@ -71,21 +71,21 @@ func (client *Client) DescribeFlowLogSagsWithCallback(request *DescribeFlowLogSa // DescribeFlowLogSagsRequest is the request struct for api DescribeFlowLogSags type DescribeFlowLogSagsRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - PageNumber requests.Integer `position:"Query"` - PageSize requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - FlowLogId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + FlowLogId string `position:"Query" name:"FlowLogId"` } // DescribeFlowLogSagsResponse is the response struct for api DescribeFlowLogSags type DescribeFlowLogSagsResponse struct { *responses.BaseResponse TotalCount int `json:"TotalCount" xml:"TotalCount"` - RequestId string `json:"RequestId" xml:"RequestId"` PageSize int `json:"PageSize" xml:"PageSize"` + RequestId string `json:"RequestId" xml:"RequestId"` PageNumber int `json:"PageNumber" xml:"PageNumber"` Sags SagsInDescribeFlowLogSags `json:"Sags" xml:"Sags"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_flow_logs.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_flow_logs.go index 5143766d9f5..5c646df42fa 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_flow_logs.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_flow_logs.go @@ -71,25 +71,26 @@ func (client *Client) DescribeFlowLogsWithCallback(request *DescribeFlowLogsRequ // DescribeFlowLogsRequest is the request struct for api DescribeFlowLogs type DescribeFlowLogsRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - Description string `position:"Query"` - PageNumber requests.Integer `position:"Query"` - PageSize requests.Integer `position:"Query"` - OutputType string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - FlowLogId string `position:"Query"` - FlowLogName string `position:"Query"` - Status string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + Description string `position:"Query" name:"Description"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + OutputType string `position:"Query" name:"OutputType"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + FlowLogId string `position:"Query" name:"FlowLogId"` + FlowLogName string `position:"Query" name:"FlowLogName"` + Status string `position:"Query" name:"Status"` } // DescribeFlowLogsResponse is the response struct for api DescribeFlowLogs type DescribeFlowLogsResponse struct { *responses.BaseResponse TotalCount int `json:"TotalCount" xml:"TotalCount"` - RequestId string `json:"RequestId" xml:"RequestId"` PageSize int `json:"PageSize" xml:"PageSize"` + RequestId string `json:"RequestId" xml:"RequestId"` PageNumber int `json:"PageNumber" xml:"PageNumber"` FlowLogs FlowLogs `json:"FlowLogs" xml:"FlowLogs"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_grant_rules.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_grant_rules.go index d1f02b76bc5..5fd52547c9b 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_grant_rules.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_grant_rules.go @@ -71,21 +71,21 @@ func (client *Client) DescribeGrantRulesWithCallback(request *DescribeGrantRules // DescribeGrantRulesRequest is the request struct for api DescribeGrantRules type DescribeGrantRulesRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - PageNumber requests.Integer `position:"Query"` - PageSize requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - AssociatedCcnId string `position:"Query"` - OwnerId requests.Integer `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + AssociatedCcnId string `position:"Query" name:"AssociatedCcnId"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` } // DescribeGrantRulesResponse is the response struct for api DescribeGrantRules type DescribeGrantRulesResponse struct { *responses.BaseResponse TotalCount int `json:"TotalCount" xml:"TotalCount"` - RequestId string `json:"RequestId" xml:"RequestId"` PageSize int `json:"PageSize" xml:"PageSize"` + RequestId string `json:"RequestId" xml:"RequestId"` PageNumber int `json:"PageNumber" xml:"PageNumber"` GrantRules GrantRulesInDescribeGrantRules `json:"GrantRules" xml:"GrantRules"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_grant_sag_rules.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_grant_sag_rules.go index a3c63a24558..24d694a21c3 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_grant_sag_rules.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_grant_sag_rules.go @@ -71,21 +71,21 @@ func (client *Client) DescribeGrantSagRulesWithCallback(request *DescribeGrantSa // DescribeGrantSagRulesRequest is the request struct for api DescribeGrantSagRules type DescribeGrantSagRulesRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - PageNumber requests.Integer `position:"Query"` - PageSize requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // DescribeGrantSagRulesResponse is the response struct for api DescribeGrantSagRules type DescribeGrantSagRulesResponse struct { *responses.BaseResponse TotalCount int `json:"TotalCount" xml:"TotalCount"` - RequestId string `json:"RequestId" xml:"RequestId"` PageSize int `json:"PageSize" xml:"PageSize"` + RequestId string `json:"RequestId" xml:"RequestId"` PageNumber int `json:"PageNumber" xml:"PageNumber"` GrantRules GrantRulesInDescribeGrantSagRules `json:"GrantRules" xml:"GrantRules"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_grant_sag_vbr_rules.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_grant_sag_vbr_rules.go index 82a346f7bef..99de8d9bab2 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_grant_sag_vbr_rules.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_grant_sag_vbr_rules.go @@ -71,22 +71,22 @@ func (client *Client) DescribeGrantSagVbrRulesWithCallback(request *DescribeGran // DescribeGrantSagVbrRulesRequest is the request struct for api DescribeGrantSagVbrRules type DescribeGrantSagVbrRulesRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - PageNumber requests.Integer `position:"Query"` - PageSize requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - VbrInstanceId string `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + VbrInstanceId string `position:"Query" name:"VbrInstanceId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // DescribeGrantSagVbrRulesResponse is the response struct for api DescribeGrantSagVbrRules type DescribeGrantSagVbrRulesResponse struct { *responses.BaseResponse TotalCount int `json:"TotalCount" xml:"TotalCount"` - RequestId string `json:"RequestId" xml:"RequestId"` PageSize int `json:"PageSize" xml:"PageSize"` + RequestId string `json:"RequestId" xml:"RequestId"` PageNumber int `json:"PageNumber" xml:"PageNumber"` GrantRules GrantRulesInDescribeGrantSagVbrRules `json:"GrantRules" xml:"GrantRules"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_health_check_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_health_check_attribute.go index a904e27debb..d88eca2fd93 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_health_check_attribute.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_health_check_attribute.go @@ -71,19 +71,19 @@ func (client *Client) DescribeHealthCheckAttributeWithCallback(request *Describe // DescribeHealthCheckAttributeRequest is the request struct for api DescribeHealthCheckAttribute type DescribeHealthCheckAttributeRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - HcInstanceId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + HcInstanceId string `position:"Query" name:"HcInstanceId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // DescribeHealthCheckAttributeResponse is the response struct for api DescribeHealthCheckAttribute type DescribeHealthCheckAttributeResponse struct { *responses.BaseResponse - Description string `json:"Description" xml:"Description"` SrcPort int `json:"SrcPort" xml:"SrcPort"` + Description string `json:"Description" xml:"Description"` RequestId string `json:"RequestId" xml:"RequestId"` SrcIpAddr string `json:"SrcIpAddr" xml:"SrcIpAddr"` CreateTime int64 `json:"CreateTime" xml:"CreateTime"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_health_checks.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_health_checks.go index 858dca4fa83..4c525974428 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_health_checks.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_health_checks.go @@ -71,23 +71,23 @@ func (client *Client) DescribeHealthChecksWithCallback(request *DescribeHealthCh // DescribeHealthChecksRequest is the request struct for api DescribeHealthChecks type DescribeHealthChecksRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - HcInstanceId string `position:"Query"` - PageNumber requests.Integer `position:"Query"` - PageSize requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - Name string `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + HcInstanceId string `position:"Query" name:"HcInstanceId"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + Name string `position:"Query" name:"Name"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // DescribeHealthChecksResponse is the response struct for api DescribeHealthChecks type DescribeHealthChecksResponse struct { *responses.BaseResponse TotalCount int `json:"TotalCount" xml:"TotalCount"` - RequestId string `json:"RequestId" xml:"RequestId"` PageSize int `json:"PageSize" xml:"PageSize"` + RequestId string `json:"RequestId" xml:"RequestId"` PageNumber int `json:"PageNumber" xml:"PageNumber"` HealthChecks HealthChecks `json:"HealthChecks" xml:"HealthChecks"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_network_optimization_sags.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_network_optimization_sags.go deleted file mode 100644 index 74ad12fab35..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_network_optimization_sags.go +++ /dev/null @@ -1,109 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeNetworkOptimizationSags invokes the smartag.DescribeNetworkOptimizationSags API synchronously -func (client *Client) DescribeNetworkOptimizationSags(request *DescribeNetworkOptimizationSagsRequest) (response *DescribeNetworkOptimizationSagsResponse, err error) { - response = CreateDescribeNetworkOptimizationSagsResponse() - err = client.DoAction(request, response) - return -} - -// DescribeNetworkOptimizationSagsWithChan invokes the smartag.DescribeNetworkOptimizationSags API asynchronously -func (client *Client) DescribeNetworkOptimizationSagsWithChan(request *DescribeNetworkOptimizationSagsRequest) (<-chan *DescribeNetworkOptimizationSagsResponse, <-chan error) { - responseChan := make(chan *DescribeNetworkOptimizationSagsResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeNetworkOptimizationSags(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeNetworkOptimizationSagsWithCallback invokes the smartag.DescribeNetworkOptimizationSags API asynchronously -func (client *Client) DescribeNetworkOptimizationSagsWithCallback(request *DescribeNetworkOptimizationSagsRequest, callback func(response *DescribeNetworkOptimizationSagsResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeNetworkOptimizationSagsResponse - var err error - defer close(result) - response, err = client.DescribeNetworkOptimizationSags(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeNetworkOptimizationSagsRequest is the request struct for api DescribeNetworkOptimizationSags -type DescribeNetworkOptimizationSagsRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - PageNumber requests.Integer `position:"Query"` - NetworkOptId string `position:"Query"` - PageSize requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` -} - -// DescribeNetworkOptimizationSagsResponse is the response struct for api DescribeNetworkOptimizationSags -type DescribeNetworkOptimizationSagsResponse struct { - *responses.BaseResponse - TotalCount int `json:"TotalCount" xml:"TotalCount"` - RequestId string `json:"RequestId" xml:"RequestId"` - PageSize int `json:"PageSize" xml:"PageSize"` - PageNumber int `json:"PageNumber" xml:"PageNumber"` - SmartAccessGateways SmartAccessGatewaysInDescribeNetworkOptimizationSags `json:"SmartAccessGateways" xml:"SmartAccessGateways"` -} - -// CreateDescribeNetworkOptimizationSagsRequest creates a request to invoke DescribeNetworkOptimizationSags API -func CreateDescribeNetworkOptimizationSagsRequest() (request *DescribeNetworkOptimizationSagsRequest) { - request = &DescribeNetworkOptimizationSagsRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Smartag", "2018-03-13", "DescribeNetworkOptimizationSags", "smartag", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeNetworkOptimizationSagsResponse creates a response to parse from DescribeNetworkOptimizationSags response -func CreateDescribeNetworkOptimizationSagsResponse() (response *DescribeNetworkOptimizationSagsResponse) { - response = &DescribeNetworkOptimizationSagsResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_network_optimization_settings.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_network_optimization_settings.go deleted file mode 100644 index 4725e9a9f01..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_network_optimization_settings.go +++ /dev/null @@ -1,109 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeNetworkOptimizationSettings invokes the smartag.DescribeNetworkOptimizationSettings API synchronously -func (client *Client) DescribeNetworkOptimizationSettings(request *DescribeNetworkOptimizationSettingsRequest) (response *DescribeNetworkOptimizationSettingsResponse, err error) { - response = CreateDescribeNetworkOptimizationSettingsResponse() - err = client.DoAction(request, response) - return -} - -// DescribeNetworkOptimizationSettingsWithChan invokes the smartag.DescribeNetworkOptimizationSettings API asynchronously -func (client *Client) DescribeNetworkOptimizationSettingsWithChan(request *DescribeNetworkOptimizationSettingsRequest) (<-chan *DescribeNetworkOptimizationSettingsResponse, <-chan error) { - responseChan := make(chan *DescribeNetworkOptimizationSettingsResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeNetworkOptimizationSettings(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeNetworkOptimizationSettingsWithCallback invokes the smartag.DescribeNetworkOptimizationSettings API asynchronously -func (client *Client) DescribeNetworkOptimizationSettingsWithCallback(request *DescribeNetworkOptimizationSettingsRequest, callback func(response *DescribeNetworkOptimizationSettingsResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeNetworkOptimizationSettingsResponse - var err error - defer close(result) - response, err = client.DescribeNetworkOptimizationSettings(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeNetworkOptimizationSettingsRequest is the request struct for api DescribeNetworkOptimizationSettings -type DescribeNetworkOptimizationSettingsRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - PageNumber requests.Integer `position:"Query"` - NetworkOptId string `position:"Query"` - PageSize requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` -} - -// DescribeNetworkOptimizationSettingsResponse is the response struct for api DescribeNetworkOptimizationSettings -type DescribeNetworkOptimizationSettingsResponse struct { - *responses.BaseResponse - TotalCount int `json:"TotalCount" xml:"TotalCount"` - RequestId string `json:"RequestId" xml:"RequestId"` - PageSize int `json:"PageSize" xml:"PageSize"` - PageNumber int `json:"PageNumber" xml:"PageNumber"` - Settings Settings `json:"Settings" xml:"Settings"` -} - -// CreateDescribeNetworkOptimizationSettingsRequest creates a request to invoke DescribeNetworkOptimizationSettings API -func CreateDescribeNetworkOptimizationSettingsRequest() (request *DescribeNetworkOptimizationSettingsRequest) { - request = &DescribeNetworkOptimizationSettingsRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Smartag", "2018-03-13", "DescribeNetworkOptimizationSettings", "smartag", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeNetworkOptimizationSettingsResponse creates a response to parse from DescribeNetworkOptimizationSettings response -func CreateDescribeNetworkOptimizationSettingsResponse() (response *DescribeNetworkOptimizationSettingsResponse) { - response = &DescribeNetworkOptimizationSettingsResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_network_optimizations.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_network_optimizations.go deleted file mode 100644 index 5b576b39a44..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_network_optimizations.go +++ /dev/null @@ -1,111 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeNetworkOptimizations invokes the smartag.DescribeNetworkOptimizations API synchronously -func (client *Client) DescribeNetworkOptimizations(request *DescribeNetworkOptimizationsRequest) (response *DescribeNetworkOptimizationsResponse, err error) { - response = CreateDescribeNetworkOptimizationsResponse() - err = client.DoAction(request, response) - return -} - -// DescribeNetworkOptimizationsWithChan invokes the smartag.DescribeNetworkOptimizations API asynchronously -func (client *Client) DescribeNetworkOptimizationsWithChan(request *DescribeNetworkOptimizationsRequest) (<-chan *DescribeNetworkOptimizationsResponse, <-chan error) { - responseChan := make(chan *DescribeNetworkOptimizationsResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeNetworkOptimizations(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeNetworkOptimizationsWithCallback invokes the smartag.DescribeNetworkOptimizations API asynchronously -func (client *Client) DescribeNetworkOptimizationsWithCallback(request *DescribeNetworkOptimizationsRequest, callback func(response *DescribeNetworkOptimizationsResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeNetworkOptimizationsResponse - var err error - defer close(result) - response, err = client.DescribeNetworkOptimizations(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeNetworkOptimizationsRequest is the request struct for api DescribeNetworkOptimizations -type DescribeNetworkOptimizationsRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - CcnId string `position:"Query"` - PageNumber requests.Integer `position:"Query"` - NetworkOptId string `position:"Query"` - PageSize requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - Name string `position:"Query"` -} - -// DescribeNetworkOptimizationsResponse is the response struct for api DescribeNetworkOptimizations -type DescribeNetworkOptimizationsResponse struct { - *responses.BaseResponse - TotalCount int `json:"TotalCount" xml:"TotalCount"` - RequestId string `json:"RequestId" xml:"RequestId"` - PageSize int `json:"PageSize" xml:"PageSize"` - PageNumber int `json:"PageNumber" xml:"PageNumber"` - NetworkOptimizations NetworkOptimizations `json:"NetworkOptimizations" xml:"NetworkOptimizations"` -} - -// CreateDescribeNetworkOptimizationsRequest creates a request to invoke DescribeNetworkOptimizations API -func CreateDescribeNetworkOptimizationsRequest() (request *DescribeNetworkOptimizationsRequest) { - request = &DescribeNetworkOptimizationsRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Smartag", "2018-03-13", "DescribeNetworkOptimizations", "smartag", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeNetworkOptimizationsResponse creates a response to parse from DescribeNetworkOptimizations response -func CreateDescribeNetworkOptimizationsResponse() (response *DescribeNetworkOptimizationsResponse) { - response = &DescribeNetworkOptimizationsResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_pbr_interfaces.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_pbr_interfaces.go deleted file mode 100644 index 1690e0165c2..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_pbr_interfaces.go +++ /dev/null @@ -1,105 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribePbrInterfaces invokes the smartag.DescribePbrInterfaces API synchronously -func (client *Client) DescribePbrInterfaces(request *DescribePbrInterfacesRequest) (response *DescribePbrInterfacesResponse, err error) { - response = CreateDescribePbrInterfacesResponse() - err = client.DoAction(request, response) - return -} - -// DescribePbrInterfacesWithChan invokes the smartag.DescribePbrInterfaces API asynchronously -func (client *Client) DescribePbrInterfacesWithChan(request *DescribePbrInterfacesRequest) (<-chan *DescribePbrInterfacesResponse, <-chan error) { - responseChan := make(chan *DescribePbrInterfacesResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribePbrInterfaces(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribePbrInterfacesWithCallback invokes the smartag.DescribePbrInterfaces API asynchronously -func (client *Client) DescribePbrInterfacesWithCallback(request *DescribePbrInterfacesRequest, callback func(response *DescribePbrInterfacesResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribePbrInterfacesResponse - var err error - defer close(result) - response, err = client.DescribePbrInterfaces(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribePbrInterfacesRequest is the request struct for api DescribePbrInterfaces -type DescribePbrInterfacesRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - PbrInstanceId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` -} - -// DescribePbrInterfacesResponse is the response struct for api DescribePbrInterfaces -type DescribePbrInterfacesResponse struct { - *responses.BaseResponse - TotalCount int `json:"TotalCount" xml:"TotalCount"` - RequestId string `json:"RequestId" xml:"RequestId"` - PbrInterfaces PbrInterfaces `json:"PbrInterfaces" xml:"PbrInterfaces"` -} - -// CreateDescribePbrInterfacesRequest creates a request to invoke DescribePbrInterfaces API -func CreateDescribePbrInterfacesRequest() (request *DescribePbrInterfacesRequest) { - request = &DescribePbrInterfacesRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Smartag", "2018-03-13", "DescribePbrInterfaces", "smartag", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribePbrInterfacesResponse creates a response to parse from DescribePbrInterfaces response -func CreateDescribePbrInterfacesResponse() (response *DescribePbrInterfacesResponse) { - response = &DescribePbrInterfacesResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_pbr_rules.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_pbr_rules.go deleted file mode 100644 index abc6a0dc20c..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_pbr_rules.go +++ /dev/null @@ -1,109 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribePbrRules invokes the smartag.DescribePbrRules API synchronously -func (client *Client) DescribePbrRules(request *DescribePbrRulesRequest) (response *DescribePbrRulesResponse, err error) { - response = CreateDescribePbrRulesResponse() - err = client.DoAction(request, response) - return -} - -// DescribePbrRulesWithChan invokes the smartag.DescribePbrRules API asynchronously -func (client *Client) DescribePbrRulesWithChan(request *DescribePbrRulesRequest) (<-chan *DescribePbrRulesResponse, <-chan error) { - responseChan := make(chan *DescribePbrRulesResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribePbrRules(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribePbrRulesWithCallback invokes the smartag.DescribePbrRules API asynchronously -func (client *Client) DescribePbrRulesWithCallback(request *DescribePbrRulesRequest, callback func(response *DescribePbrRulesResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribePbrRulesResponse - var err error - defer close(result) - response, err = client.DescribePbrRules(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribePbrRulesRequest is the request struct for api DescribePbrRules -type DescribePbrRulesRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - PageNumber string `position:"Query"` - PageSize string `position:"Query"` - PbrInstanceId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` -} - -// DescribePbrRulesResponse is the response struct for api DescribePbrRules -type DescribePbrRulesResponse struct { - *responses.BaseResponse - TotalCount int `json:"TotalCount" xml:"TotalCount"` - RequestId string `json:"RequestId" xml:"RequestId"` - PageSize int `json:"PageSize" xml:"PageSize"` - PageNumber int `json:"PageNumber" xml:"PageNumber"` - PbrRules PbrRules `json:"PbrRules" xml:"PbrRules"` -} - -// CreateDescribePbrRulesRequest creates a request to invoke DescribePbrRules API -func CreateDescribePbrRulesRequest() (request *DescribePbrRulesRequest) { - request = &DescribePbrRulesRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Smartag", "2018-03-13", "DescribePbrRules", "smartag", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribePbrRulesResponse creates a response to parse from DescribePbrRules response -func CreateDescribePbrRulesResponse() (response *DescribePbrRulesResponse) { - response = &DescribePbrRulesResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_policy_based_routings.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_policy_based_routings.go deleted file mode 100644 index b32aac557c2..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_policy_based_routings.go +++ /dev/null @@ -1,111 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribePolicyBasedRoutings invokes the smartag.DescribePolicyBasedRoutings API synchronously -func (client *Client) DescribePolicyBasedRoutings(request *DescribePolicyBasedRoutingsRequest) (response *DescribePolicyBasedRoutingsResponse, err error) { - response = CreateDescribePolicyBasedRoutingsResponse() - err = client.DoAction(request, response) - return -} - -// DescribePolicyBasedRoutingsWithChan invokes the smartag.DescribePolicyBasedRoutings API asynchronously -func (client *Client) DescribePolicyBasedRoutingsWithChan(request *DescribePolicyBasedRoutingsRequest) (<-chan *DescribePolicyBasedRoutingsResponse, <-chan error) { - responseChan := make(chan *DescribePolicyBasedRoutingsResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribePolicyBasedRoutings(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribePolicyBasedRoutingsWithCallback invokes the smartag.DescribePolicyBasedRoutings API asynchronously -func (client *Client) DescribePolicyBasedRoutingsWithCallback(request *DescribePolicyBasedRoutingsRequest, callback func(response *DescribePolicyBasedRoutingsResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribePolicyBasedRoutingsResponse - var err error - defer close(result) - response, err = client.DescribePolicyBasedRoutings(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribePolicyBasedRoutingsRequest is the request struct for api DescribePolicyBasedRoutings -type DescribePolicyBasedRoutingsRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - PageNumber requests.Integer `position:"Query"` - PageSize requests.Integer `position:"Query"` - PbrInstanceId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - Name string `position:"Query"` - SmartAGId string `position:"Query"` -} - -// DescribePolicyBasedRoutingsResponse is the response struct for api DescribePolicyBasedRoutings -type DescribePolicyBasedRoutingsResponse struct { - *responses.BaseResponse - TotalCount int `json:"TotalCount" xml:"TotalCount"` - RequestId string `json:"RequestId" xml:"RequestId"` - PageSize int `json:"PageSize" xml:"PageSize"` - PageNumber int `json:"PageNumber" xml:"PageNumber"` - PolicyBasedRoutings PolicyBasedRoutings `json:"PolicyBasedRoutings" xml:"PolicyBasedRoutings"` -} - -// CreateDescribePolicyBasedRoutingsRequest creates a request to invoke DescribePolicyBasedRoutings API -func CreateDescribePolicyBasedRoutingsRequest() (request *DescribePolicyBasedRoutingsRequest) { - request = &DescribePolicyBasedRoutingsRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Smartag", "2018-03-13", "DescribePolicyBasedRoutings", "smartag", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribePolicyBasedRoutingsResponse creates a response to parse from DescribePolicyBasedRoutings response -func CreateDescribePolicyBasedRoutingsResponse() (response *DescribePolicyBasedRoutingsResponse) { - response = &DescribePolicyBasedRoutingsResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_qos_cars.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_qos_cars.go index 48664279686..62e6a165d61 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_qos_cars.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_qos_cars.go @@ -71,24 +71,24 @@ func (client *Client) DescribeQosCarsWithCallback(request *DescribeQosCarsReques // DescribeQosCarsRequest is the request struct for api DescribeQosCars type DescribeQosCarsRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - Description string `position:"Query"` - PageNumber requests.Integer `position:"Query"` - PageSize requests.Integer `position:"Query"` - QosId string `position:"Query"` - Order string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - QosCarId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + Description string `position:"Query" name:"Description"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + QosId string `position:"Query" name:"QosId"` + Order string `position:"Query" name:"Order"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + QosCarId string `position:"Query" name:"QosCarId"` } // DescribeQosCarsResponse is the response struct for api DescribeQosCars type DescribeQosCarsResponse struct { *responses.BaseResponse TotalCount int `json:"TotalCount" xml:"TotalCount"` - RequestId string `json:"RequestId" xml:"RequestId"` PageSize int `json:"PageSize" xml:"PageSize"` + RequestId string `json:"RequestId" xml:"RequestId"` PageNumber int `json:"PageNumber" xml:"PageNumber"` QosCars QosCarsInDescribeQosCars `json:"QosCars" xml:"QosCars"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_qos_policies.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_qos_policies.go index 8163646941d..54d51531950 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_qos_policies.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_qos_policies.go @@ -71,24 +71,24 @@ func (client *Client) DescribeQosPoliciesWithCallback(request *DescribeQosPolici // DescribeQosPoliciesRequest is the request struct for api DescribeQosPolicies type DescribeQosPoliciesRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - QosPolicyId string `position:"Query"` - Description string `position:"Query"` - PageNumber requests.Integer `position:"Query"` - PageSize requests.Integer `position:"Query"` - QosId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - Priority requests.Integer `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + QosPolicyId string `position:"Query" name:"QosPolicyId"` + Description string `position:"Query" name:"Description"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + QosId string `position:"Query" name:"QosId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + Priority requests.Integer `position:"Query" name:"Priority"` } // DescribeQosPoliciesResponse is the response struct for api DescribeQosPolicies type DescribeQosPoliciesResponse struct { *responses.BaseResponse TotalCount int `json:"TotalCount" xml:"TotalCount"` - RequestId string `json:"RequestId" xml:"RequestId"` PageSize int `json:"PageSize" xml:"PageSize"` + RequestId string `json:"RequestId" xml:"RequestId"` PageNumber int `json:"PageNumber" xml:"PageNumber"` QosPolicies QosPoliciesInDescribeQosPolicies `json:"QosPolicies" xml:"QosPolicies"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_qoses.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_qoses.go index 93a2bb02a00..98b08dfbe69 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_qoses.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_qoses.go @@ -71,22 +71,23 @@ func (client *Client) DescribeQosesWithCallback(request *DescribeQosesRequest, c // DescribeQosesRequest is the request struct for api DescribeQoses type DescribeQosesRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - PageNumber requests.Integer `position:"Query"` - PageSize requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - QosIds string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - QosName string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + QosIds string `position:"Query" name:"QosIds"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + QosName string `position:"Query" name:"QosName"` } // DescribeQosesResponse is the response struct for api DescribeQoses type DescribeQosesResponse struct { *responses.BaseResponse TotalCount int `json:"TotalCount" xml:"TotalCount"` - RequestId string `json:"RequestId" xml:"RequestId"` PageSize int `json:"PageSize" xml:"PageSize"` + RequestId string `json:"RequestId" xml:"RequestId"` PageNumber int `json:"PageNumber" xml:"PageNumber"` Qoses Qoses `json:"Qoses" xml:"Qoses"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_regions.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_regions.go index a42aa91b27e..1efff685d5f 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_regions.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_regions.go @@ -71,11 +71,11 @@ func (client *Client) DescribeRegionsWithCallback(request *DescribeRegionsReques // DescribeRegionsRequest is the request struct for api DescribeRegions type DescribeRegionsRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - AcceptLanguage string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + AcceptLanguage string `position:"Query" name:"AcceptLanguage"` } // DescribeRegionsResponse is the response struct for api DescribeRegions diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_route_distribution_strategies.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_route_distribution_strategies.go index 5132de94dc0..331eada8ea2 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_route_distribution_strategies.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_route_distribution_strategies.go @@ -71,22 +71,22 @@ func (client *Client) DescribeRouteDistributionStrategiesWithCallback(request *D // DescribeRouteDistributionStrategiesRequest is the request struct for api DescribeRouteDistributionStrategies type DescribeRouteDistributionStrategiesRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - PageNumber requests.Integer `position:"Query"` - PageSize requests.Integer `position:"Query"` - SourceType string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + SourceType string `position:"Query" name:"SourceType"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // DescribeRouteDistributionStrategiesResponse is the response struct for api DescribeRouteDistributionStrategies type DescribeRouteDistributionStrategiesResponse struct { *responses.BaseResponse TotalCount int `json:"TotalCount" xml:"TotalCount"` - RequestId string `json:"RequestId" xml:"RequestId"` PageSize int `json:"PageSize" xml:"PageSize"` + RequestId string `json:"RequestId" xml:"RequestId"` PageNumber int `json:"PageNumber" xml:"PageNumber"` Strategies Strategies `json:"Strategies" xml:"Strategies"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_current_dns.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_current_dns.go index 114b02f1c7a..55c138f7721 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_current_dns.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_current_dns.go @@ -71,19 +71,19 @@ func (client *Client) DescribeSagCurrentDnsWithCallback(request *DescribeSagCurr // DescribeSagCurrentDnsRequest is the request struct for api DescribeSagCurrentDns type DescribeSagCurrentDnsRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` } // DescribeSagCurrentDnsResponse is the response struct for api DescribeSagCurrentDns type DescribeSagCurrentDnsResponse struct { *responses.BaseResponse - SlaveDns string `json:"SlaveDns" xml:"SlaveDns"` RequestId string `json:"RequestId" xml:"RequestId"` + SlaveDns string `json:"SlaveDns" xml:"SlaveDns"` MasterDns string `json:"MasterDns" xml:"MasterDns"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_device_info.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_device_info.go index 42d24cdd51b..c56974f7018 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_device_info.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_device_info.go @@ -71,26 +71,27 @@ func (client *Client) DescribeSAGDeviceInfoWithCallback(request *DescribeSAGDevi // DescribeSAGDeviceInfoRequest is the request struct for api DescribeSAGDeviceInfo type DescribeSAGDeviceInfoRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` } // DescribeSAGDeviceInfoResponse is the response struct for api DescribeSAGDeviceInfo type DescribeSAGDeviceInfoResponse struct { *responses.BaseResponse - ControllerState string `json:"ControllerState" xml:"ControllerState"` ServiceIP string `json:"ServiceIP" xml:"ServiceIP"` - SmartAGType string `json:"SmartAGType" xml:"SmartAGType"` - SynStatus string `json:"SynStatus" xml:"SynStatus"` + ControllerState string `json:"ControllerState" xml:"ControllerState"` RequestId string `json:"RequestId" xml:"RequestId"` + SynStatus string `json:"SynStatus" xml:"SynStatus"` + SmartAGType string `json:"SmartAGType" xml:"SmartAGType"` Version string `json:"Version" xml:"Version"` VpnState string `json:"VpnState" xml:"VpnState"` StartupTime string `json:"StartupTime" xml:"StartupTime"` LastConnectedControllerTime string `json:"LastConnectedControllerTime" xml:"LastConnectedControllerTime"` + ResettableStatus string `json:"ResettableStatus" xml:"ResettableStatus"` } // CreateDescribeSAGDeviceInfoRequest creates a request to invoke DescribeSAGDeviceInfo API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_drop_top_n.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_drop_top_n.go index 682a93cc9a4..db484441249 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_drop_top_n.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_drop_top_n.go @@ -71,11 +71,11 @@ func (client *Client) DescribeSagDropTopNWithCallback(request *DescribeSagDropTo // DescribeSagDropTopNRequest is the request struct for api DescribeSagDropTopN type DescribeSagDropTopNRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - Size requests.Integer `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + Size requests.Integer `position:"Query" name:"Size"` } // DescribeSagDropTopNResponse is the response struct for api DescribeSagDropTopN diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_ec_route_backup_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_ec_route_backup_attribute.go deleted file mode 100644 index ebab334f637..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_ec_route_backup_attribute.go +++ /dev/null @@ -1,110 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeSagECRouteBackupAttribute invokes the smartag.DescribeSagECRouteBackupAttribute API synchronously -func (client *Client) DescribeSagECRouteBackupAttribute(request *DescribeSagECRouteBackupAttributeRequest) (response *DescribeSagECRouteBackupAttributeResponse, err error) { - response = CreateDescribeSagECRouteBackupAttributeResponse() - err = client.DoAction(request, response) - return -} - -// DescribeSagECRouteBackupAttributeWithChan invokes the smartag.DescribeSagECRouteBackupAttribute API asynchronously -func (client *Client) DescribeSagECRouteBackupAttributeWithChan(request *DescribeSagECRouteBackupAttributeRequest) (<-chan *DescribeSagECRouteBackupAttributeResponse, <-chan error) { - responseChan := make(chan *DescribeSagECRouteBackupAttributeResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeSagECRouteBackupAttribute(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeSagECRouteBackupAttributeWithCallback invokes the smartag.DescribeSagECRouteBackupAttribute API asynchronously -func (client *Client) DescribeSagECRouteBackupAttributeWithCallback(request *DescribeSagECRouteBackupAttributeRequest, callback func(response *DescribeSagECRouteBackupAttributeResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeSagECRouteBackupAttributeResponse - var err error - defer close(result) - response, err = client.DescribeSagECRouteBackupAttribute(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeSagECRouteBackupAttributeRequest is the request struct for api DescribeSagECRouteBackupAttribute -type DescribeSagECRouteBackupAttributeRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` -} - -// DescribeSagECRouteBackupAttributeResponse is the response struct for api DescribeSagECRouteBackupAttribute -type DescribeSagECRouteBackupAttributeResponse struct { - *responses.BaseResponse - HcIp string `json:"HcIp" xml:"HcIp"` - Status string `json:"Status" xml:"Status"` - RequestId string `json:"RequestId" xml:"RequestId"` - ExpressConnectionInterface string `json:"ExpressConnectionInterface" xml:"ExpressConnectionInterface"` - RouteBackup bool `json:"RouteBackup" xml:"RouteBackup"` - ExpressConnectionNexthop string `json:"ExpressConnectionNexthop" xml:"ExpressConnectionNexthop"` - SagId string `json:"SagId" xml:"SagId"` - Cidrs Cidrs `json:"Cidrs" xml:"Cidrs"` -} - -// CreateDescribeSagECRouteBackupAttributeRequest creates a request to invoke DescribeSagECRouteBackupAttribute API -func CreateDescribeSagECRouteBackupAttributeRequest() (request *DescribeSagECRouteBackupAttributeRequest) { - request = &DescribeSagECRouteBackupAttributeRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Smartag", "2018-03-13", "DescribeSagECRouteBackupAttribute", "smartag", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeSagECRouteBackupAttributeResponse creates a response to parse from DescribeSagECRouteBackupAttribute response -func CreateDescribeSagECRouteBackupAttributeResponse() (response *DescribeSagECRouteBackupAttributeResponse) { - response = &DescribeSagECRouteBackupAttributeResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_express_connect_interface_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_express_connect_interface_list.go index c89dff37120..d237493825a 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_express_connect_interface_list.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_express_connect_interface_list.go @@ -71,13 +71,13 @@ func (client *Client) DescribeSagExpressConnectInterfaceListWithCallback(request // DescribeSagExpressConnectInterfaceListRequest is the request struct for api DescribeSagExpressConnectInterfaceList type DescribeSagExpressConnectInterfaceListRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` - PortName string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` + PortName string `position:"Query" name:"PortName"` } // DescribeSagExpressConnectInterfaceListResponse is the response struct for api DescribeSagExpressConnectInterfaceList diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_global_route_protocol.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_global_route_protocol.go index 780b544b684..2bfbbe027c0 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_global_route_protocol.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_global_route_protocol.go @@ -71,12 +71,12 @@ func (client *Client) DescribeSagGlobalRouteProtocolWithCallback(request *Descri // DescribeSagGlobalRouteProtocolRequest is the request struct for api DescribeSagGlobalRouteProtocol type DescribeSagGlobalRouteProtocolRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` } // DescribeSagGlobalRouteProtocolResponse is the response struct for api DescribeSagGlobalRouteProtocol diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_ha.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_ha.go index 785a0592a9c..ce331c7a66e 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_ha.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_ha.go @@ -71,12 +71,12 @@ func (client *Client) DescribeSagHaWithCallback(request *DescribeSagHaRequest, c // DescribeSagHaRequest is the request struct for api DescribeSagHa type DescribeSagHaRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` } // DescribeSagHaResponse is the response struct for api DescribeSagHa diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_lan_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_lan_list.go index fe9c222e16d..0340fecdbb4 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_lan_list.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_lan_list.go @@ -71,12 +71,12 @@ func (client *Client) DescribeSagLanListWithCallback(request *DescribeSagLanList // DescribeSagLanListRequest is the request struct for api DescribeSagLanList type DescribeSagLanListRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` } // DescribeSagLanListResponse is the response struct for api DescribeSagLanList diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_management_port.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_management_port.go index 69515106e84..243f0f528a2 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_management_port.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_management_port.go @@ -71,12 +71,12 @@ func (client *Client) DescribeSagManagementPortWithCallback(request *DescribeSag // DescribeSagManagementPortRequest is the request struct for api DescribeSagManagementPort type DescribeSagManagementPortRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` } // DescribeSagManagementPortResponse is the response struct for api DescribeSagManagementPort diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_online_client_statistics.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_online_client_statistics.go index 6888c56f58d..e060d2e1929 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_online_client_statistics.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_online_client_statistics.go @@ -71,11 +71,11 @@ func (client *Client) DescribeSagOnlineClientStatisticsWithCallback(request *Des // DescribeSagOnlineClientStatisticsRequest is the request struct for api DescribeSagOnlineClientStatistics type DescribeSagOnlineClientStatisticsRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` SmartAGIds *[]string `position:"Query" name:"SmartAGIds" type:"Repeated"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` } // DescribeSagOnlineClientStatisticsResponse is the response struct for api DescribeSagOnlineClientStatistics diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_port_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_port_list.go index c9bc8c5f0d2..88b286c84da 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_port_list.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_port_list.go @@ -71,12 +71,12 @@ func (client *Client) DescribeSagPortListWithCallback(request *DescribeSagPortLi // DescribeSagPortListRequest is the request struct for api DescribeSagPortList type DescribeSagPortListRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` } // DescribeSagPortListResponse is the response struct for api DescribeSagPortList diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_port_route_protocol_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_port_route_protocol_list.go index d390a2427db..bd26b478635 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_port_route_protocol_list.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_port_route_protocol_list.go @@ -71,12 +71,12 @@ func (client *Client) DescribeSagPortRouteProtocolListWithCallback(request *Desc // DescribeSagPortRouteProtocolListRequest is the request struct for api DescribeSagPortRouteProtocolList type DescribeSagPortRouteProtocolListRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` } // DescribeSagPortRouteProtocolListResponse is the response struct for api DescribeSagPortRouteProtocolList diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_remote_access.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_remote_access.go index d906e0384e2..7a110dc7af9 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_remote_access.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_remote_access.go @@ -71,19 +71,19 @@ func (client *Client) DescribeSagRemoteAccessWithCallback(request *DescribeSagRe // DescribeSagRemoteAccessRequest is the request struct for api DescribeSagRemoteAccess type DescribeSagRemoteAccessRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - SerialNumber string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + SerialNumber string `position:"Query" name:"SerialNumber"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // DescribeSagRemoteAccessResponse is the response struct for api DescribeSagRemoteAccess type DescribeSagRemoteAccessResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` Message string `json:"Message" xml:"Message"` + RequestId string `json:"RequestId" xml:"RequestId"` SmartAGId string `json:"SmartAGId" xml:"SmartAGId"` Code string `json:"Code" xml:"Code"` Success bool `json:"Success" xml:"Success"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_route_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_route_list.go index a95bc32a3d2..2704d11965f 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_route_list.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_route_list.go @@ -71,12 +71,12 @@ func (client *Client) DescribeSagRouteListWithCallback(request *DescribeSagRoute // DescribeSagRouteListRequest is the request struct for api DescribeSagRouteList type DescribeSagRouteListRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` } // DescribeSagRouteListResponse is the response struct for api DescribeSagRouteList diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_route_protocol_bgp.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_route_protocol_bgp.go index 585638f9b99..7622828c86a 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_route_protocol_bgp.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_route_protocol_bgp.go @@ -71,23 +71,23 @@ func (client *Client) DescribeSagRouteProtocolBgpWithCallback(request *DescribeS // DescribeSagRouteProtocolBgpRequest is the request struct for api DescribeSagRouteProtocolBgp type DescribeSagRouteProtocolBgpRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` } // DescribeSagRouteProtocolBgpResponse is the response struct for api DescribeSagRouteProtocolBgp type DescribeSagRouteProtocolBgpResponse struct { *responses.BaseResponse HoldTime int `json:"HoldTime" xml:"HoldTime"` - AdvertiseIps string `json:"AdvertiseIps" xml:"AdvertiseIps"` RequestId string `json:"RequestId" xml:"RequestId"` KeepAlive int `json:"KeepAlive" xml:"KeepAlive"` - RouterId string `json:"RouterId" xml:"RouterId"` LocalAs int `json:"LocalAs" xml:"LocalAs"` + RouterId string `json:"RouterId" xml:"RouterId"` + AdvertiseIps string `json:"AdvertiseIps" xml:"AdvertiseIps"` TaskStates []TaskState `json:"TaskStates" xml:"TaskStates"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_route_protocol_ospf.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_route_protocol_ospf.go index f8a9f2529ea..5cfedffb7e3 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_route_protocol_ospf.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_route_protocol_ospf.go @@ -71,12 +71,12 @@ func (client *Client) DescribeSagRouteProtocolOspfWithCallback(request *Describe // DescribeSagRouteProtocolOspfRequest is the request struct for api DescribeSagRouteProtocolOspf type DescribeSagRouteProtocolOspfRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` } // DescribeSagRouteProtocolOspfResponse is the response struct for api DescribeSagRouteProtocolOspf @@ -86,8 +86,8 @@ type DescribeSagRouteProtocolOspfResponse struct { DeadTime int `json:"DeadTime" xml:"DeadTime"` Md5KeyId int `json:"Md5KeyId" xml:"Md5KeyId"` AreaId string `json:"AreaId" xml:"AreaId"` - HelloTime int `json:"HelloTime" xml:"HelloTime"` RouterId string `json:"RouterId" xml:"RouterId"` + HelloTime int `json:"HelloTime" xml:"HelloTime"` AreaType string `json:"AreaType" xml:"AreaType"` Md5Key string `json:"Md5Key" xml:"Md5Key"` AuthenticationType string `json:"AuthenticationType" xml:"AuthenticationType"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_routeable_address.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_routeable_address.go deleted file mode 100644 index c7ccd64b3bd..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_routeable_address.go +++ /dev/null @@ -1,105 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeSagRouteableAddress invokes the smartag.DescribeSagRouteableAddress API synchronously -func (client *Client) DescribeSagRouteableAddress(request *DescribeSagRouteableAddressRequest) (response *DescribeSagRouteableAddressResponse, err error) { - response = CreateDescribeSagRouteableAddressResponse() - err = client.DoAction(request, response) - return -} - -// DescribeSagRouteableAddressWithChan invokes the smartag.DescribeSagRouteableAddress API asynchronously -func (client *Client) DescribeSagRouteableAddressWithChan(request *DescribeSagRouteableAddressRequest) (<-chan *DescribeSagRouteableAddressResponse, <-chan error) { - responseChan := make(chan *DescribeSagRouteableAddressResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeSagRouteableAddress(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeSagRouteableAddressWithCallback invokes the smartag.DescribeSagRouteableAddress API asynchronously -func (client *Client) DescribeSagRouteableAddressWithCallback(request *DescribeSagRouteableAddressRequest, callback func(response *DescribeSagRouteableAddressResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeSagRouteableAddressResponse - var err error - defer close(result) - response, err = client.DescribeSagRouteableAddress(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeSagRouteableAddressRequest is the request struct for api DescribeSagRouteableAddress -type DescribeSagRouteableAddressRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SagId string `position:"Query"` -} - -// DescribeSagRouteableAddressResponse is the response struct for api DescribeSagRouteableAddress -type DescribeSagRouteableAddressResponse struct { - *responses.BaseResponse - Origin string `json:"Origin" xml:"Origin"` - RequestId string `json:"RequestId" xml:"RequestId"` - RouteableAddress string `json:"RouteableAddress" xml:"RouteableAddress"` -} - -// CreateDescribeSagRouteableAddressRequest creates a request to invoke DescribeSagRouteableAddress API -func CreateDescribeSagRouteableAddressRequest() (request *DescribeSagRouteableAddressRequest) { - request = &DescribeSagRouteableAddressRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Smartag", "2018-03-13", "DescribeSagRouteableAddress", "smartag", "openAPI") - request.Method = requests.POST - return -} - -// CreateDescribeSagRouteableAddressResponse creates a response to parse from DescribeSagRouteableAddress response -func CreateDescribeSagRouteableAddressResponse() (response *DescribeSagRouteableAddressResponse) { - response = &DescribeSagRouteableAddressResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_static_route_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_static_route_list.go index 98c282b4727..36c512280cc 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_static_route_list.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_static_route_list.go @@ -71,20 +71,20 @@ func (client *Client) DescribeSagStaticRouteListWithCallback(request *DescribeSa // DescribeSagStaticRouteListRequest is the request struct for api DescribeSagStaticRouteList type DescribeSagStaticRouteListRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` } // DescribeSagStaticRouteListResponse is the response struct for api DescribeSagStaticRouteList type DescribeSagStaticRouteListResponse struct { *responses.BaseResponse RequestId string `json:"RequestId" xml:"RequestId"` - TaskStates []TaskState `json:"TaskStates" xml:"TaskStates"` StaticRoutes []StaticRoute `json:"StaticRoutes" xml:"StaticRoutes"` + TaskStates []TaskState `json:"TaskStates" xml:"TaskStates"` } // CreateDescribeSagStaticRouteListRequest creates a request to invoke DescribeSagStaticRouteList API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_traffic_top_n.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_traffic_top_n.go index 1c2f16605f2..06f754850ca 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_traffic_top_n.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_traffic_top_n.go @@ -71,11 +71,11 @@ func (client *Client) DescribeSagTrafficTopNWithCallback(request *DescribeSagTra // DescribeSagTrafficTopNRequest is the request struct for api DescribeSagTrafficTopN type DescribeSagTrafficTopNRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - Size requests.Integer `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + Size requests.Integer `position:"Query" name:"Size"` } // DescribeSagTrafficTopNResponse is the response struct for api DescribeSagTrafficTopN diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_user_dns.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_user_dns.go index 4a9386ea7d6..a9547e182ee 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_user_dns.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_user_dns.go @@ -71,19 +71,19 @@ func (client *Client) DescribeSagUserDnsWithCallback(request *DescribeSagUserDns // DescribeSagUserDnsRequest is the request struct for api DescribeSagUserDns type DescribeSagUserDnsRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` } // DescribeSagUserDnsResponse is the response struct for api DescribeSagUserDns type DescribeSagUserDnsResponse struct { *responses.BaseResponse - SlaveDns string `json:"SlaveDns" xml:"SlaveDns"` RequestId string `json:"RequestId" xml:"RequestId"` + SlaveDns string `json:"SlaveDns" xml:"SlaveDns"` MasterDns string `json:"MasterDns" xml:"MasterDns"` TaskStates []TaskState `json:"TaskStates" xml:"TaskStates"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_vbr_relations.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_vbr_relations.go index 399961b3536..64aa08cc4a3 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_vbr_relations.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_vbr_relations.go @@ -71,12 +71,12 @@ func (client *Client) DescribeSagVbrRelationsWithCallback(request *DescribeSagVb // DescribeSagVbrRelationsRequest is the request struct for api DescribeSagVbrRelations type DescribeSagVbrRelationsRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` VbrInstanceIds *[]string `position:"Query" name:"VbrInstanceIds" type:"Repeated"` - VbrRegionId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` + VbrRegionId string `position:"Query" name:"VbrRegionId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` } // DescribeSagVbrRelationsResponse is the response struct for api DescribeSagVbrRelations diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_wan4_g.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_wan4_g.go index 21b836abdee..464fb25b895 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_wan4_g.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_wan4_g.go @@ -71,12 +71,12 @@ func (client *Client) DescribeSagWan4GWithCallback(request *DescribeSagWan4GRequ // DescribeSagWan4GRequest is the request struct for api DescribeSagWan4G type DescribeSagWan4GRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` } // DescribeSagWan4GResponse is the response struct for api DescribeSagWan4G @@ -87,8 +87,8 @@ type DescribeSagWan4GResponse struct { RequestId string `json:"RequestId" xml:"RequestId"` Priority int `json:"Priority" xml:"Priority"` Ip string `json:"Ip" xml:"Ip"` - Mac string `json:"Mac" xml:"Mac"` Strength string `json:"Strength" xml:"Strength"` + Mac string `json:"Mac" xml:"Mac"` } // CreateDescribeSagWan4GRequest creates a request to invoke DescribeSagWan4G API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_wan_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_wan_list.go index d88623c2344..2a429eb0149 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_wan_list.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_wan_list.go @@ -71,12 +71,12 @@ func (client *Client) DescribeSagWanListWithCallback(request *DescribeSagWanList // DescribeSagWanListRequest is the request struct for api DescribeSagWanList type DescribeSagWanListRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` } // DescribeSagWanListResponse is the response struct for api DescribeSagWanList diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_wan_snat.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_wan_snat.go index ec7d724db45..aae32772b8c 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_wan_snat.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_wan_snat.go @@ -71,12 +71,12 @@ func (client *Client) DescribeSagWanSnatWithCallback(request *DescribeSagWanSnat // DescribeSagWanSnatRequest is the request struct for api DescribeSagWanSnat type DescribeSagWanSnatRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` } // DescribeSagWanSnatResponse is the response struct for api DescribeSagWanSnat diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_wifi.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_wifi.go index fba1a869761..e688f73aec4 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_wifi.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_sag_wifi.go @@ -71,12 +71,12 @@ func (client *Client) DescribeSagWifiWithCallback(request *DescribeSagWifiReques // DescribeSagWifiRequest is the request struct for api DescribeSagWifi type DescribeSagWifiRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` } // DescribeSagWifiResponse is the response struct for api DescribeSagWifi @@ -84,13 +84,13 @@ type DescribeSagWifiResponse struct { *responses.BaseResponse IsEnable string `json:"IsEnable" xml:"IsEnable"` RequestId string `json:"RequestId" xml:"RequestId"` - Channel string `json:"Channel" xml:"Channel"` - Bandwidth string `json:"Bandwidth" xml:"Bandwidth"` IsAuth string `json:"IsAuth" xml:"IsAuth"` + Bandwidth string `json:"Bandwidth" xml:"Bandwidth"` + Channel string `json:"Channel" xml:"Channel"` Ssid string `json:"Ssid" xml:"Ssid"` - IsBroadcast string `json:"IsBroadcast" xml:"IsBroadcast"` - EncryptAlgorithm string `json:"EncryptAlgorithm" xml:"EncryptAlgorithm"` AuthenticationType string `json:"AuthenticationType" xml:"AuthenticationType"` + EncryptAlgorithm string `json:"EncryptAlgorithm" xml:"EncryptAlgorithm"` + IsBroadcast string `json:"IsBroadcast" xml:"IsBroadcast"` TaskStates []TaskState `json:"TaskStates" xml:"TaskStates"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_smart_access_gateway_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_smart_access_gateway_attribute.go index 90333b940eb..e4de452da3b 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_smart_access_gateway_attribute.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_smart_access_gateway_attribute.go @@ -71,52 +71,57 @@ func (client *Client) DescribeSmartAccessGatewayAttributeWithCallback(request *D // DescribeSmartAccessGatewayAttributeRequest is the request struct for api DescribeSmartAccessGatewayAttribute type DescribeSmartAccessGatewayAttributeRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // DescribeSmartAccessGatewayAttributeResponse is the response struct for api DescribeSmartAccessGatewayAttribute type DescribeSmartAccessGatewayAttributeResponse struct { *responses.BaseResponse - Description string `json:"Description" xml:"Description"` - UpBandwidth4G int `json:"UpBandwidth4G" xml:"UpBandwidth4G"` - ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` - EndTime int64 `json:"EndTime" xml:"EndTime"` - UserCount int `json:"UserCount" xml:"UserCount"` - VpnStatus string `json:"VpnStatus" xml:"VpnStatus"` - MaxBandwidth string `json:"MaxBandwidth" xml:"MaxBandwidth"` - AssociatedCcnName string `json:"AssociatedCcnName" xml:"AssociatedCcnName"` - BoxControllerIp string `json:"BoxControllerIp" xml:"BoxControllerIp"` - CidrBlock string `json:"CidrBlock" xml:"CidrBlock"` - UpBandwidthWan int `json:"UpBandwidthWan" xml:"UpBandwidthWan"` - Name string `json:"Name" xml:"Name"` - OptimizationType bool `json:"OptimizationType" xml:"OptimizationType"` - IpsecStatus string `json:"IpsecStatus" xml:"IpsecStatus"` - RoutingStrategy string `json:"RoutingStrategy" xml:"RoutingStrategy"` - AssociatedCcnId string `json:"AssociatedCcnId" xml:"AssociatedCcnId"` - InstanceType string `json:"InstanceType" xml:"InstanceType"` - SmartAGId string `json:"SmartAGId" xml:"SmartAGId"` - SecurityLockThreshold int `json:"SecurityLockThreshold" xml:"SecurityLockThreshold"` - ResellerUid string `json:"ResellerUid" xml:"ResellerUid"` - Status string `json:"Status" xml:"Status"` - RequestId string `json:"RequestId" xml:"RequestId"` - CreateTime int64 `json:"CreateTime" xml:"CreateTime"` - DataPlan int64 `json:"DataPlan" xml:"DataPlan"` - EnableOptimization bool `json:"EnableOptimization" xml:"EnableOptimization"` - City string `json:"City" xml:"City"` - ResellerInstanceId string `json:"ResellerInstanceId" xml:"ResellerInstanceId"` - BackupBoxControllerIp string `json:"BackupBoxControllerIp" xml:"BackupBoxControllerIp"` - SerialNumber string `json:"SerialNumber" xml:"SerialNumber"` - TrafficMasterSn string `json:"TrafficMasterSn" xml:"TrafficMasterSn"` - AccessPointId string `json:"AccessPointId" xml:"AccessPointId"` - QosIds QosIds `json:"QosIds" xml:"QosIds"` - FlowLogIds FlowLogIds `json:"FlowLogIds" xml:"FlowLogIds"` - AclIds AclIds `json:"AclIds" xml:"AclIds"` - Links LinksInDescribeSmartAccessGatewayAttribute `json:"Links" xml:"Links"` - Devices Devices `json:"Devices" xml:"Devices"` + UpBandwidth4G int `json:"UpBandwidth4G" xml:"UpBandwidth4G"` + Description string `json:"Description" xml:"Description"` + EndTime int64 `json:"EndTime" xml:"EndTime"` + ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` + UserCount int `json:"UserCount" xml:"UserCount"` + AssociatedCcnName string `json:"AssociatedCcnName" xml:"AssociatedCcnName"` + MaxBandwidth string `json:"MaxBandwidth" xml:"MaxBandwidth"` + VpnStatus string `json:"VpnStatus" xml:"VpnStatus"` + BoxControllerIp string `json:"BoxControllerIp" xml:"BoxControllerIp"` + UpBandwidthWan int `json:"UpBandwidthWan" xml:"UpBandwidthWan"` + CidrBlock string `json:"CidrBlock" xml:"CidrBlock"` + Name string `json:"Name" xml:"Name"` + OptimizationType bool `json:"OptimizationType" xml:"OptimizationType"` + IpsecStatus string `json:"IpsecStatus" xml:"IpsecStatus"` + RoutingStrategy string `json:"RoutingStrategy" xml:"RoutingStrategy"` + AssociatedCcnId string `json:"AssociatedCcnId" xml:"AssociatedCcnId"` + SmartAGId string `json:"SmartAGId" xml:"SmartAGId"` + InstanceType string `json:"InstanceType" xml:"InstanceType"` + ResellerUid string `json:"ResellerUid" xml:"ResellerUid"` + SecurityLockThreshold int `json:"SecurityLockThreshold" xml:"SecurityLockThreshold"` + Status string `json:"Status" xml:"Status"` + RequestId string `json:"RequestId" xml:"RequestId"` + CreateTime int64 `json:"CreateTime" xml:"CreateTime"` + DataPlan int64 `json:"DataPlan" xml:"DataPlan"` + EnableOptimization bool `json:"EnableOptimization" xml:"EnableOptimization"` + City string `json:"City" xml:"City"` + ResellerInstanceId string `json:"ResellerInstanceId" xml:"ResellerInstanceId"` + SerialNumber string `json:"SerialNumber" xml:"SerialNumber"` + BackupBoxControllerIp string `json:"BackupBoxControllerIp" xml:"BackupBoxControllerIp"` + TrafficMasterSn string `json:"TrafficMasterSn" xml:"TrafficMasterSn"` + AccessPointId string `json:"AccessPointId" xml:"AccessPointId"` + ApplicationBandwidthPackageId string `json:"ApplicationBandwidthPackageId" xml:"ApplicationBandwidthPackageId"` + ApplicationBandwidthPackageName string `json:"ApplicationBandwidthPackageName" xml:"ApplicationBandwidthPackageName"` + AccelerateBandwidth int64 `json:"AccelerateBandwidth" xml:"AccelerateBandwidth"` + ApplicationBandwidthPackageBussinessStatus string `json:"ApplicationBandwidthPackageBussinessStatus" xml:"ApplicationBandwidthPackageBussinessStatus"` + QosIds QosIds `json:"QosIds" xml:"QosIds"` + FlowLogIds FlowLogIds `json:"FlowLogIds" xml:"FlowLogIds"` + AclIds AclIds `json:"AclIds" xml:"AclIds"` + ApplicationBandwidthPackageOperationLocks ApplicationBandwidthPackageOperationLocks `json:"ApplicationBandwidthPackageOperationLocks" xml:"ApplicationBandwidthPackageOperationLocks"` + Devices Devices `json:"Devices" xml:"Devices"` + Links LinksInDescribeSmartAccessGatewayAttribute `json:"Links" xml:"Links"` } // CreateDescribeSmartAccessGatewayAttributeRequest creates a request to invoke DescribeSmartAccessGatewayAttribute API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_smart_access_gateway_client_users.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_smart_access_gateway_client_users.go index b8ecc7f16f1..652e47edb28 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_smart_access_gateway_client_users.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_smart_access_gateway_client_users.go @@ -71,23 +71,25 @@ func (client *Client) DescribeSmartAccessGatewayClientUsersWithCallback(request // DescribeSmartAccessGatewayClientUsersRequest is the request struct for api DescribeSmartAccessGatewayClientUsers type DescribeSmartAccessGatewayClientUsersRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - PageNumber requests.Integer `position:"Query"` - PageSize requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - UserMail string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - UserName string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + EndLoginTime requests.Integer `position:"Query" name:"EndLoginTime"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + UserMail string `position:"Query" name:"UserMail"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + BeginLoginTime requests.Integer `position:"Query" name:"BeginLoginTime"` + SmartAGId string `position:"Query" name:"SmartAGId"` + UserName string `position:"Query" name:"UserName"` } // DescribeSmartAccessGatewayClientUsersResponse is the response struct for api DescribeSmartAccessGatewayClientUsers type DescribeSmartAccessGatewayClientUsersResponse struct { *responses.BaseResponse TotalCount int `json:"TotalCount" xml:"TotalCount"` - RequestId string `json:"RequestId" xml:"RequestId"` PageSize int `json:"PageSize" xml:"PageSize"` + RequestId string `json:"RequestId" xml:"RequestId"` PageNumber int `json:"PageNumber" xml:"PageNumber"` Users UsersInDescribeSmartAccessGatewayClientUsers `json:"Users" xml:"Users"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_smart_access_gateway_ha.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_smart_access_gateway_ha.go index e714992fecf..aa8815569be 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_smart_access_gateway_ha.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_smart_access_gateway_ha.go @@ -71,11 +71,11 @@ func (client *Client) DescribeSmartAccessGatewayHaWithCallback(request *Describe // DescribeSmartAccessGatewayHaRequest is the request struct for api DescribeSmartAccessGatewayHa type DescribeSmartAccessGatewayHaRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // DescribeSmartAccessGatewayHaResponse is the response struct for api DescribeSmartAccessGatewayHa diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_smart_access_gateway_versions.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_smart_access_gateway_versions.go index 7732f88c509..0494940a634 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_smart_access_gateway_versions.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_smart_access_gateway_versions.go @@ -71,13 +71,13 @@ func (client *Client) DescribeSmartAccessGatewayVersionsWithCallback(request *De // DescribeSmartAccessGatewayVersionsRequest is the request struct for api DescribeSmartAccessGatewayVersions type DescribeSmartAccessGatewayVersionsRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - VersionType string `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + VersionType string `position:"Query" name:"VersionType"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` } // DescribeSmartAccessGatewayVersionsResponse is the response struct for api DescribeSmartAccessGatewayVersions diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_smart_access_gateways.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_smart_access_gateways.go index dfb944e58f6..99bef8ba238 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_smart_access_gateways.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_smart_access_gateways.go @@ -71,35 +71,36 @@ func (client *Client) DescribeSmartAccessGatewaysWithCallback(request *DescribeS // DescribeSmartAccessGatewaysRequest is the request struct for api DescribeSmartAccessGateways type DescribeSmartAccessGatewaysRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - AclIds string `position:"Query"` - CanAssociateQos requests.Boolean `position:"Query"` - SoftwareVersion string `position:"Query"` - UnboundAclIds string `position:"Query"` - PageNumber requests.Integer `position:"Query"` - VersionComparator string `position:"Query"` - ResourceGroupId string `position:"Query"` - PageSize requests.Integer `position:"Query"` - InstanceType string `position:"Query"` - HardwareType string `position:"Query"` - SmartAGIds *[]string `position:"Query" name:"SmartAGIds" type:"Repeated"` - SerialNumber string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - AssociatedCcnId string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - BusinessState string `position:"Query"` - Name string `position:"Query"` - SmartAGId string `position:"Query"` - Status string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + AclIds string `position:"Query" name:"AclIds"` + CanAssociateQos requests.Boolean `position:"Query" name:"CanAssociateQos"` + SoftwareVersion string `position:"Query" name:"SoftwareVersion"` + UnboundAclIds string `position:"Query" name:"UnboundAclIds"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` + VersionComparator string `position:"Query" name:"VersionComparator"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + InstanceType string `position:"Query" name:"InstanceType"` + HardwareType string `position:"Query" name:"HardwareType"` + SmartAGIds *[]string `position:"Query" name:"SmartAGIds" type:"Repeated"` + ApplicationBandwidthPackageId string `position:"Query" name:"ApplicationBandwidthPackageId"` + SerialNumber string `position:"Query" name:"SerialNumber"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + AssociatedCcnId string `position:"Query" name:"AssociatedCcnId"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + BusinessState string `position:"Query" name:"BusinessState"` + Name string `position:"Query" name:"Name"` + SmartAGId string `position:"Query" name:"SmartAGId"` + Status string `position:"Query" name:"Status"` } // DescribeSmartAccessGatewaysResponse is the response struct for api DescribeSmartAccessGateways type DescribeSmartAccessGatewaysResponse struct { *responses.BaseResponse TotalCount int `json:"TotalCount" xml:"TotalCount"` - RequestId string `json:"RequestId" xml:"RequestId"` PageSize int `json:"PageSize" xml:"PageSize"` + RequestId string `json:"RequestId" xml:"RequestId"` PageNumber int `json:"PageNumber" xml:"PageNumber"` SmartAccessGateways SmartAccessGatewaysInDescribeSmartAccessGateways `json:"SmartAccessGateways" xml:"SmartAccessGateways"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_snat_entries.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_snat_entries.go index bb6015a831d..57cc6d346a3 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_snat_entries.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_snat_entries.go @@ -71,21 +71,21 @@ func (client *Client) DescribeSnatEntriesWithCallback(request *DescribeSnatEntri // DescribeSnatEntriesRequest is the request struct for api DescribeSnatEntries type DescribeSnatEntriesRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - PageNumber requests.Integer `position:"Query"` - PageSize requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // DescribeSnatEntriesResponse is the response struct for api DescribeSnatEntries type DescribeSnatEntriesResponse struct { *responses.BaseResponse TotalCount int `json:"TotalCount" xml:"TotalCount"` - RequestId string `json:"RequestId" xml:"RequestId"` PageSize int `json:"PageSize" xml:"PageSize"` + RequestId string `json:"RequestId" xml:"RequestId"` PageNumber int `json:"PageNumber" xml:"PageNumber"` SnatEntries SnatEntries `json:"SnatEntries" xml:"SnatEntries"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_unbind_flow_log_sags.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_unbind_flow_log_sags.go index 7650627a023..828e034ab56 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_unbind_flow_log_sags.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_unbind_flow_log_sags.go @@ -71,10 +71,11 @@ func (client *Client) DescribeUnbindFlowLogSagsWithCallback(request *DescribeUnb // DescribeUnbindFlowLogSagsRequest is the request struct for api DescribeUnbindFlowLogSags type DescribeUnbindFlowLogSagsRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` } // DescribeUnbindFlowLogSagsResponse is the response struct for api DescribeUnbindFlowLogSags diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_user_flow_statistics.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_user_flow_statistics.go index c96413878b8..bcc307525ff 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_user_flow_statistics.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_user_flow_statistics.go @@ -71,13 +71,13 @@ func (client *Client) DescribeUserFlowStatisticsWithCallback(request *DescribeUs // DescribeUserFlowStatisticsRequest is the request struct for api DescribeUserFlowStatistics type DescribeUserFlowStatisticsRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` UserNames *[]string `position:"Query" name:"UserNames" type:"Repeated"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - StatisticsDate string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + StatisticsDate string `position:"Query" name:"StatisticsDate"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // DescribeUserFlowStatisticsResponse is the response struct for api DescribeUserFlowStatistics diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_user_online_client_statistics.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_user_online_client_statistics.go index eef3c205360..8ebadb00607 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_user_online_client_statistics.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_user_online_client_statistics.go @@ -71,12 +71,12 @@ func (client *Client) DescribeUserOnlineClientStatisticsWithCallback(request *De // DescribeUserOnlineClientStatisticsRequest is the request struct for api DescribeUserOnlineClientStatistics type DescribeUserOnlineClientStatisticsRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` UserNames *[]string `position:"Query" name:"UserNames" type:"Repeated"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // DescribeUserOnlineClientStatisticsResponse is the response struct for api DescribeUserOnlineClientStatistics diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_user_online_clients.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_user_online_clients.go index 6fdb81fdf7d..11973fc3152 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_user_online_clients.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/describe_user_online_clients.go @@ -71,12 +71,12 @@ func (client *Client) DescribeUserOnlineClientsWithCallback(request *DescribeUse // DescribeUserOnlineClientsRequest is the request struct for api DescribeUserOnlineClients type DescribeUserOnlineClientsRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - UserName string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + UserName string `position:"Query" name:"UserName"` } // DescribeUserOnlineClientsResponse is the response struct for api DescribeUserOnlineClients diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/detach_network_optimization_sags.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/detach_network_optimization_sags.go deleted file mode 100644 index c05850b6a97..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/detach_network_optimization_sags.go +++ /dev/null @@ -1,104 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DetachNetworkOptimizationSags invokes the smartag.DetachNetworkOptimizationSags API synchronously -func (client *Client) DetachNetworkOptimizationSags(request *DetachNetworkOptimizationSagsRequest) (response *DetachNetworkOptimizationSagsResponse, err error) { - response = CreateDetachNetworkOptimizationSagsResponse() - err = client.DoAction(request, response) - return -} - -// DetachNetworkOptimizationSagsWithChan invokes the smartag.DetachNetworkOptimizationSags API asynchronously -func (client *Client) DetachNetworkOptimizationSagsWithChan(request *DetachNetworkOptimizationSagsRequest) (<-chan *DetachNetworkOptimizationSagsResponse, <-chan error) { - responseChan := make(chan *DetachNetworkOptimizationSagsResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DetachNetworkOptimizationSags(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DetachNetworkOptimizationSagsWithCallback invokes the smartag.DetachNetworkOptimizationSags API asynchronously -func (client *Client) DetachNetworkOptimizationSagsWithCallback(request *DetachNetworkOptimizationSagsRequest, callback func(response *DetachNetworkOptimizationSagsResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DetachNetworkOptimizationSagsResponse - var err error - defer close(result) - response, err = client.DetachNetworkOptimizationSags(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DetachNetworkOptimizationSagsRequest is the request struct for api DetachNetworkOptimizationSags -type DetachNetworkOptimizationSagsRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - NetworkOptId string `position:"Query"` - SmartAGIds *[]string `position:"Query" name:"SmartAGIds" type:"Repeated"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` -} - -// DetachNetworkOptimizationSagsResponse is the response struct for api DetachNetworkOptimizationSags -type DetachNetworkOptimizationSagsResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateDetachNetworkOptimizationSagsRequest creates a request to invoke DetachNetworkOptimizationSags API -func CreateDetachNetworkOptimizationSagsRequest() (request *DetachNetworkOptimizationSagsRequest) { - request = &DetachNetworkOptimizationSagsRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Smartag", "2018-03-13", "DetachNetworkOptimizationSags", "smartag", "openAPI") - request.Method = requests.POST - return -} - -// CreateDetachNetworkOptimizationSagsResponse creates a response to parse from DetachNetworkOptimizationSags response -func CreateDetachNetworkOptimizationSagsResponse() (response *DetachNetworkOptimizationSagsResponse) { - response = &DetachNetworkOptimizationSagsResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/diagnose_smart_access_gateway.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/diagnose_smart_access_gateway.go index ab478ddfd2a..28683567d4b 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/diagnose_smart_access_gateway.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/diagnose_smart_access_gateway.go @@ -71,12 +71,12 @@ func (client *Client) DiagnoseSmartAccessGatewayWithCallback(request *DiagnoseSm // DiagnoseSmartAccessGatewayRequest is the request struct for api DiagnoseSmartAccessGateway type DiagnoseSmartAccessGatewayRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` } // DiagnoseSmartAccessGatewayResponse is the response struct for api DiagnoseSmartAccessGateway diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/disable_smart_access_gateway_user.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/disable_smart_access_gateway_user.go index 1280a85a4df..038eabae97f 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/disable_smart_access_gateway_user.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/disable_smart_access_gateway_user.go @@ -71,12 +71,12 @@ func (client *Client) DisableSmartAccessGatewayUserWithCallback(request *Disable // DisableSmartAccessGatewayUserRequest is the request struct for api DisableSmartAccessGatewayUser type DisableSmartAccessGatewayUserRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - UserName string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + UserName string `position:"Query" name:"UserName"` } // DisableSmartAccessGatewayUserResponse is the response struct for api DisableSmartAccessGatewayUser diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/disable_smart_ag_dpi_monitor.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/disable_smart_ag_dpi_monitor.go index 9e89a9b6e68..53ec603b447 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/disable_smart_ag_dpi_monitor.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/disable_smart_ag_dpi_monitor.go @@ -71,13 +71,13 @@ func (client *Client) DisableSmartAGDpiMonitorWithCallback(request *DisableSmart // DisableSmartAGDpiMonitorRequest is the request struct for api DisableSmartAGDpiMonitor type DisableSmartAGDpiMonitorRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ClientToken string `position:"Query"` - DryRun requests.Boolean `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ClientToken string `position:"Query" name:"ClientToken"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // DisableSmartAGDpiMonitorResponse is the response struct for api DisableSmartAGDpiMonitor diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/disassociate_acl.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/disassociate_acl.go index f7b47f65f96..a82f4793e0c 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/disassociate_acl.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/disassociate_acl.go @@ -71,12 +71,12 @@ func (client *Client) DisassociateACLWithCallback(request *DisassociateACLReques // DisassociateACLRequest is the request struct for api DisassociateACL type DisassociateACLRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - AclId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + AclId string `position:"Query" name:"AclId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // DisassociateACLResponse is the response struct for api DisassociateACL diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/disassociate_flow_log.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/disassociate_flow_log.go index 5dff9748bae..2987a393ccd 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/disassociate_flow_log.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/disassociate_flow_log.go @@ -71,12 +71,12 @@ func (client *Client) DisassociateFlowLogWithCallback(request *DisassociateFlowL // DisassociateFlowLogRequest is the request struct for api DisassociateFlowLog type DisassociateFlowLogRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - FlowLogId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + FlowLogId string `position:"Query" name:"FlowLogId"` } // DisassociateFlowLogResponse is the response struct for api DisassociateFlowLog diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/disassociate_qos.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/disassociate_qos.go index 804e200cc8b..e05fea5cd41 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/disassociate_qos.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/disassociate_qos.go @@ -71,12 +71,12 @@ func (client *Client) DisassociateQosWithCallback(request *DisassociateQosReques // DisassociateQosRequest is the request struct for api DisassociateQos type DisassociateQosRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - QosId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + QosId string `position:"Query" name:"QosId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // DisassociateQosResponse is the response struct for api DisassociateQos diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/discribe_smart_access_gateway_diagnosis_report.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/discribe_smart_access_gateway_diagnosis_report.go index 0e5ec3f6bc2..cd97d610c1d 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/discribe_smart_access_gateway_diagnosis_report.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/discribe_smart_access_gateway_diagnosis_report.go @@ -71,12 +71,12 @@ func (client *Client) DiscribeSmartAccessGatewayDiagnosisReportWithCallback(requ // DiscribeSmartAccessGatewayDiagnosisReportRequest is the request struct for api DiscribeSmartAccessGatewayDiagnosisReport type DiscribeSmartAccessGatewayDiagnosisReportRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` } // DiscribeSmartAccessGatewayDiagnosisReportResponse is the response struct for api DiscribeSmartAccessGatewayDiagnosisReport diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/downgrade_smart_access_gateway.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/downgrade_smart_access_gateway.go index bda2e8beaf1..31724d9988c 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/downgrade_smart_access_gateway.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/downgrade_smart_access_gateway.go @@ -71,15 +71,15 @@ func (client *Client) DowngradeSmartAccessGatewayWithCallback(request *Downgrade // DowngradeSmartAccessGatewayRequest is the request struct for api DowngradeSmartAccessGateway type DowngradeSmartAccessGatewayRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - BandWidthSpec requests.Integer `position:"Query"` - UserCount requests.Integer `position:"Query"` - AutoPay requests.Boolean `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - DataPlan requests.Integer `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + BandWidthSpec requests.Integer `position:"Query" name:"BandWidthSpec"` + UserCount requests.Integer `position:"Query" name:"UserCount"` + AutoPay requests.Boolean `position:"Query" name:"AutoPay"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + DataPlan requests.Integer `position:"Query" name:"DataPlan"` } // DowngradeSmartAccessGatewayResponse is the response struct for api DowngradeSmartAccessGateway diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/downgrade_smart_access_gateway_software.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/downgrade_smart_access_gateway_software.go index 1da5ba3e443..5b83465b528 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/downgrade_smart_access_gateway_software.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/downgrade_smart_access_gateway_software.go @@ -71,14 +71,14 @@ func (client *Client) DowngradeSmartAccessGatewaySoftwareWithCallback(request *D // DowngradeSmartAccessGatewaySoftwareRequest is the request struct for api DowngradeSmartAccessGatewaySoftware type DowngradeSmartAccessGatewaySoftwareRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - UserCount requests.Integer `position:"Query"` - AutoPay requests.Boolean `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - DataPlan requests.Integer `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + UserCount requests.Integer `position:"Query" name:"UserCount"` + AutoPay requests.Boolean `position:"Query" name:"AutoPay"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + DataPlan requests.Integer `position:"Query" name:"DataPlan"` } // DowngradeSmartAccessGatewaySoftwareResponse is the response struct for api DowngradeSmartAccessGatewaySoftware diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/enable_smart_access_gateway_user.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/enable_smart_access_gateway_user.go index 3becd1ca28e..47ec398da25 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/enable_smart_access_gateway_user.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/enable_smart_access_gateway_user.go @@ -71,12 +71,12 @@ func (client *Client) EnableSmartAccessGatewayUserWithCallback(request *EnableSm // EnableSmartAccessGatewayUserRequest is the request struct for api EnableSmartAccessGatewayUser type EnableSmartAccessGatewayUserRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - UserName string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + UserName string `position:"Query" name:"UserName"` } // EnableSmartAccessGatewayUserResponse is the response struct for api EnableSmartAccessGatewayUser diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/enable_smart_ag_dpi_monitor.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/enable_smart_ag_dpi_monitor.go index 352735a1861..5c2f448dc4c 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/enable_smart_ag_dpi_monitor.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/enable_smart_ag_dpi_monitor.go @@ -71,15 +71,15 @@ func (client *Client) EnableSmartAGDpiMonitorWithCallback(request *EnableSmartAG // EnableSmartAGDpiMonitorRequest is the request struct for api EnableSmartAGDpiMonitor type EnableSmartAGDpiMonitorRequest struct { *requests.RpcRequest - SlsLogStore string `position:"Query"` - ResourceOwnerId requests.Integer `position:"Query"` - ClientToken string `position:"Query"` - SlsProjectName string `position:"Query"` - DryRun requests.Boolean `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + SlsLogStore string `position:"Query" name:"SlsLogStore"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ClientToken string `position:"Query" name:"ClientToken"` + SlsProjectName string `position:"Query" name:"SlsProjectName"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // EnableSmartAGDpiMonitorResponse is the response struct for api EnableSmartAGDpiMonitor diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/get_acl_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/get_acl_attribute.go index ad47513936e..807c77be793 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/get_acl_attribute.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/get_acl_attribute.go @@ -71,7 +71,7 @@ func (client *Client) GetAclAttributeWithCallback(request *GetAclAttributeReques // GetAclAttributeRequest is the request struct for api GetAclAttribute type GetAclAttributeRequest struct { *requests.RpcRequest - AclId string `position:"Query"` + AclId string `position:"Query" name:"AclId"` } // GetAclAttributeResponse is the response struct for api GetAclAttribute diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/get_cloud_connect_network_use_limit.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/get_cloud_connect_network_use_limit.go index 5d1f1551cf4..ab78f0a6f69 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/get_cloud_connect_network_use_limit.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/get_cloud_connect_network_use_limit.go @@ -71,10 +71,10 @@ func (client *Client) GetCloudConnectNetworkUseLimitWithCallback(request *GetClo // GetCloudConnectNetworkUseLimitRequest is the request struct for api GetCloudConnectNetworkUseLimit type GetCloudConnectNetworkUseLimitRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` } // GetCloudConnectNetworkUseLimitResponse is the response struct for api GetCloudConnectNetworkUseLimit diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/get_qos_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/get_qos_attribute.go index 8a7be4d8096..224d8d2334e 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/get_qos_attribute.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/get_qos_attribute.go @@ -71,7 +71,7 @@ func (client *Client) GetQosAttributeWithCallback(request *GetQosAttributeReques // GetQosAttributeRequest is the request struct for api GetQosAttribute type GetQosAttributeRequest struct { *requests.RpcRequest - QosId string `position:"Query"` + QosId string `position:"Query" name:"QosId"` } // GetQosAttributeResponse is the response struct for api GetQosAttribute diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/get_smart_access_gateway_use_limit.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/get_smart_access_gateway_use_limit.go index bde2c4f9e15..e39b78a09c0 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/get_smart_access_gateway_use_limit.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/get_smart_access_gateway_use_limit.go @@ -71,10 +71,10 @@ func (client *Client) GetSmartAccessGatewayUseLimitWithCallback(request *GetSmar // GetSmartAccessGatewayUseLimitRequest is the request struct for api GetSmartAccessGatewayUseLimit type GetSmartAccessGatewayUseLimitRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` } // GetSmartAccessGatewayUseLimitResponse is the response struct for api GetSmartAccessGatewayUseLimit diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/get_smart_ag_dpi_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/get_smart_ag_dpi_attribute.go index 727585d6970..3f7173844b1 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/get_smart_ag_dpi_attribute.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/get_smart_ag_dpi_attribute.go @@ -71,11 +71,11 @@ func (client *Client) GetSmartAGDpiAttributeWithCallback(request *GetSmartAGDpiA // GetSmartAGDpiAttributeRequest is the request struct for api GetSmartAGDpiAttribute type GetSmartAGDpiAttributeRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // GetSmartAGDpiAttributeResponse is the response struct for api GetSmartAGDpiAttribute diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/grant_instance_to_cbn.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/grant_instance_to_cbn.go index bd9faeceb08..15c61593986 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/grant_instance_to_cbn.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/grant_instance_to_cbn.go @@ -71,14 +71,14 @@ func (client *Client) GrantInstanceToCbnWithCallback(request *GrantInstanceToCbn // GrantInstanceToCbnRequest is the request struct for api GrantInstanceToCbn type GrantInstanceToCbnRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - CcnInstanceId string `position:"Query"` - GrantTrafficService requests.Boolean `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - CenUid requests.Integer `position:"Query"` - CenInstanceId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + CcnInstanceId string `position:"Query" name:"CcnInstanceId"` + GrantTrafficService requests.Boolean `position:"Query" name:"GrantTrafficService"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + CenUid requests.Integer `position:"Query" name:"CenUid"` + CenInstanceId string `position:"Query" name:"CenInstanceId"` } // GrantInstanceToCbnResponse is the response struct for api GrantInstanceToCbn diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/grant_sag_instance_to_ccn.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/grant_sag_instance_to_ccn.go index 6c6271da0d8..addf4e6afb9 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/grant_sag_instance_to_ccn.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/grant_sag_instance_to_ccn.go @@ -71,14 +71,14 @@ func (client *Client) GrantSagInstanceToCcnWithCallback(request *GrantSagInstanc // GrantSagInstanceToCcnRequest is the request struct for api GrantSagInstanceToCcn type GrantSagInstanceToCcnRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - CcnUid requests.Integer `position:"Query"` - CcnInstanceId string `position:"Query"` - GrantTrafficService requests.Boolean `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + CcnUid requests.Integer `position:"Query" name:"CcnUid"` + CcnInstanceId string `position:"Query" name:"CcnInstanceId"` + GrantTrafficService requests.Boolean `position:"Query" name:"GrantTrafficService"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // GrantSagInstanceToCcnResponse is the response struct for api GrantSagInstanceToCcn diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/grant_sag_instance_to_vbr.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/grant_sag_instance_to_vbr.go index 6cfe8cc4933..fc312466315 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/grant_sag_instance_to_vbr.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/grant_sag_instance_to_vbr.go @@ -71,14 +71,14 @@ func (client *Client) GrantSagInstanceToVbrWithCallback(request *GrantSagInstanc // GrantSagInstanceToVbrRequest is the request struct for api GrantSagInstanceToVbr type GrantSagInstanceToVbrRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - VbrRegionId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - VbrInstanceId string `position:"Query"` - SmartAGId string `position:"Query"` - VbrUid requests.Integer `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + VbrRegionId string `position:"Query" name:"VbrRegionId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + VbrInstanceId string `position:"Query" name:"VbrInstanceId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + VbrUid requests.Integer `position:"Query" name:"VbrUid"` } // GrantSagInstanceToVbrResponse is the response struct for api GrantSagInstanceToVbr diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/kick_out_clients.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/kick_out_clients.go index 0ba80fc4095..5ff9e65fb3f 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/kick_out_clients.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/kick_out_clients.go @@ -71,12 +71,12 @@ func (client *Client) KickOutClientsWithCallback(request *KickOutClientsRequest, // KickOutClientsRequest is the request struct for api KickOutClients type KickOutClientsRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - Username string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + Username string `position:"Query" name:"Username"` } // KickOutClientsResponse is the response struct for api KickOutClients diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/list_access_point_network_qualities.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/list_access_point_network_qualities.go index 3730e0c89c8..f6356d3f6d9 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/list_access_point_network_qualities.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/list_access_point_network_qualities.go @@ -71,11 +71,11 @@ func (client *Client) ListAccessPointNetworkQualitiesWithCallback(request *ListA // ListAccessPointNetworkQualitiesRequest is the request struct for api ListAccessPointNetworkQualities type ListAccessPointNetworkQualitiesRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // ListAccessPointNetworkQualitiesResponse is the response struct for api ListAccessPointNetworkQualities diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/list_access_points.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/list_access_points.go index 22ee5a1cd9c..345b1be133b 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/list_access_points.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/list_access_points.go @@ -71,13 +71,13 @@ func (client *Client) ListAccessPointsWithCallback(request *ListAccessPointsRequ // ListAccessPointsRequest is the request struct for api ListAccessPoints type ListAccessPointsRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - PageNumber requests.Integer `position:"Query"` - PageSize requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // ListAccessPointsResponse is the response struct for api ListAccessPoints diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/list_dpi_config_error.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/list_dpi_config_error.go index 102fc544c87..2a1a5b5e9a2 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/list_dpi_config_error.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/list_dpi_config_error.go @@ -71,20 +71,20 @@ func (client *Client) ListDpiConfigErrorWithCallback(request *ListDpiConfigError // ListDpiConfigErrorRequest is the request struct for api ListDpiConfigError type ListDpiConfigErrorRequest struct { *requests.RpcRequest - DpiConfigType string `position:"Query"` - NextToken string `position:"Query"` - SmartAGId string `position:"Query"` - RuleInstanceId string `position:"Query"` - MaxResults requests.Integer `position:"Query"` + DpiConfigType string `position:"Query" name:"DpiConfigType"` + NextToken string `position:"Query" name:"NextToken"` + SmartAGId string `position:"Query" name:"SmartAGId"` + RuleInstanceId string `position:"Query" name:"RuleInstanceId"` + MaxResults requests.Integer `position:"Query" name:"MaxResults"` } // ListDpiConfigErrorResponse is the response struct for api ListDpiConfigError type ListDpiConfigErrorResponse struct { *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` NextToken string `json:"NextToken" xml:"NextToken"` - MaxResults int `json:"MaxResults" xml:"MaxResults"` + RequestId string `json:"RequestId" xml:"RequestId"` Total int `json:"Total" xml:"Total"` + MaxResults int `json:"MaxResults" xml:"MaxResults"` DpiConfigError []DpiConfigErrorItem `json:"DpiConfigError" xml:"DpiConfigError"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/list_dpi_groups.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/list_dpi_groups.go index 6401c8633f4..6ce480327e4 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/list_dpi_groups.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/list_dpi_groups.go @@ -72,21 +72,21 @@ func (client *Client) ListDpiGroupsWithCallback(request *ListDpiGroupsRequest, c type ListDpiGroupsRequest struct { *requests.RpcRequest DpiGroupIds *[]string `position:"Query" name:"DpiGroupIds" type:"Repeated"` - ResourceOwnerId requests.Integer `position:"Query"` - NextToken string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + NextToken string `position:"Query" name:"NextToken"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` DpiGroupNames *[]string `position:"Query" name:"DpiGroupNames" type:"Repeated"` - MaxResults requests.Integer `position:"Query"` + MaxResults requests.Integer `position:"Query" name:"MaxResults"` } // ListDpiGroupsResponse is the response struct for api ListDpiGroups type ListDpiGroupsResponse struct { *responses.BaseResponse TotalCount int `json:"TotalCount" xml:"TotalCount"` - RequestId string `json:"RequestId" xml:"RequestId"` NextToken string `json:"NextToken" xml:"NextToken"` + RequestId string `json:"RequestId" xml:"RequestId"` DpiGroup []DpiGroupItem `json:"DpiGroup" xml:"DpiGroup"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/list_dpi_signatures.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/list_dpi_signatures.go index cdea267e5fe..ac419e73689 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/list_dpi_signatures.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/list_dpi_signatures.go @@ -71,23 +71,23 @@ func (client *Client) ListDpiSignaturesWithCallback(request *ListDpiSignaturesRe // ListDpiSignaturesRequest is the request struct for api ListDpiSignatures type ListDpiSignaturesRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` DpiSignatureNames *[]string `position:"Query" name:"DpiSignatureNames" type:"Repeated"` DpiSignatureIds *[]string `position:"Query" name:"DpiSignatureIds" type:"Repeated"` - NextToken string `position:"Query"` - DpiGroupId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - MaxResults requests.Integer `position:"Query"` + NextToken string `position:"Query" name:"NextToken"` + DpiGroupId string `position:"Query" name:"DpiGroupId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + MaxResults requests.Integer `position:"Query" name:"MaxResults"` } // ListDpiSignaturesResponse is the response struct for api ListDpiSignatures type ListDpiSignaturesResponse struct { *responses.BaseResponse TotalCount int `json:"TotalCount" xml:"TotalCount"` - RequestId string `json:"RequestId" xml:"RequestId"` NextToken string `json:"NextToken" xml:"NextToken"` + RequestId string `json:"RequestId" xml:"RequestId"` DpiSignature []DpiSignatureItem `json:"DpiSignature" xml:"DpiSignature"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/list_enterprise_code.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/list_enterprise_code.go index bb67420e799..b5fc72aabde 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/list_enterprise_code.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/list_enterprise_code.go @@ -71,18 +71,18 @@ func (client *Client) ListEnterpriseCodeWithCallback(request *ListEnterpriseCode // ListEnterpriseCodeRequest is the request struct for api ListEnterpriseCode type ListEnterpriseCodeRequest struct { *requests.RpcRequest - EnterpriseCode string `position:"Query"` - NextToken string `position:"Query"` - IsDefault requests.Boolean `position:"Query"` - MaxResults requests.Integer `position:"Query"` + EnterpriseCode string `position:"Query" name:"EnterpriseCode"` + NextToken string `position:"Query" name:"NextToken"` + IsDefault requests.Boolean `position:"Query" name:"IsDefault"` + MaxResults requests.Integer `position:"Query" name:"MaxResults"` } // ListEnterpriseCodeResponse is the response struct for api ListEnterpriseCode type ListEnterpriseCodeResponse struct { *responses.BaseResponse TotalCount int `json:"TotalCount" xml:"TotalCount"` - RequestId string `json:"RequestId" xml:"RequestId"` NextToken string `json:"NextToken" xml:"NextToken"` + RequestId string `json:"RequestId" xml:"RequestId"` MaxResults int `json:"MaxResults" xml:"MaxResults"` EnterpriseCodes []EnterpriseCode `json:"EnterpriseCodes" xml:"EnterpriseCodes"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/list_smart_ag_api_unsupported_feature.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/list_smart_ag_api_unsupported_feature.go index b99006c81eb..cc59270d3fc 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/list_smart_ag_api_unsupported_feature.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/list_smart_ag_api_unsupported_feature.go @@ -71,13 +71,13 @@ func (client *Client) ListSmartAGApiUnsupportedFeatureWithCallback(request *List // ListSmartAGApiUnsupportedFeatureRequest is the request struct for api ListSmartAGApiUnsupportedFeature type ListSmartAGApiUnsupportedFeatureRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - SerialNumber string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - OpenApiName string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + SerialNumber string `position:"Query" name:"SerialNumber"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + OpenApiName string `position:"Query" name:"OpenApiName"` } // ListSmartAGApiUnsupportedFeatureResponse is the response struct for api ListSmartAGApiUnsupportedFeature diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/list_smart_ag_by_access_point.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/list_smart_ag_by_access_point.go index 05bc25e823b..f8750fc8177 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/list_smart_ag_by_access_point.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/list_smart_ag_by_access_point.go @@ -71,14 +71,14 @@ func (client *Client) ListSmartAGByAccessPointWithCallback(request *ListSmartAGB // ListSmartAGByAccessPointRequest is the request struct for api ListSmartAGByAccessPoint type ListSmartAGByAccessPointRequest struct { *requests.RpcRequest - AccessPointId requests.Integer `position:"Query"` - ResourceOwnerId requests.Integer `position:"Query"` - PageNumber requests.Integer `position:"Query"` - PageSize requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGStatus string `position:"Query"` + AccessPointId requests.Integer `position:"Query" name:"AccessPointId"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGStatus string `position:"Query" name:"SmartAGStatus"` } // ListSmartAGByAccessPointResponse is the response struct for api ListSmartAGByAccessPoint diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_acl.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_acl.go index 025c36e4887..e9e40381e6b 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_acl.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_acl.go @@ -71,12 +71,12 @@ func (client *Client) ModifyACLWithCallback(request *ModifyACLRequest, callback // ModifyACLRequest is the request struct for api ModifyACL type ModifyACLRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - AclId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - Name string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + AclId string `position:"Query" name:"AclId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + Name string `position:"Query" name:"Name"` } // ModifyACLResponse is the response struct for api ModifyACL diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_acl_rule.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_acl_rule.go index f4dd13b7baf..49a790b923c 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_acl_rule.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_acl_rule.go @@ -72,24 +72,24 @@ func (client *Client) ModifyACLRuleWithCallback(request *ModifyACLRuleRequest, c type ModifyACLRuleRequest struct { *requests.RpcRequest DpiGroupIds *[]string `position:"Query" name:"DpiGroupIds" type:"Repeated"` - ResourceOwnerId requests.Integer `position:"Query"` - SourcePortRange string `position:"Query"` - SourceCidr string `position:"Query"` - Description string `position:"Query"` - Type string `position:"Query"` - DestCidr string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + SourcePortRange string `position:"Query" name:"SourcePortRange"` + SourceCidr string `position:"Query" name:"SourceCidr"` + Description string `position:"Query" name:"Description"` + Type string `position:"Query" name:"Type"` + DestCidr string `position:"Query" name:"DestCidr"` DpiSignatureIds *[]string `position:"Query" name:"DpiSignatureIds" type:"Repeated"` - Direction string `position:"Query"` - Policy string `position:"Query"` - AclId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - IpProtocol string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - Priority requests.Integer `position:"Query"` - AcrId string `position:"Query"` - DestPortRange string `position:"Query"` - Name string `position:"Query"` + Direction string `position:"Query" name:"Direction"` + Policy string `position:"Query" name:"Policy"` + AclId string `position:"Query" name:"AclId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + IpProtocol string `position:"Query" name:"IpProtocol"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + Priority requests.Integer `position:"Query" name:"Priority"` + AcrId string `position:"Query" name:"AcrId"` + DestPortRange string `position:"Query" name:"DestPortRange"` + Name string `position:"Query" name:"Name"` } // ModifyACLRuleResponse is the response struct for api ModifyACLRule @@ -97,8 +97,8 @@ type ModifyACLRuleResponse struct { *responses.BaseResponse Policy string `json:"Policy" xml:"Policy"` Description string `json:"Description" xml:"Description"` - SourcePortRange string `json:"SourcePortRange" xml:"SourcePortRange"` RequestId string `json:"RequestId" xml:"RequestId"` + SourcePortRange string `json:"SourcePortRange" xml:"SourcePortRange"` SourceCidr string `json:"SourceCidr" xml:"SourceCidr"` Priority int `json:"Priority" xml:"Priority"` AclId string `json:"AclId" xml:"AclId"` @@ -109,8 +109,8 @@ type ModifyACLRuleResponse struct { GmtCreate int64 `json:"GmtCreate" xml:"GmtCreate"` DestCidr string `json:"DestCidr" xml:"DestCidr"` IpProtocol string `json:"IpProtocol" xml:"IpProtocol"` - DpiSignatureIds DpiSignatureIdsInModifyACLRule `json:"DpiSignatureIds" xml:"DpiSignatureIds"` DpiGroupIds DpiGroupIdsInModifyACLRule `json:"DpiGroupIds" xml:"DpiGroupIds"` + DpiSignatureIds DpiSignatureIdsInModifyACLRule `json:"DpiSignatureIds" xml:"DpiSignatureIds"` } // CreateModifyACLRuleRequest creates a request to invoke ModifyACLRule API diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_client_user_dns.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_client_user_dns.go index 293be8092fc..b2833c54ed7 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_client_user_dns.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_client_user_dns.go @@ -71,13 +71,13 @@ func (client *Client) ModifyClientUserDNSWithCallback(request *ModifyClientUserD // ModifyClientUserDNSRequest is the request struct for api ModifyClientUserDNS type ModifyClientUserDNSRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` RecoveredDNS *[]string `position:"Query" name:"RecoveredDNS" type:"Repeated"` AppDNS *[]string `position:"Query" name:"AppDNS" type:"Repeated"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // ModifyClientUserDNSResponse is the response struct for api ModifyClientUserDNS diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_cloud_connect_network.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_cloud_connect_network.go index c0a5ec155d0..1e470fa9f3c 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_cloud_connect_network.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_cloud_connect_network.go @@ -71,15 +71,15 @@ func (client *Client) ModifyCloudConnectNetworkWithCallback(request *ModifyCloud // ModifyCloudConnectNetworkRequest is the request struct for api ModifyCloudConnectNetwork type ModifyCloudConnectNetworkRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - CcnId string `position:"Query"` - Description string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - Name string `position:"Query"` - CidrBlock string `position:"Query"` - InterworkingStatus string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + CcnId string `position:"Query" name:"CcnId"` + Description string `position:"Query" name:"Description"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + Name string `position:"Query" name:"Name"` + CidrBlock string `position:"Query" name:"CidrBlock"` + InterworkingStatus string `position:"Query" name:"InterworkingStatus"` } // ModifyCloudConnectNetworkResponse is the response struct for api ModifyCloudConnectNetwork diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_device_auto_upgrade_policy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_device_auto_upgrade_policy.go index 2a66d0f3dda..1f05036c597 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_device_auto_upgrade_policy.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_device_auto_upgrade_policy.go @@ -71,17 +71,17 @@ func (client *Client) ModifyDeviceAutoUpgradePolicyWithCallback(request *ModifyD // ModifyDeviceAutoUpgradePolicyRequest is the request struct for api ModifyDeviceAutoUpgradePolicy type ModifyDeviceAutoUpgradePolicyRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - CronExpression string `position:"Query"` - TimeZone string `position:"Query"` - UpgradeType string `position:"Query"` - Duration requests.Integer `position:"Query"` - SerialNumber string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - VersionType string `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + CronExpression string `position:"Query" name:"CronExpression"` + TimeZone string `position:"Query" name:"TimeZone"` + UpgradeType string `position:"Query" name:"UpgradeType"` + Duration requests.Integer `position:"Query" name:"Duration"` + SerialNumber string `position:"Query" name:"SerialNumber"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + VersionType string `position:"Query" name:"VersionType"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // ModifyDeviceAutoUpgradePolicyResponse is the response struct for api ModifyDeviceAutoUpgradePolicy diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_flow_log_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_flow_log_attribute.go index 56cbbeb4eb4..f66db7f72b2 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_flow_log_attribute.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_flow_log_attribute.go @@ -71,22 +71,22 @@ func (client *Client) ModifyFlowLogAttributeWithCallback(request *ModifyFlowLogA // ModifyFlowLogAttributeRequest is the request struct for api ModifyFlowLogAttribute type ModifyFlowLogAttributeRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - NetflowVersion string `position:"Query"` - Description string `position:"Query"` - InactiveAging requests.Integer `position:"Query"` - SlsRegionId string `position:"Query"` - ActiveAging requests.Integer `position:"Query"` - OutputType string `position:"Query"` - ProjectName string `position:"Query"` - LogstoreName string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - NetflowServerPort requests.Integer `position:"Query"` - OwnerId requests.Integer `position:"Query"` - NetflowServerIp string `position:"Query"` - Name string `position:"Query"` - FlowLogId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + NetflowVersion string `position:"Query" name:"NetflowVersion"` + Description string `position:"Query" name:"Description"` + InactiveAging requests.Integer `position:"Query" name:"InactiveAging"` + SlsRegionId string `position:"Query" name:"SlsRegionId"` + ActiveAging requests.Integer `position:"Query" name:"ActiveAging"` + OutputType string `position:"Query" name:"OutputType"` + ProjectName string `position:"Query" name:"ProjectName"` + LogstoreName string `position:"Query" name:"LogstoreName"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + NetflowServerPort requests.Integer `position:"Query" name:"NetflowServerPort"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + NetflowServerIp string `position:"Query" name:"NetflowServerIp"` + Name string `position:"Query" name:"Name"` + FlowLogId string `position:"Query" name:"FlowLogId"` } // ModifyFlowLogAttributeResponse is the response struct for api ModifyFlowLogAttribute diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_health_check.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_health_check.go index 034ebf3b996..162c255e5f0 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_health_check.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_health_check.go @@ -71,25 +71,25 @@ func (client *Client) ModifyHealthCheckWithCallback(request *ModifyHealthCheckRe // ModifyHealthCheckRequest is the request struct for api ModifyHealthCheck type ModifyHealthCheckRequest struct { *requests.RpcRequest - ProbeInterval requests.Integer `position:"Query"` - ResourceOwnerId requests.Integer `position:"Query"` - DstPort requests.Integer `position:"Query"` - Description string `position:"Query"` - HcInstanceId string `position:"Query"` - Type string `position:"Query"` - FailCountThreshold requests.Integer `position:"Query"` - ProbeTimeout requests.Integer `position:"Query"` - RttFailThreshold requests.Integer `position:"Query"` - RttThreshold requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - DstIpAddr string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SrcIpAddr string `position:"Query"` - Name string `position:"Query"` - SmartAGId string `position:"Query"` - SrcPort requests.Integer `position:"Query"` - ProbeCount requests.Integer `position:"Query"` + ProbeInterval requests.Integer `position:"Query" name:"ProbeInterval"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + DstPort requests.Integer `position:"Query" name:"DstPort"` + Description string `position:"Query" name:"Description"` + HcInstanceId string `position:"Query" name:"HcInstanceId"` + Type string `position:"Query" name:"Type"` + FailCountThreshold requests.Integer `position:"Query" name:"FailCountThreshold"` + ProbeTimeout requests.Integer `position:"Query" name:"ProbeTimeout"` + RttFailThreshold requests.Integer `position:"Query" name:"RttFailThreshold"` + RttThreshold requests.Integer `position:"Query" name:"RttThreshold"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + DstIpAddr string `position:"Query" name:"DstIpAddr"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SrcIpAddr string `position:"Query" name:"SrcIpAddr"` + Name string `position:"Query" name:"Name"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SrcPort requests.Integer `position:"Query" name:"SrcPort"` + ProbeCount requests.Integer `position:"Query" name:"ProbeCount"` } // ModifyHealthCheckResponse is the response struct for api ModifyHealthCheck diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_network_optimization.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_network_optimization.go deleted file mode 100644 index 8fd3a838979..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_network_optimization.go +++ /dev/null @@ -1,104 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifyNetworkOptimization invokes the smartag.ModifyNetworkOptimization API synchronously -func (client *Client) ModifyNetworkOptimization(request *ModifyNetworkOptimizationRequest) (response *ModifyNetworkOptimizationResponse, err error) { - response = CreateModifyNetworkOptimizationResponse() - err = client.DoAction(request, response) - return -} - -// ModifyNetworkOptimizationWithChan invokes the smartag.ModifyNetworkOptimization API asynchronously -func (client *Client) ModifyNetworkOptimizationWithChan(request *ModifyNetworkOptimizationRequest) (<-chan *ModifyNetworkOptimizationResponse, <-chan error) { - responseChan := make(chan *ModifyNetworkOptimizationResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifyNetworkOptimization(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifyNetworkOptimizationWithCallback invokes the smartag.ModifyNetworkOptimization API asynchronously -func (client *Client) ModifyNetworkOptimizationWithCallback(request *ModifyNetworkOptimizationRequest, callback func(response *ModifyNetworkOptimizationResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifyNetworkOptimizationResponse - var err error - defer close(result) - response, err = client.ModifyNetworkOptimization(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifyNetworkOptimizationRequest is the request struct for api ModifyNetworkOptimization -type ModifyNetworkOptimizationRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - NetworkOptId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - Name string `position:"Query"` -} - -// ModifyNetworkOptimizationResponse is the response struct for api ModifyNetworkOptimization -type ModifyNetworkOptimizationResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateModifyNetworkOptimizationRequest creates a request to invoke ModifyNetworkOptimization API -func CreateModifyNetworkOptimizationRequest() (request *ModifyNetworkOptimizationRequest) { - request = &ModifyNetworkOptimizationRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Smartag", "2018-03-13", "ModifyNetworkOptimization", "smartag", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifyNetworkOptimizationResponse creates a response to parse from ModifyNetworkOptimization response -func CreateModifyNetworkOptimizationResponse() (response *ModifyNetworkOptimizationResponse) { - response = &ModifyNetworkOptimizationResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_qos.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_qos.go index c4b64f0c18d..4867e2d6d82 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_qos.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_qos.go @@ -71,13 +71,13 @@ func (client *Client) ModifyQosWithCallback(request *ModifyQosRequest, callback // ModifyQosRequest is the request struct for api ModifyQos type ModifyQosRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - QosId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - QosName string `position:"Query"` - QosDescription string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + QosId string `position:"Query" name:"QosId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + QosName string `position:"Query" name:"QosName"` + QosDescription string `position:"Query" name:"QosDescription"` } // ModifyQosResponse is the response struct for api ModifyQos diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_qos_car.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_qos_car.go index ebd5b609803..0a64d3f81cc 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_qos_car.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_qos_car.go @@ -71,21 +71,21 @@ func (client *Client) ModifyQosCarWithCallback(request *ModifyQosCarRequest, cal // ModifyQosCarRequest is the request struct for api ModifyQosCar type ModifyQosCarRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - MinBandwidthAbs requests.Integer `position:"Query"` - Description string `position:"Query"` - PercentSourceType string `position:"Query"` - QosId string `position:"Query"` - MaxBandwidthAbs requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - MaxBandwidthPercent requests.Integer `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - QosCarId string `position:"Query"` - Priority requests.Integer `position:"Query"` - MinBandwidthPercent requests.Integer `position:"Query"` - LimitType string `position:"Query"` - Name string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + MinBandwidthAbs requests.Integer `position:"Query" name:"MinBandwidthAbs"` + Description string `position:"Query" name:"Description"` + PercentSourceType string `position:"Query" name:"PercentSourceType"` + QosId string `position:"Query" name:"QosId"` + MaxBandwidthAbs requests.Integer `position:"Query" name:"MaxBandwidthAbs"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + MaxBandwidthPercent requests.Integer `position:"Query" name:"MaxBandwidthPercent"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + QosCarId string `position:"Query" name:"QosCarId"` + Priority requests.Integer `position:"Query" name:"Priority"` + MinBandwidthPercent requests.Integer `position:"Query" name:"MinBandwidthPercent"` + LimitType string `position:"Query" name:"LimitType"` + Name string `position:"Query" name:"Name"` } // ModifyQosCarResponse is the response struct for api ModifyQosCar diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_qos_policy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_qos_policy.go index 0006b2a3b8a..c7e4facc69b 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_qos_policy.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_qos_policy.go @@ -72,23 +72,23 @@ func (client *Client) ModifyQosPolicyWithCallback(request *ModifyQosPolicyReques type ModifyQosPolicyRequest struct { *requests.RpcRequest DpiGroupIds *[]string `position:"Query" name:"DpiGroupIds" type:"Repeated"` - ResourceOwnerId requests.Integer `position:"Query"` - SourcePortRange string `position:"Query"` - QosPolicyId string `position:"Query"` - SourceCidr string `position:"Query"` - Description string `position:"Query"` - StartTime string `position:"Query"` - DestCidr string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + SourcePortRange string `position:"Query" name:"SourcePortRange"` + QosPolicyId string `position:"Query" name:"QosPolicyId"` + SourceCidr string `position:"Query" name:"SourceCidr"` + Description string `position:"Query" name:"Description"` + StartTime string `position:"Query" name:"StartTime"` + DestCidr string `position:"Query" name:"DestCidr"` DpiSignatureIds *[]string `position:"Query" name:"DpiSignatureIds" type:"Repeated"` - QosId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - IpProtocol string `position:"Query"` - OwnerAccount string `position:"Query"` - EndTime string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - Priority requests.Integer `position:"Query"` - DestPortRange string `position:"Query"` - Name string `position:"Query"` + QosId string `position:"Query" name:"QosId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + IpProtocol string `position:"Query" name:"IpProtocol"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + EndTime string `position:"Query" name:"EndTime"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + Priority requests.Integer `position:"Query" name:"Priority"` + DestPortRange string `position:"Query" name:"DestPortRange"` + Name string `position:"Query" name:"Name"` } // ModifyQosPolicyResponse is the response struct for api ModifyQosPolicy diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_route_distribution_strategy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_route_distribution_strategy.go index 643996f22f9..b7c5e68f90a 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_route_distribution_strategy.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_route_distribution_strategy.go @@ -71,16 +71,16 @@ func (client *Client) ModifyRouteDistributionStrategyWithCallback(request *Modif // ModifyRouteDistributionStrategyRequest is the request struct for api ModifyRouteDistributionStrategy type ModifyRouteDistributionStrategyRequest struct { *requests.RpcRequest - RouteSource string `position:"Query"` - ResourceOwnerId requests.Integer `position:"Query"` - HcInstanceId string `position:"Query"` - SourceType string `position:"Query"` - DestCidrBlock string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - RouteDistribution string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + RouteSource string `position:"Query" name:"RouteSource"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + HcInstanceId string `position:"Query" name:"HcInstanceId"` + SourceType string `position:"Query" name:"SourceType"` + DestCidrBlock string `position:"Query" name:"DestCidrBlock"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + RouteDistribution string `position:"Query" name:"RouteDistribution"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // ModifyRouteDistributionStrategyResponse is the response struct for api ModifyRouteDistributionStrategy diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_admin_password.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_admin_password.go index 5cc23792980..a0cf512ec53 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_admin_password.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_admin_password.go @@ -71,13 +71,13 @@ func (client *Client) ModifySAGAdminPasswordWithCallback(request *ModifySAGAdmin // ModifySAGAdminPasswordRequest is the request struct for api ModifySAGAdminPassword type ModifySAGAdminPasswordRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - Password string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + Password string `position:"Query" name:"Password"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` } // ModifySAGAdminPasswordResponse is the response struct for api ModifySAGAdminPassword diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_cidr.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_cidr.go deleted file mode 100644 index 754ae3f3d41..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_cidr.go +++ /dev/null @@ -1,105 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifySagCidr invokes the smartag.ModifySagCidr API synchronously -func (client *Client) ModifySagCidr(request *ModifySagCidrRequest) (response *ModifySagCidrResponse, err error) { - response = CreateModifySagCidrResponse() - err = client.DoAction(request, response) - return -} - -// ModifySagCidrWithChan invokes the smartag.ModifySagCidr API asynchronously -func (client *Client) ModifySagCidrWithChan(request *ModifySagCidrRequest) (<-chan *ModifySagCidrResponse, <-chan error) { - responseChan := make(chan *ModifySagCidrResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifySagCidr(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifySagCidrWithCallback invokes the smartag.ModifySagCidr API asynchronously -func (client *Client) ModifySagCidrWithCallback(request *ModifySagCidrRequest, callback func(response *ModifySagCidrResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifySagCidrResponse - var err error - defer close(result) - response, err = client.ModifySagCidr(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifySagCidrRequest is the request struct for api ModifySagCidr -type ModifySagCidrRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - Cidr string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - EnableBackup requests.Boolean `position:"Query"` - SmartAGId string `position:"Query"` -} - -// ModifySagCidrResponse is the response struct for api ModifySagCidr -type ModifySagCidrResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateModifySagCidrRequest creates a request to invoke ModifySagCidr API -func CreateModifySagCidrRequest() (request *ModifySagCidrRequest) { - request = &ModifySagCidrRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Smartag", "2018-03-13", "ModifySagCidr", "smartag", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifySagCidrResponse creates a response to parse from ModifySagCidr response -func CreateModifySagCidrResponse() (response *ModifySagCidrResponse) { - response = &ModifySagCidrResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_ec_route_backup.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_ec_route_backup.go deleted file mode 100644 index 2ec88f20963..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_ec_route_backup.go +++ /dev/null @@ -1,107 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ModifySagECRouteBackup invokes the smartag.ModifySagECRouteBackup API synchronously -func (client *Client) ModifySagECRouteBackup(request *ModifySagECRouteBackupRequest) (response *ModifySagECRouteBackupResponse, err error) { - response = CreateModifySagECRouteBackupResponse() - err = client.DoAction(request, response) - return -} - -// ModifySagECRouteBackupWithChan invokes the smartag.ModifySagECRouteBackup API asynchronously -func (client *Client) ModifySagECRouteBackupWithChan(request *ModifySagECRouteBackupRequest) (<-chan *ModifySagECRouteBackupResponse, <-chan error) { - responseChan := make(chan *ModifySagECRouteBackupResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ModifySagECRouteBackup(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ModifySagECRouteBackupWithCallback invokes the smartag.ModifySagECRouteBackup API asynchronously -func (client *Client) ModifySagECRouteBackupWithCallback(request *ModifySagECRouteBackupRequest, callback func(response *ModifySagECRouteBackupResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ModifySagECRouteBackupResponse - var err error - defer close(result) - response, err = client.ModifySagECRouteBackup(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ModifySagECRouteBackupRequest is the request struct for api ModifySagECRouteBackup -type ModifySagECRouteBackupRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ExpressConnectionInterface string `position:"Query"` - HcIp string `position:"Query"` - RouteBackup requests.Boolean `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - ExpressConnectionNexthop string `position:"Query"` -} - -// ModifySagECRouteBackupResponse is the response struct for api ModifySagECRouteBackup -type ModifySagECRouteBackupResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateModifySagECRouteBackupRequest creates a request to invoke ModifySagECRouteBackup API -func CreateModifySagECRouteBackupRequest() (request *ModifySagECRouteBackupRequest) { - request = &ModifySagECRouteBackupRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Smartag", "2018-03-13", "ModifySagECRouteBackup", "smartag", "openAPI") - request.Method = requests.POST - return -} - -// CreateModifySagECRouteBackupResponse creates a response to parse from ModifySagECRouteBackup response -func CreateModifySagECRouteBackupResponse() (response *ModifySagECRouteBackupResponse) { - response = &ModifySagECRouteBackupResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_express_connect_interface.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_express_connect_interface.go index efeba1caf57..adbde40546a 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_express_connect_interface.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_express_connect_interface.go @@ -71,16 +71,16 @@ func (client *Client) ModifySagExpressConnectInterfaceWithCallback(request *Modi // ModifySagExpressConnectInterfaceRequest is the request struct for api ModifySagExpressConnectInterface type ModifySagExpressConnectInterfaceRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - Vlan string `position:"Query"` - Mask string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - IP string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` - PortName string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + Vlan string `position:"Query" name:"Vlan"` + Mask string `position:"Query" name:"Mask"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + IP string `position:"Query" name:"IP"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` + PortName string `position:"Query" name:"PortName"` } // ModifySagExpressConnectInterfaceResponse is the response struct for api ModifySagExpressConnectInterface diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_global_route_protocol.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_global_route_protocol.go index d7384fef992..02f105bef2d 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_global_route_protocol.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_global_route_protocol.go @@ -71,13 +71,13 @@ func (client *Client) ModifySagGlobalRouteProtocolWithCallback(request *ModifySa // ModifySagGlobalRouteProtocolRequest is the request struct for api ModifySagGlobalRouteProtocol type ModifySagGlobalRouteProtocolRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - RouteProtocol string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + RouteProtocol string `position:"Query" name:"RouteProtocol"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` } // ModifySagGlobalRouteProtocolResponse is the response struct for api ModifySagGlobalRouteProtocol diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_ha.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_ha.go index 35acdcec8f6..c6f7d91f7d0 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_ha.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_ha.go @@ -71,15 +71,15 @@ func (client *Client) ModifySagHaWithCallback(request *ModifySagHaRequest, callb // ModifySagHaRequest is the request struct for api ModifySagHa type ModifySagHaRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - VirtualIp string `position:"Query"` - Mode string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` - PortName string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + VirtualIp string `position:"Query" name:"VirtualIp"` + Mode string `position:"Query" name:"Mode"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` + PortName string `position:"Query" name:"PortName"` } // ModifySagHaResponse is the response struct for api ModifySagHa diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_lan.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_lan.go index 08428c61d75..62e5f3a43b0 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_lan.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_lan.go @@ -71,19 +71,19 @@ func (client *Client) ModifySagLanWithCallback(request *ModifySagLanRequest, cal // ModifySagLanRequest is the request struct for api ModifySagLan type ModifySagLanRequest struct { *requests.RpcRequest - EndIp string `position:"Query"` - ResourceOwnerId requests.Integer `position:"Query"` - Mask string `position:"Query"` - StartIp string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - IP string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - IPType string `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` - PortName string `position:"Query"` - Lease string `position:"Query"` + EndIp string `position:"Query" name:"EndIp"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + Mask string `position:"Query" name:"Mask"` + StartIp string `position:"Query" name:"StartIp"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + IP string `position:"Query" name:"IP"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + IPType string `position:"Query" name:"IPType"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` + PortName string `position:"Query" name:"PortName"` + Lease string `position:"Query" name:"Lease"` } // ModifySagLanResponse is the response struct for api ModifySagLan diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_management_port.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_management_port.go index b7c8df7c4c7..8b6d4c8ed33 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_management_port.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_management_port.go @@ -71,15 +71,15 @@ func (client *Client) ModifySagManagementPortWithCallback(request *ModifySagMana // ModifySagManagementPortRequest is the request struct for api ModifySagManagementPort type ModifySagManagementPortRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - Mask string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - IP string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` - Gateway string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + Mask string `position:"Query" name:"Mask"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + IP string `position:"Query" name:"IP"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` + Gateway string `position:"Query" name:"Gateway"` } // ModifySagManagementPortResponse is the response struct for api ModifySagManagementPort diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_port_role.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_port_role.go index defcca95c14..d3d07f28bce 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_port_role.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_port_role.go @@ -71,15 +71,15 @@ func (client *Client) ModifySagPortRoleWithCallback(request *ModifySagPortRoleRe // ModifySagPortRoleRequest is the request struct for api ModifySagPortRole type ModifySagPortRoleRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - Role string `position:"Query"` - Vlan string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` - PortName string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + Role string `position:"Query" name:"Role"` + Vlan string `position:"Query" name:"Vlan"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` + PortName string `position:"Query" name:"PortName"` } // ModifySagPortRoleResponse is the response struct for api ModifySagPortRole diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_port_route_protocol.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_port_route_protocol.go index 370eb8b8ed5..2b59ebdb1e9 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_port_route_protocol.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_port_route_protocol.go @@ -71,17 +71,17 @@ func (client *Client) ModifySagPortRouteProtocolWithCallback(request *ModifySagP // ModifySagPortRouteProtocolRequest is the request struct for api ModifySagPortRouteProtocol type ModifySagPortRouteProtocolRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - RemoteIp string `position:"Query"` - Vlan string `position:"Query"` - RemoteAs string `position:"Query"` - RouteProtocol string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` - PortName string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + RemoteIp string `position:"Query" name:"RemoteIp"` + Vlan string `position:"Query" name:"Vlan"` + RemoteAs string `position:"Query" name:"RemoteAs"` + RouteProtocol string `position:"Query" name:"RouteProtocol"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` + PortName string `position:"Query" name:"PortName"` } // ModifySagPortRouteProtocolResponse is the response struct for api ModifySagPortRouteProtocol diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_remote_access.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_remote_access.go index 35e8997e16c..704ef8b89a9 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_remote_access.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_remote_access.go @@ -71,21 +71,21 @@ func (client *Client) ModifySagRemoteAccessWithCallback(request *ModifySagRemote // ModifySagRemoteAccessRequest is the request struct for api ModifySagRemoteAccess type ModifySagRemoteAccessRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - RemoteAccessIp string `position:"Query"` - SerialNumber string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + RemoteAccessIp string `position:"Query" name:"RemoteAccessIp"` + SerialNumber string `position:"Query" name:"SerialNumber"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // ModifySagRemoteAccessResponse is the response struct for api ModifySagRemoteAccess type ModifySagRemoteAccessResponse struct { *responses.BaseResponse - Message string `json:"Message" xml:"Message"` - RequestId string `json:"RequestId" xml:"RequestId"` SerialNumber string `json:"SerialNumber" xml:"SerialNumber"` + RequestId string `json:"RequestId" xml:"RequestId"` + Message string `json:"Message" xml:"Message"` RemoteAccessIp string `json:"RemoteAccessIp" xml:"RemoteAccessIp"` Code string `json:"Code" xml:"Code"` Success bool `json:"Success" xml:"Success"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_route_protocol_bgp.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_route_protocol_bgp.go index 8ead8fff461..4fc271d19fa 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_route_protocol_bgp.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_route_protocol_bgp.go @@ -71,17 +71,17 @@ func (client *Client) ModifySagRouteProtocolBgpWithCallback(request *ModifySagRo // ModifySagRouteProtocolBgpRequest is the request struct for api ModifySagRouteProtocolBgp type ModifySagRouteProtocolBgpRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - KeepAlive requests.Integer `position:"Query"` - HoldTime requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - AdvertiseIps string `position:"Query"` - RouterId string `position:"Query"` - LocalAs requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + KeepAlive requests.Integer `position:"Query" name:"KeepAlive"` + HoldTime requests.Integer `position:"Query" name:"HoldTime"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + AdvertiseIps string `position:"Query" name:"AdvertiseIps"` + RouterId string `position:"Query" name:"RouterId"` + LocalAs requests.Integer `position:"Query" name:"LocalAs"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` } // ModifySagRouteProtocolBgpResponse is the response struct for api ModifySagRouteProtocolBgp diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_route_protocol_ospf.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_route_protocol_ospf.go index 0088491241e..08a87026936 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_route_protocol_ospf.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_route_protocol_ospf.go @@ -71,20 +71,20 @@ func (client *Client) ModifySagRouteProtocolOspfWithCallback(request *ModifySagR // ModifySagRouteProtocolOspfRequest is the request struct for api ModifySagRouteProtocolOspf type ModifySagRouteProtocolOspfRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - AuthenticationType string `position:"Query"` - Password string `position:"Query"` - AreaId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - Md5KeyId requests.Integer `position:"Query"` - RouterId string `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` - DeadTime requests.Integer `position:"Query"` - Md5Key string `position:"Query"` - HelloTime requests.Integer `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + AuthenticationType string `position:"Query" name:"AuthenticationType"` + Password string `position:"Query" name:"Password"` + AreaId requests.Integer `position:"Query" name:"AreaId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + Md5KeyId requests.Integer `position:"Query" name:"Md5KeyId"` + RouterId string `position:"Query" name:"RouterId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` + DeadTime requests.Integer `position:"Query" name:"DeadTime"` + Md5Key string `position:"Query" name:"Md5Key"` + HelloTime requests.Integer `position:"Query" name:"HelloTime"` } // ModifySagRouteProtocolOspfResponse is the response struct for api ModifySagRouteProtocolOspf diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_static_route.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_static_route.go index c3f368bb955..bd02ce442aa 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_static_route.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_static_route.go @@ -71,16 +71,16 @@ func (client *Client) ModifySagStaticRouteWithCallback(request *ModifySagStaticR // ModifySagStaticRouteRequest is the request struct for api ModifySagStaticRoute type ModifySagStaticRouteRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - Vlan string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - NextHop string `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` - PortName string `position:"Query"` - DestinationCidr string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + Vlan string `position:"Query" name:"Vlan"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + NextHop string `position:"Query" name:"NextHop"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` + PortName string `position:"Query" name:"PortName"` + DestinationCidr string `position:"Query" name:"DestinationCidr"` } // ModifySagStaticRouteResponse is the response struct for api ModifySagStaticRoute diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_user_dns.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_user_dns.go index 14394670191..039a049c7bf 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_user_dns.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_user_dns.go @@ -71,14 +71,14 @@ func (client *Client) ModifySagUserDnsWithCallback(request *ModifySagUserDnsRequ // ModifySagUserDnsRequest is the request struct for api ModifySagUserDns type ModifySagUserDnsRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - SlaveDns string `position:"Query"` - MasterDns string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + SlaveDns string `position:"Query" name:"SlaveDns"` + MasterDns string `position:"Query" name:"MasterDns"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` } // ModifySagUserDnsResponse is the response struct for api ModifySagUserDns diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_wan.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_wan.go index cd21f1b569a..8663bd3b942 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_wan.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_wan.go @@ -71,27 +71,27 @@ func (client *Client) ModifySagWanWithCallback(request *ModifySagWanRequest, cal // ModifySagWanRequest is the request struct for api ModifySagWan type ModifySagWanRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ISP string `position:"Query"` - Password string `position:"Query"` - Vlan string `position:"Query"` - Mask string `position:"Query"` - StartIp string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - Bandwidth requests.Integer `position:"Query"` - OwnerAccount string `position:"Query"` - IP string `position:"Query"` - Weight requests.Integer `position:"Query"` - OwnerId requests.Integer `position:"Query"` - IPType string `position:"Query"` - Priority requests.Integer `position:"Query"` - SourceIps string `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` - PortName string `position:"Query"` - StopIp string `position:"Query"` - Gateway string `position:"Query"` - Username string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ISP string `position:"Query" name:"ISP"` + Password string `position:"Query" name:"Password"` + Vlan string `position:"Query" name:"Vlan"` + Mask string `position:"Query" name:"Mask"` + StartIp string `position:"Query" name:"StartIp"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + Bandwidth requests.Integer `position:"Query" name:"Bandwidth"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + IP string `position:"Query" name:"IP"` + Weight requests.Integer `position:"Query" name:"Weight"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + IPType string `position:"Query" name:"IPType"` + Priority requests.Integer `position:"Query" name:"Priority"` + SourceIps string `position:"Query" name:"SourceIps"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` + PortName string `position:"Query" name:"PortName"` + StopIp string `position:"Query" name:"StopIp"` + Gateway string `position:"Query" name:"Gateway"` + Username string `position:"Query" name:"Username"` } // ModifySagWanResponse is the response struct for api ModifySagWan diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_wan_snat.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_wan_snat.go index bdbc202f4d1..9a91506195c 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_wan_snat.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_wan_snat.go @@ -71,13 +71,13 @@ func (client *Client) ModifySagWanSnatWithCallback(request *ModifySagWanSnatRequ // ModifySagWanSnatRequest is the request struct for api ModifySagWanSnat type ModifySagWanSnatRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` - Snat string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` + Snat string `position:"Query" name:"Snat"` } // ModifySagWanSnatResponse is the response struct for api ModifySagWanSnat diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_wifi.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_wifi.go index 07ff3cc2a1c..b5b0af07b34 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_wifi.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_sag_wifi.go @@ -71,21 +71,21 @@ func (client *Client) ModifySagWifiWithCallback(request *ModifySagWifiRequest, c // ModifySagWifiRequest is the request struct for api ModifySagWifi type ModifySagWifiRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - EncryptAlgorithm string `position:"Query"` - Channel string `position:"Query"` - AuthenticationType string `position:"Query"` - SSID string `position:"Query"` - Password string `position:"Query"` - IsBroadcast string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - Bandwidth string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - IsEnable string `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` - IsAuth string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + EncryptAlgorithm string `position:"Query" name:"EncryptAlgorithm"` + Channel string `position:"Query" name:"Channel"` + AuthenticationType string `position:"Query" name:"AuthenticationType"` + SSID string `position:"Query" name:"SSID"` + Password string `position:"Query" name:"Password"` + IsBroadcast string `position:"Query" name:"IsBroadcast"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + Bandwidth string `position:"Query" name:"Bandwidth"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + IsEnable string `position:"Query" name:"IsEnable"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` + IsAuth string `position:"Query" name:"IsAuth"` } // ModifySagWifiResponse is the response struct for api ModifySagWifi diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_smart_access_gateway.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_smart_access_gateway.go index 890aabdbe2d..71327243f54 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_smart_access_gateway.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_smart_access_gateway.go @@ -71,17 +71,17 @@ func (client *Client) ModifySmartAccessGatewayWithCallback(request *ModifySmartA // ModifySmartAccessGatewayRequest is the request struct for api ModifySmartAccessGateway type ModifySmartAccessGatewayRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - City string `position:"Query"` - Description string `position:"Query"` - SecurityLockThreshold requests.Integer `position:"Query"` - RoutingStrategy string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - Name string `position:"Query"` - CidrBlock string `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + City string `position:"Query" name:"City"` + Description string `position:"Query" name:"Description"` + SecurityLockThreshold requests.Integer `position:"Query" name:"SecurityLockThreshold"` + RoutingStrategy string `position:"Query" name:"RoutingStrategy"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + Name string `position:"Query" name:"Name"` + CidrBlock string `position:"Query" name:"CidrBlock"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // ModifySmartAccessGatewayResponse is the response struct for api ModifySmartAccessGateway diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_smart_access_gateway_client_user.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_smart_access_gateway_client_user.go index c012a4cbbeb..70728981b9c 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_smart_access_gateway_client_user.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_smart_access_gateway_client_user.go @@ -71,14 +71,16 @@ func (client *Client) ModifySmartAccessGatewayClientUserWithCallback(request *Mo // ModifySmartAccessGatewayClientUserRequest is the request struct for api ModifySmartAccessGatewayClientUser type ModifySmartAccessGatewayClientUserRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - Email string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - Bandwidth requests.Integer `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - UserName string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ClientIp string `position:"Query" name:"ClientIp"` + Email string `position:"Query" name:"Email"` + EnableStaticIp requests.Boolean `position:"Query" name:"EnableStaticIp"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + Bandwidth requests.Integer `position:"Query" name:"Bandwidth"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + UserName string `position:"Query" name:"UserName"` } // ModifySmartAccessGatewayClientUserResponse is the response struct for api ModifySmartAccessGatewayClientUser diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_smart_access_gateway_up_bandwidth.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_smart_access_gateway_up_bandwidth.go index 2aeb9542447..a3158f319a8 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_smart_access_gateway_up_bandwidth.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/modify_smart_access_gateway_up_bandwidth.go @@ -71,13 +71,13 @@ func (client *Client) ModifySmartAccessGatewayUpBandwidthWithCallback(request *M // ModifySmartAccessGatewayUpBandwidthRequest is the request struct for api ModifySmartAccessGatewayUpBandwidth type ModifySmartAccessGatewayUpBandwidthRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - UpBandwidthWan requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - UpBandwidth4G requests.Integer `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + UpBandwidthWan requests.Integer `position:"Query" name:"UpBandwidthWan"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + UpBandwidth4G requests.Integer `position:"Query" name:"UpBandwidth4G"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // ModifySmartAccessGatewayUpBandwidthResponse is the response struct for api ModifySmartAccessGatewayUpBandwidth diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/move_resource_group.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/move_resource_group.go index 54c103b34f4..5de1088ef66 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/move_resource_group.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/move_resource_group.go @@ -71,13 +71,13 @@ func (client *Client) MoveResourceGroupWithCallback(request *MoveResourceGroupRe // MoveResourceGroupRequest is the request struct for api MoveResourceGroup type MoveResourceGroupRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - ResourceType string `position:"Query"` - NewResourceGroupId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceId string `position:"Query" name:"ResourceId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + ResourceType string `position:"Query" name:"ResourceType"` + NewResourceGroupId string `position:"Query" name:"NewResourceGroupId"` } // MoveResourceGroupResponse is the response struct for api MoveResourceGroup diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/orchestrate_sag_ec_route_backup.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/orchestrate_sag_ec_route_backup.go deleted file mode 100644 index 2e04b0d7b5e..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/orchestrate_sag_ec_route_backup.go +++ /dev/null @@ -1,102 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// OrchestrateSagECRouteBackup invokes the smartag.OrchestrateSagECRouteBackup API synchronously -func (client *Client) OrchestrateSagECRouteBackup(request *OrchestrateSagECRouteBackupRequest) (response *OrchestrateSagECRouteBackupResponse, err error) { - response = CreateOrchestrateSagECRouteBackupResponse() - err = client.DoAction(request, response) - return -} - -// OrchestrateSagECRouteBackupWithChan invokes the smartag.OrchestrateSagECRouteBackup API asynchronously -func (client *Client) OrchestrateSagECRouteBackupWithChan(request *OrchestrateSagECRouteBackupRequest) (<-chan *OrchestrateSagECRouteBackupResponse, <-chan error) { - responseChan := make(chan *OrchestrateSagECRouteBackupResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.OrchestrateSagECRouteBackup(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// OrchestrateSagECRouteBackupWithCallback invokes the smartag.OrchestrateSagECRouteBackup API asynchronously -func (client *Client) OrchestrateSagECRouteBackupWithCallback(request *OrchestrateSagECRouteBackupRequest, callback func(response *OrchestrateSagECRouteBackupResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *OrchestrateSagECRouteBackupResponse - var err error - defer close(result) - response, err = client.OrchestrateSagECRouteBackup(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// OrchestrateSagECRouteBackupRequest is the request struct for api OrchestrateSagECRouteBackup -type OrchestrateSagECRouteBackupRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` -} - -// OrchestrateSagECRouteBackupResponse is the response struct for api OrchestrateSagECRouteBackup -type OrchestrateSagECRouteBackupResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateOrchestrateSagECRouteBackupRequest creates a request to invoke OrchestrateSagECRouteBackup API -func CreateOrchestrateSagECRouteBackupRequest() (request *OrchestrateSagECRouteBackupRequest) { - request = &OrchestrateSagECRouteBackupRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Smartag", "2018-03-13", "OrchestrateSagECRouteBackup", "smartag", "openAPI") - request.Method = requests.POST - return -} - -// CreateOrchestrateSagECRouteBackupResponse creates a response to parse from OrchestrateSagECRouteBackup response -func CreateOrchestrateSagECRouteBackupResponse() (response *OrchestrateSagECRouteBackupResponse) { - response = &OrchestrateSagECRouteBackupResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/probe_access_point_network_quality.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/probe_access_point_network_quality.go index b375c2bb226..06f0b4d5338 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/probe_access_point_network_quality.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/probe_access_point_network_quality.go @@ -71,12 +71,12 @@ func (client *Client) ProbeAccessPointNetworkQualityWithCallback(request *ProbeA // ProbeAccessPointNetworkQualityRequest is the request struct for api ProbeAccessPointNetworkQuality type ProbeAccessPointNetworkQualityRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` AccessPointIds *[]string `position:"Query" name:"AccessPointIds" type:"Repeated"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // ProbeAccessPointNetworkQualityResponse is the response struct for api ProbeAccessPointNetworkQuality diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/reboot_smart_access_gateway.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/reboot_smart_access_gateway.go index 420491037d5..0a7e513692d 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/reboot_smart_access_gateway.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/reboot_smart_access_gateway.go @@ -71,12 +71,12 @@ func (client *Client) RebootSmartAccessGatewayWithCallback(request *RebootSmartA // RebootSmartAccessGatewayRequest is the request struct for api RebootSmartAccessGateway type RebootSmartAccessGatewayRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - SerialNumber string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + SerialNumber string `position:"Query" name:"SerialNumber"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // RebootSmartAccessGatewayResponse is the response struct for api RebootSmartAccessGateway diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/reset_smart_access_gateway_client_user_password.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/reset_smart_access_gateway_client_user_password.go index c24a5d0482a..6795665e219 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/reset_smart_access_gateway_client_user_password.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/reset_smart_access_gateway_client_user_password.go @@ -71,13 +71,13 @@ func (client *Client) ResetSmartAccessGatewayClientUserPasswordWithCallback(requ // ResetSmartAccessGatewayClientUserPasswordRequest is the request struct for api ResetSmartAccessGatewayClientUserPassword type ResetSmartAccessGatewayClientUserPasswordRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - Password string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - UserName string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + Password string `position:"Query" name:"Password"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + UserName string `position:"Query" name:"UserName"` } // ResetSmartAccessGatewayClientUserPasswordResponse is the response struct for api ResetSmartAccessGatewayClientUserPassword diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/revoke_instance_from_cbn.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/revoke_instance_from_cbn.go index 7de7c8756d0..e2863e55159 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/revoke_instance_from_cbn.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/revoke_instance_from_cbn.go @@ -71,12 +71,12 @@ func (client *Client) RevokeInstanceFromCbnWithCallback(request *RevokeInstanceF // RevokeInstanceFromCbnRequest is the request struct for api RevokeInstanceFromCbn type RevokeInstanceFromCbnRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - CcnInstanceId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - CenInstanceId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + CcnInstanceId string `position:"Query" name:"CcnInstanceId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + CenInstanceId string `position:"Query" name:"CenInstanceId"` } // RevokeInstanceFromCbnResponse is the response struct for api RevokeInstanceFromCbn diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/revoke_instance_from_vbr.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/revoke_instance_from_vbr.go index 25bfef8866c..50bda3a3f10 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/revoke_instance_from_vbr.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/revoke_instance_from_vbr.go @@ -71,12 +71,12 @@ func (client *Client) RevokeInstanceFromVbrWithCallback(request *RevokeInstanceF // RevokeInstanceFromVbrRequest is the request struct for api RevokeInstanceFromVbr type RevokeInstanceFromVbrRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - VbrInstanceId string `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + VbrInstanceId string `position:"Query" name:"VbrInstanceId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // RevokeInstanceFromVbrResponse is the response struct for api RevokeInstanceFromVbr diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/revoke_sag_instance_from_ccn.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/revoke_sag_instance_from_ccn.go index 5aa0a1b7fed..8282e4f4518 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/revoke_sag_instance_from_ccn.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/revoke_sag_instance_from_ccn.go @@ -71,12 +71,12 @@ func (client *Client) RevokeSagInstanceFromCcnWithCallback(request *RevokeSagIns // RevokeSagInstanceFromCcnRequest is the request struct for api RevokeSagInstanceFromCcn type RevokeSagInstanceFromCcnRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - CcnInstanceId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + CcnInstanceId string `position:"Query" name:"CcnInstanceId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // RevokeSagInstanceFromCcnResponse is the response struct for api RevokeSagInstanceFromCcn diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/roam_client_user.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/roam_client_user.go index 634c3520967..5cf2ed092a6 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/roam_client_user.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/roam_client_user.go @@ -71,14 +71,14 @@ func (client *Client) RoamClientUserWithCallback(request *RoamClientUserRequest, // RoamClientUserRequest is the request struct for api RoamClientUser type RoamClientUserRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - OriginSmartAGId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - TargetSmartAGId string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - OriginRegionId string `position:"Query"` - UserName string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + OriginSmartAGId string `position:"Query" name:"OriginSmartAGId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + TargetSmartAGId string `position:"Query" name:"TargetSmartAGId"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + OriginRegionId string `position:"Query" name:"OriginRegionId"` + UserName string `position:"Query" name:"UserName"` } // RoamClientUserResponse is the response struct for api RoamClientUser diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/set_sag_routeable_address.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/set_sag_routeable_address.go deleted file mode 100644 index 8e27d9b6f40..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/set_sag_routeable_address.go +++ /dev/null @@ -1,105 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// SetSagRouteableAddress invokes the smartag.SetSagRouteableAddress API synchronously -func (client *Client) SetSagRouteableAddress(request *SetSagRouteableAddressRequest) (response *SetSagRouteableAddressResponse, err error) { - response = CreateSetSagRouteableAddressResponse() - err = client.DoAction(request, response) - return -} - -// SetSagRouteableAddressWithChan invokes the smartag.SetSagRouteableAddress API asynchronously -func (client *Client) SetSagRouteableAddressWithChan(request *SetSagRouteableAddressRequest) (<-chan *SetSagRouteableAddressResponse, <-chan error) { - responseChan := make(chan *SetSagRouteableAddressResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.SetSagRouteableAddress(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// SetSagRouteableAddressWithCallback invokes the smartag.SetSagRouteableAddress API asynchronously -func (client *Client) SetSagRouteableAddressWithCallback(request *SetSagRouteableAddressRequest, callback func(response *SetSagRouteableAddressResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *SetSagRouteableAddressResponse - var err error - defer close(result) - response, err = client.SetSagRouteableAddress(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// SetSagRouteableAddressRequest is the request struct for api SetSagRouteableAddress -type SetSagRouteableAddressRequest struct { - *requests.RpcRequest - AccessKeyId string `position:"Query"` - ResourceOwnerId requests.Integer `position:"Query"` - RouteableAddress string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SagId string `position:"Query"` -} - -// SetSagRouteableAddressResponse is the response struct for api SetSagRouteableAddress -type SetSagRouteableAddressResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` -} - -// CreateSetSagRouteableAddressRequest creates a request to invoke SetSagRouteableAddress API -func CreateSetSagRouteableAddressRequest() (request *SetSagRouteableAddressRequest) { - request = &SetSagRouteableAddressRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Smartag", "2018-03-13", "SetSagRouteableAddress", "smartag", "openAPI") - request.Method = requests.POST - return -} - -// CreateSetSagRouteableAddressResponse creates a response to parse from SetSagRouteableAddress response -func CreateSetSagRouteableAddressResponse() (response *SetSagRouteableAddressResponse) { - response = &SetSagRouteableAddressResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_access_point.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_access_point.go index f1abcd6609f..6d008f7d08d 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_access_point.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_access_point.go @@ -17,9 +17,9 @@ package smartag // AccessPoint is a nested struct in smartag response type AccessPoint struct { - AccessPointId int `json:"AccessPointId" xml:"AccessPointId"` + Longitude string `json:"Longitude" xml:"Longitude"` ActiveSmartAGCount int `json:"ActiveSmartAGCount" xml:"ActiveSmartAGCount"` - Latitude string `json:"Latitude" xml:"Latitude"` InactiveSmartAGCount int `json:"InactiveSmartAGCount" xml:"InactiveSmartAGCount"` - Longitude string `json:"Longitude" xml:"Longitude"` + Latitude string `json:"Latitude" xml:"Latitude"` + AccessPointId int `json:"AccessPointId" xml:"AccessPointId"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_access_point_network_quality.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_access_point_network_quality.go index df9fb1c27c5..05ad9c59ca3 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_access_point_network_quality.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_access_point_network_quality.go @@ -17,7 +17,7 @@ package smartag // AccessPointNetworkQuality is a nested struct in smartag response type AccessPointNetworkQuality struct { - Rtt string `json:"Rtt" xml:"Rtt"` Loss string `json:"Loss" xml:"Loss"` + Rtt string `json:"Rtt" xml:"Rtt"` Id int `json:"Id" xml:"Id"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_acl.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_acl.go index 9976c4fc925..f9931221396 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_acl.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_acl.go @@ -17,7 +17,8 @@ package smartag // Acl is a nested struct in smartag response type Acl struct { - SagCount string `json:"SagCount" xml:"SagCount"` - AclId string `json:"AclId" xml:"AclId"` - Name string `json:"Name" xml:"Name"` + SagCount string `json:"SagCount" xml:"SagCount"` + AclId string `json:"AclId" xml:"AclId"` + Name string `json:"Name" xml:"Name"` + ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_acr.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_acr.go index 66f206cc1bb..ced717661e8 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_acr.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_acr.go @@ -17,20 +17,20 @@ package smartag // Acr is a nested struct in smartag response type Acr struct { - Policy string `json:"Policy" xml:"Policy"` - Description string `json:"Description" xml:"Description"` - SourcePortRange string `json:"SourcePortRange" xml:"SourcePortRange"` - SourceCidr string `json:"SourceCidr" xml:"SourceCidr"` + Direction string `json:"Direction" xml:"Direction"` + Type string `json:"Type" xml:"Type"` + IpProtocol string `json:"IpProtocol" xml:"IpProtocol"` Priority int `json:"Priority" xml:"Priority"` AclId string `json:"AclId" xml:"AclId"` - AcrId string `json:"AcrId" xml:"AcrId"` - DestPortRange string `json:"DestPortRange" xml:"DestPortRange"` - Direction string `json:"Direction" xml:"Direction"` - Name string `json:"Name" xml:"Name"` + Policy string `json:"Policy" xml:"Policy"` + Description string `json:"Description" xml:"Description"` GmtCreate int64 `json:"GmtCreate" xml:"GmtCreate"` - Type string `json:"Type" xml:"Type"` DestCidr string `json:"DestCidr" xml:"DestCidr"` - IpProtocol string `json:"IpProtocol" xml:"IpProtocol"` + DestPortRange string `json:"DestPortRange" xml:"DestPortRange"` + Name string `json:"Name" xml:"Name"` + AcrId string `json:"AcrId" xml:"AcrId"` + SourceCidr string `json:"SourceCidr" xml:"SourceCidr"` + SourcePortRange string `json:"SourcePortRange" xml:"SourcePortRange"` DpiSignatureIds DpiSignatureIdsInDescribeACLAttribute `json:"DpiSignatureIds" xml:"DpiSignatureIds"` DpiGroupIds DpiGroupIdsInDescribeACLAttribute `json:"DpiGroupIds" xml:"DpiGroupIds"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_application_bandwidth_package_operation_locks.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_application_bandwidth_package_operation_locks.go new file mode 100644 index 00000000000..f5128d9fcf3 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_application_bandwidth_package_operation_locks.go @@ -0,0 +1,22 @@ +package smartag + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ApplicationBandwidthPackageOperationLocks is a nested struct in smartag response +type ApplicationBandwidthPackageOperationLocks struct { + LockType string `json:"LockType" xml:"LockType"` + LockReason string `json:"LockReason" xml:"LockReason"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_cidr.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_cidr.go deleted file mode 100644 index c6f1257c7cf..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_cidr.go +++ /dev/null @@ -1,22 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// Cidr is a nested struct in smartag response -type Cidr struct { - EnableBackup bool `json:"EnableBackup" xml:"EnableBackup"` - Cidr string `json:"Cidr" xml:"Cidr"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_cidrs.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_cidrs.go deleted file mode 100644 index f28945691c2..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_cidrs.go +++ /dev/null @@ -1,21 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// Cidrs is a nested struct in smartag response -type Cidrs struct { - Cidr []Cidr `json:"Cidr" xml:"Cidr"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_cloud_connect_network.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_cloud_connect_network.go index 31e6096d5cd..8ec644a48e3 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_cloud_connect_network.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_cloud_connect_network.go @@ -18,16 +18,17 @@ package smartag // CloudConnectNetwork is a nested struct in smartag response type CloudConnectNetwork struct { IsDefault bool `json:"IsDefault" xml:"IsDefault"` - Description string `json:"Description" xml:"Description"` + CreateTime int64 `json:"CreateTime" xml:"CreateTime"` + AssociatedCenOwnerId string `json:"AssociatedCenOwnerId" xml:"AssociatedCenOwnerId"` + AssociatedCloudBoxCount string `json:"AssociatedCloudBoxCount" xml:"AssociatedCloudBoxCount"` InterworkingStatus string `json:"InterworkingStatus" xml:"InterworkingStatus"` - AvailableCloudBoxCount string `json:"AvailableCloudBoxCount" xml:"AvailableCloudBoxCount"` CcnId string `json:"CcnId" xml:"CcnId"` - CreateTime int64 `json:"CreateTime" xml:"CreateTime"` + AvailableCloudBoxCount string `json:"AvailableCloudBoxCount" xml:"AvailableCloudBoxCount"` CidrBlock string `json:"CidrBlock" xml:"CidrBlock"` - AssociatedCenOwnerId string `json:"AssociatedCenOwnerId" xml:"AssociatedCenOwnerId"` - AssociatedCenId string `json:"AssociatedCenId" xml:"AssociatedCenId"` + Description string `json:"Description" xml:"Description"` SnatCidrBlock string `json:"SnatCidrBlock" xml:"SnatCidrBlock"` - AssociatedCloudBoxCount string `json:"AssociatedCloudBoxCount" xml:"AssociatedCloudBoxCount"` + AssociatedCenId string `json:"AssociatedCenId" xml:"AssociatedCenId"` Name string `json:"Name" xml:"Name"` + ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` Tags Tags `json:"Tags" xml:"Tags"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_cn.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_cn.go index 54bcc997ff0..d9091c3b32a 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_cn.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_cn.go @@ -17,9 +17,9 @@ package smartag // CN is a nested struct in smartag response type CN struct { + ItemName string `json:"ItemName" xml:"ItemName"` ItemLevel string `json:"ItemLevel" xml:"ItemLevel"` ItemType string `json:"ItemType" xml:"ItemType"` - ItemName string `json:"ItemName" xml:"ItemName"` - Details []string `json:"Details" xml:"Details"` Advice []string `json:"Advice" xml:"Advice"` + Details []string `json:"Details" xml:"Details"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_device.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_device.go index 033c4fa9d99..e46d2ed7fb6 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_device.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_device.go @@ -17,12 +17,12 @@ package smartag // Device is a nested struct in smartag response type Device struct { - MonitorVersion string `json:"MonitorVersion" xml:"MonitorVersion"` + SerialNumber string `json:"SerialNumber" xml:"SerialNumber"` + HaState string `json:"HaState" xml:"HaState"` SecretKey string `json:"SecretKey" xml:"SecretKey"` + DpiSignatureDbVersion string `json:"DpiSignatureDbVersion" xml:"DpiSignatureDbVersion"` SoftwareVersion string `json:"SoftwareVersion" xml:"SoftwareVersion"` - SerialNumber string `json:"SerialNumber" xml:"SerialNumber"` DistributeSkStatus int `json:"DistributeSkStatus" xml:"DistributeSkStatus"` - DpiSignatureDbVersion string `json:"DpiSignatureDbVersion" xml:"DpiSignatureDbVersion"` - HaState string `json:"HaState" xml:"HaState"` + MonitorVersion string `json:"MonitorVersion" xml:"MonitorVersion"` HcState string `json:"HcState" xml:"HcState"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_diagnose_result.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_diagnose_result.go index 2be540fad25..5a59b6080cc 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_diagnose_result.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_diagnose_result.go @@ -17,23 +17,23 @@ package smartag // DiagnoseResult is a nested struct in smartag response type DiagnoseResult struct { - Parameters string `json:"Parameters" xml:"Parameters"` - EndTime int `json:"EndTime" xml:"EndTime"` - InstanceId string `json:"InstanceId" xml:"InstanceId"` - UserLevel string `json:"UserLevel" xml:"UserLevel"` Percent int `json:"Percent" xml:"Percent"` - StartTime int `json:"StartTime" xml:"StartTime"` - FinishedNumber int `json:"FinishedNumber" xml:"FinishedNumber"` + SN string `json:"SN" xml:"SN"` + DiagnoseId string `json:"DiagnoseId" xml:"DiagnoseId"` + State string `json:"State" xml:"State"` + UserLevel string `json:"UserLevel" xml:"UserLevel"` + BoxVersion string `json:"BoxVersion" xml:"BoxVersion"` + InstanceId string `json:"InstanceId" xml:"InstanceId"` BoxType string `json:"BoxType" xml:"BoxType"` - StoreType string `json:"StoreType" xml:"StoreType"` MonitorVersion string `json:"MonitorVersion" xml:"MonitorVersion"` + FinishedNumber int `json:"FinishedNumber" xml:"FinishedNumber"` UId string `json:"UId" xml:"UId"` + EndTime int `json:"EndTime" xml:"EndTime"` + StartTime int `json:"StartTime" xml:"StartTime"` + Parameters string `json:"Parameters" xml:"Parameters"` + StoreType string `json:"StoreType" xml:"StoreType"` ReportSLSSuccess int `json:"ReportSLSSuccess" xml:"ReportSLSSuccess"` - State string `json:"State" xml:"State"` - DiagnoseId string `json:"DiagnoseId" xml:"DiagnoseId"` TotalNumber int `json:"TotalNumber" xml:"TotalNumber"` - BoxVersion string `json:"BoxVersion" xml:"BoxVersion"` - SN string `json:"SN" xml:"SN"` Level Level `json:"Level" xml:"Level"` Statistics Statistics `json:"Statistics" xml:"Statistics"` Details []Detail `json:"Details" xml:"Details"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_dnat_entry.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_dnat_entry.go index b4e94ff1760..0d97115651d 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_dnat_entry.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_dnat_entry.go @@ -17,12 +17,12 @@ package smartag // DnatEntry is a nested struct in smartag response type DnatEntry struct { - ExternalPort string `json:"ExternalPort" xml:"ExternalPort"` Type string `json:"Type" xml:"Type"` - ExternalIp string `json:"ExternalIp" xml:"ExternalIp"` - IpProtocol string `json:"IpProtocol" xml:"IpProtocol"` - InternalPort string `json:"InternalPort" xml:"InternalPort"` SagId string `json:"SagId" xml:"SagId"` InternalIp string `json:"InternalIp" xml:"InternalIp"` + InternalPort string `json:"InternalPort" xml:"InternalPort"` + IpProtocol string `json:"IpProtocol" xml:"IpProtocol"` + ExternalPort string `json:"ExternalPort" xml:"ExternalPort"` DnatEntryId string `json:"DnatEntryId" xml:"DnatEntryId"` + ExternalIp string `json:"ExternalIp" xml:"ExternalIp"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_dpi_config_error_item.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_dpi_config_error_item.go index ea2c4cf2aef..087335bc188 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_dpi_config_error_item.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_dpi_config_error_item.go @@ -17,8 +17,8 @@ package smartag // DpiConfigErrorItem is a nested struct in smartag response type DpiConfigErrorItem struct { - ErrorType string `json:"ErrorType" xml:"ErrorType"` SN string `json:"SN" xml:"SN"` SmartAGId string `json:"SmartAGId" xml:"SmartAGId"` + ErrorType string `json:"ErrorType" xml:"ErrorType"` RuleConfigErrorList []RuleConfigErrorListItem `json:"RuleConfigErrorList" xml:"RuleConfigErrorList"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_dpi_group_item.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_dpi_group_item.go index aa987cbb746..8757b83b84a 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_dpi_group_item.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_dpi_group_item.go @@ -17,8 +17,8 @@ package smartag // DpiGroupItem is a nested struct in smartag response type DpiGroupItem struct { - MinEngineVersion string `json:"MinEngineVersion" xml:"MinEngineVersion"` - DpiGroupName string `json:"DpiGroupName" xml:"DpiGroupName"` MinSignatureDbVersion string `json:"MinSignatureDbVersion" xml:"MinSignatureDbVersion"` + DpiGroupName string `json:"DpiGroupName" xml:"DpiGroupName"` DpiGroupId string `json:"DpiGroupId" xml:"DpiGroupId"` + MinEngineVersion string `json:"MinEngineVersion" xml:"MinEngineVersion"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_dpi_signature_item.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_dpi_signature_item.go index 6772bd1dc70..65813a0503c 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_dpi_signature_item.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_dpi_signature_item.go @@ -17,9 +17,9 @@ package smartag // DpiSignatureItem is a nested struct in smartag response type DpiSignatureItem struct { - MinEngineVersion string `json:"MinEngineVersion" xml:"MinEngineVersion"` - MinSignatureDbVersion string `json:"MinSignatureDbVersion" xml:"MinSignatureDbVersion"` DpiSignatureId string `json:"DpiSignatureId" xml:"DpiSignatureId"` - DpiSignatureName string `json:"DpiSignatureName" xml:"DpiSignatureName"` + MinSignatureDbVersion string `json:"MinSignatureDbVersion" xml:"MinSignatureDbVersion"` DpiGroupId string `json:"DpiGroupId" xml:"DpiGroupId"` + MinEngineVersion string `json:"MinEngineVersion" xml:"MinEngineVersion"` + DpiSignatureName string `json:"DpiSignatureName" xml:"DpiSignatureName"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_drop_top_n_item.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_drop_top_n_item.go index 1f217bcc163..2b42a1b80d8 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_drop_top_n_item.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_drop_top_n_item.go @@ -17,8 +17,8 @@ package smartag // DropTopNItem is a nested struct in smartag response type DropTopNItem struct { - InstanceId string `json:"InstanceId" xml:"InstanceId"` - RegionId string `json:"RegionId" xml:"RegionId"` DropRate string `json:"DropRate" xml:"DropRate"` + InstanceId string `json:"InstanceId" xml:"InstanceId"` Name string `json:"Name" xml:"Name"` + RegionId string `json:"RegionId" xml:"RegionId"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_en.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_en.go index e338c061e87..4e54f5fb1cd 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_en.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_en.go @@ -17,9 +17,9 @@ package smartag // EN is a nested struct in smartag response type EN struct { + ItemName string `json:"ItemName" xml:"ItemName"` ItemLevel string `json:"ItemLevel" xml:"ItemLevel"` ItemType string `json:"ItemType" xml:"ItemType"` - ItemName string `json:"ItemName" xml:"ItemName"` - Details []string `json:"Details" xml:"Details"` Advice []string `json:"Advice" xml:"Advice"` + Details []string `json:"Details" xml:"Details"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_enterprise_code.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_enterprise_code.go index 2135757ecc1..afbc3335bec 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_enterprise_code.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_enterprise_code.go @@ -18,6 +18,6 @@ package smartag // EnterpriseCode is a nested struct in smartag response type EnterpriseCode struct { IsDefault bool `json:"IsDefault" xml:"IsDefault"` - EnterpriseCode string `json:"EnterpriseCode" xml:"EnterpriseCode"` SmartAGCount int `json:"SmartAGCount" xml:"SmartAGCount"` + EnterpriseCode string `json:"EnterpriseCode" xml:"EnterpriseCode"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_flow_log_set_type.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_flow_log_set_type.go index aa4cd82c16d..73d95ec8bfd 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_flow_log_set_type.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_flow_log_set_type.go @@ -17,18 +17,19 @@ package smartag // FlowLogSetType is a nested struct in smartag response type FlowLogSetType struct { - NetflowServerPort string `json:"NetflowServerPort" xml:"NetflowServerPort"` Status string `json:"Status" xml:"Status"` - LogstoreName string `json:"LogstoreName" xml:"LogstoreName"` - Description string `json:"Description" xml:"Description"` - ActiveAging int `json:"ActiveAging" xml:"ActiveAging"` - ProjectName string `json:"ProjectName" xml:"ProjectName"` + TotalSagNum int `json:"TotalSagNum" xml:"TotalSagNum"` NetflowServerIp string `json:"NetflowServerIp" xml:"NetflowServerIp"` + ProjectName string `json:"ProjectName" xml:"ProjectName"` + SlsRegionId string `json:"SlsRegionId" xml:"SlsRegionId"` + ActiveAging int `json:"ActiveAging" xml:"ActiveAging"` + OutputType string `json:"OutputType" xml:"OutputType"` + Description string `json:"Description" xml:"Description"` NetflowVersion string `json:"NetflowVersion" xml:"NetflowVersion"` InactiveAging int `json:"InactiveAging" xml:"InactiveAging"` - FlowLogId string `json:"FlowLogId" xml:"FlowLogId"` + NetflowServerPort string `json:"NetflowServerPort" xml:"NetflowServerPort"` Name string `json:"Name" xml:"Name"` - TotalSagNum int `json:"TotalSagNum" xml:"TotalSagNum"` - SlsRegionId string `json:"SlsRegionId" xml:"SlsRegionId"` - OutputType string `json:"OutputType" xml:"OutputType"` + FlowLogId string `json:"FlowLogId" xml:"FlowLogId"` + LogstoreName string `json:"LogstoreName" xml:"LogstoreName"` + ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_health_check.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_health_check.go index 43eeec58d9b..96d4144ccb8 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_health_check.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_health_check.go @@ -17,21 +17,21 @@ package smartag // HealthCheck is a nested struct in smartag response type HealthCheck struct { + Type string `json:"Type" xml:"Type"` + ProbeTimeout int `json:"ProbeTimeout" xml:"ProbeTimeout"` Status string `json:"Status" xml:"Status"` - Description string `json:"Description" xml:"Description"` + DstIpAddr string `json:"DstIpAddr" xml:"DstIpAddr"` + RelationCount int `json:"RelationCount" xml:"RelationCount"` + RttFailThreshold int `json:"RttFailThreshold" xml:"RttFailThreshold"` + SmartAGId string `json:"SmartAGId" xml:"SmartAGId"` + DstPort int `json:"DstPort" xml:"DstPort"` + FailCountThreshold int `json:"FailCountThreshold" xml:"FailCountThreshold"` + RttThreshold int `json:"RttThreshold" xml:"RttThreshold"` SrcPort int `json:"SrcPort" xml:"SrcPort"` + ProbeCount int `json:"ProbeCount" xml:"ProbeCount"` + Description string `json:"Description" xml:"Description"` SrcIpAddr string `json:"SrcIpAddr" xml:"SrcIpAddr"` - FailCountThreshold int `json:"FailCountThreshold" xml:"FailCountThreshold"` - DstPort int `json:"DstPort" xml:"DstPort"` + ProbeInterval int `json:"ProbeInterval" xml:"ProbeInterval"` Name string `json:"Name" xml:"Name"` - ProbeCount int `json:"ProbeCount" xml:"ProbeCount"` - Type string `json:"Type" xml:"Type"` - ProbeTimeout int `json:"ProbeTimeout" xml:"ProbeTimeout"` HcInstanceId string `json:"HcInstanceId" xml:"HcInstanceId"` - RttThreshold int `json:"RttThreshold" xml:"RttThreshold"` - ProbeInterval int `json:"ProbeInterval" xml:"ProbeInterval"` - RelationCount int `json:"RelationCount" xml:"RelationCount"` - SmartAGId string `json:"SmartAGId" xml:"SmartAGId"` - RttFailThreshold int `json:"RttFailThreshold" xml:"RttFailThreshold"` - DstIpAddr string `json:"DstIpAddr" xml:"DstIpAddr"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_interface.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_interface.go index 3992eba7bed..a0df9933804 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_interface.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_interface.go @@ -17,7 +17,7 @@ package smartag // Interface is a nested struct in smartag response type Interface struct { - IP string `json:"IP" xml:"IP"` Mask string `json:"Mask" xml:"Mask"` Vlan string `json:"Vlan" xml:"Vlan"` + IP string `json:"IP" xml:"IP"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_item.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_item.go index b6f31129d6a..d1f67d58ab2 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_item.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_item.go @@ -22,6 +22,6 @@ type Item struct { StartTime int64 `json:"StartTime" xml:"StartTime"` ItemName string `json:"ItemName" xml:"ItemName"` Level string `json:"Level" xml:"Level"` - EN EN `json:"EN" xml:"EN"` CN CN `json:"CN" xml:"CN"` + EN EN `json:"EN" xml:"EN"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_lan.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_lan.go index c3bf0f16fae..a70ec1f1b94 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_lan.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_lan.go @@ -17,11 +17,11 @@ package smartag // Lan is a nested struct in smartag response type Lan struct { - IPType string `json:"IPType" xml:"IPType"` Lease string `json:"Lease" xml:"Lease"` - IP string `json:"IP" xml:"IP"` Mask string `json:"Mask" xml:"Mask"` - StartIp string `json:"StartIp" xml:"StartIp"` - PortName string `json:"PortName" xml:"PortName"` EndIp string `json:"EndIp" xml:"EndIp"` + PortName string `json:"PortName" xml:"PortName"` + StartIp string `json:"StartIp" xml:"StartIp"` + IPType string `json:"IPType" xml:"IPType"` + IP string `json:"IP" xml:"IP"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_level.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_level.go index a30f5507e30..99571b7f42a 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_level.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_level.go @@ -17,7 +17,7 @@ package smartag // Level is a nested struct in smartag response type Level struct { - Biz string `json:"Biz" xml:"Biz"` Configuration string `json:"Configuration" xml:"Configuration"` Total string `json:"Total" xml:"Total"` + Biz string `json:"Biz" xml:"Biz"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_link.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_link.go index 39d9c40ffe4..edac291d462 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_link.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_link.go @@ -18,8 +18,8 @@ package smartag // Link is a nested struct in smartag response type Link struct { CommodityType string `json:"CommodityType" xml:"CommodityType"` - InstanceId string `json:"InstanceId" xml:"InstanceId"` Bandwidth string `json:"Bandwidth" xml:"Bandwidth"` + InstanceId string `json:"InstanceId" xml:"InstanceId"` HealthCheckTargetIp string `json:"HealthCheckTargetIp" xml:"HealthCheckTargetIp"` RelateInstanceRegionId string `json:"RelateInstanceRegionId" xml:"RelateInstanceRegionId"` Status string `json:"Status" xml:"Status"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_link_backup_info_list_item.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_link_backup_info_list_item.go index 488867611bb..d154fabde74 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_link_backup_info_list_item.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_link_backup_info_list_item.go @@ -17,10 +17,10 @@ package smartag // LinkBackupInfoListItem is a nested struct in smartag response type LinkBackupInfoListItem struct { + MainLinkId string `json:"MainLinkId" xml:"MainLinkId"` BackupLinkState string `json:"BackupLinkState" xml:"BackupLinkState"` - MainLinkState string `json:"MainLinkState" xml:"MainLinkState"` + LinkLevelBackupState string `json:"LinkLevelBackupState" xml:"LinkLevelBackupState"` BackupLinkId string `json:"BackupLinkId" xml:"BackupLinkId"` + MainLinkState string `json:"MainLinkState" xml:"MainLinkState"` LinkLevelBackupType string `json:"LinkLevelBackupType" xml:"LinkLevelBackupType"` - MainLinkId string `json:"MainLinkId" xml:"MainLinkId"` - LinkLevelBackupState string `json:"LinkLevelBackupState" xml:"LinkLevelBackupState"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_network_optimization.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_network_optimization.go deleted file mode 100644 index 120d83a65cb..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_network_optimization.go +++ /dev/null @@ -1,26 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// NetworkOptimization is a nested struct in smartag response -type NetworkOptimization struct { - SagCount int `json:"SagCount" xml:"SagCount"` - InstanceId string `json:"InstanceId" xml:"InstanceId"` - State string `json:"State" xml:"State"` - CcnId string `json:"CcnId" xml:"CcnId"` - CreateTime int64 `json:"CreateTime" xml:"CreateTime"` - Name string `json:"Name" xml:"Name"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_network_optimizations.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_network_optimizations.go deleted file mode 100644 index cceabd91f59..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_network_optimizations.go +++ /dev/null @@ -1,21 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// NetworkOptimizations is a nested struct in smartag response -type NetworkOptimizations struct { - NetworkOptimization []NetworkOptimization `json:"NetworkOptimization" xml:"NetworkOptimization"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_pbr_interface.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_pbr_interface.go deleted file mode 100644 index db5338a03f3..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_pbr_interface.go +++ /dev/null @@ -1,24 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// PbrInterface is a nested struct in smartag response -type PbrInterface struct { - Action string `json:"Action" xml:"Action"` - Priority int `json:"Priority" xml:"Priority"` - HealthCheckInstanceId string `json:"HealthCheckInstanceId" xml:"HealthCheckInstanceId"` - InterfaceName string `json:"InterfaceName" xml:"InterfaceName"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_pbr_interfaces.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_pbr_interfaces.go deleted file mode 100644 index 663b2d7874d..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_pbr_interfaces.go +++ /dev/null @@ -1,21 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// PbrInterfaces is a nested struct in smartag response -type PbrInterfaces struct { - PbrInterface []PbrInterface `json:"PbrInterface" xml:"PbrInterface"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_pbr_rule.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_pbr_rule.go deleted file mode 100644 index 7123033ccb9..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_pbr_rule.go +++ /dev/null @@ -1,28 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// PbrRule is a nested struct in smartag response -type PbrRule struct { - SrcPort string `json:"SrcPort" xml:"SrcPort"` - Description string `json:"Description" xml:"Description"` - SrcCidr string `json:"SrcCidr" xml:"SrcCidr"` - DstPort string `json:"DstPort" xml:"DstPort"` - PbrRuleId string `json:"PbrRuleId" xml:"PbrRuleId"` - Protocol string `json:"Protocol" xml:"Protocol"` - DstCidr string `json:"DstCidr" xml:"DstCidr"` - Name string `json:"Name" xml:"Name"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_pbr_rules.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_pbr_rules.go deleted file mode 100644 index 7fe1f863c33..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_pbr_rules.go +++ /dev/null @@ -1,21 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// PbrRules is a nested struct in smartag response -type PbrRules struct { - PbrRule []PbrRule `json:"PbrRule" xml:"PbrRule"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_policy_based_routing.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_policy_based_routing.go deleted file mode 100644 index 35841953e42..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_policy_based_routing.go +++ /dev/null @@ -1,24 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// PolicyBasedRouting is a nested struct in smartag response -type PolicyBasedRouting struct { - PbrInstanceId string `json:"PbrInstanceId" xml:"PbrInstanceId"` - Description string `json:"Description" xml:"Description"` - Priority int `json:"Priority" xml:"Priority"` - Name string `json:"Name" xml:"Name"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_policy_based_routings.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_policy_based_routings.go deleted file mode 100644 index e941eddf8be..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_policy_based_routings.go +++ /dev/null @@ -1,21 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// PolicyBasedRoutings is a nested struct in smartag response -type PolicyBasedRoutings struct { - PolicyBasedRouting []PolicyBasedRouting `json:"PolicyBasedRouting" xml:"PolicyBasedRouting"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_qos.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_qos.go index b42bddd0906..5d8148d9dd4 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_qos.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_qos.go @@ -17,9 +17,10 @@ package smartag // Qos is a nested struct in smartag response type Qos struct { - SagCount string `json:"SagCount" xml:"SagCount"` - QosId string `json:"QosId" xml:"QosId"` - SmartAGIds string `json:"SmartAGIds" xml:"SmartAGIds"` - QosName string `json:"QosName" xml:"QosName"` - QosDescription string `json:"QosDescription" xml:"QosDescription"` + QosDescription string `json:"QosDescription" xml:"QosDescription"` + SagCount string `json:"SagCount" xml:"SagCount"` + SmartAGIds string `json:"SmartAGIds" xml:"SmartAGIds"` + QosId string `json:"QosId" xml:"QosId"` + QosName string `json:"QosName" xml:"QosName"` + ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_qos_policy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_qos_policy.go index 3eb91df8b41..b2d500d5e92 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_qos_policy.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_qos_policy.go @@ -24,8 +24,8 @@ type QosPolicy struct { DestPortRange string `json:"DestPortRange" xml:"DestPortRange"` SourceCidr string `json:"SourceCidr" xml:"SourceCidr"` StartTime string `json:"StartTime" xml:"StartTime"` - EndTime string `json:"EndTime" xml:"EndTime"` QosId string `json:"QosId" xml:"QosId"` + EndTime string `json:"EndTime" xml:"EndTime"` DestCidr string `json:"DestCidr" xml:"DestCidr"` Description string `json:"Description" xml:"Description"` QosPolicyId string `json:"QosPolicyId" xml:"QosPolicyId"` diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_qos_policy_in_get_qos_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_qos_policy_in_get_qos_attribute.go index 1e3130a6ce8..4ddc5861705 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_qos_policy_in_get_qos_attribute.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_qos_policy_in_get_qos_attribute.go @@ -17,14 +17,14 @@ package smartag // QosPolicyInGetQosAttribute is a nested struct in smartag response type QosPolicyInGetQosAttribute struct { - DestCidr string `json:"DestCidr" xml:"DestCidr"` - SourcePortRange string `json:"SourcePortRange" xml:"SourcePortRange"` EndTime int64 `json:"EndTime" xml:"EndTime"` - SourceCidr string `json:"SourceCidr" xml:"SourceCidr"` - Priority int `json:"Priority" xml:"Priority"` - QosPolicieName string `json:"QosPolicieName" xml:"QosPolicieName"` - QosPolicieDescription string `json:"QosPolicieDescription" xml:"QosPolicieDescription"` StartTime int64 `json:"StartTime" xml:"StartTime"` - IpProtocol string `json:"IpProtocol" xml:"IpProtocol"` + DestCidr string `json:"DestCidr" xml:"DestCidr"` DestPortRange string `json:"DestPortRange" xml:"DestPortRange"` + IpProtocol string `json:"IpProtocol" xml:"IpProtocol"` + Priority int `json:"Priority" xml:"Priority"` + QosPolicieDescription string `json:"QosPolicieDescription" xml:"QosPolicieDescription"` + SourceCidr string `json:"SourceCidr" xml:"SourceCidr"` + QosPolicieName string `json:"QosPolicieName" xml:"QosPolicieName"` + SourcePortRange string `json:"SourcePortRange" xml:"SourcePortRange"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_region.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_region.go index 236e2108eaf..075b74541c0 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_region.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_region.go @@ -17,7 +17,7 @@ package smartag // Region is a nested struct in smartag response type Region struct { - RegionId string `json:"RegionId" xml:"RegionId"` - RegionEndpoint string `json:"RegionEndpoint" xml:"RegionEndpoint"` LocalName string `json:"LocalName" xml:"LocalName"` + RegionEndpoint string `json:"RegionEndpoint" xml:"RegionEndpoint"` + RegionId string `json:"RegionId" xml:"RegionId"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_route.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_route.go index 2aa466ff1df..1003e10013f 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_route.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_route.go @@ -17,10 +17,10 @@ package smartag // Route is a nested struct in smartag response type Route struct { - RouteProtocol string `json:"RouteProtocol" xml:"RouteProtocol"` NextHop string `json:"NextHop" xml:"NextHop"` - PortName string `json:"PortName" xml:"PortName"` - Cost string `json:"Cost" xml:"Cost"` DestinationCidr string `json:"DestinationCidr" xml:"DestinationCidr"` + Cost string `json:"Cost" xml:"Cost"` + PortName string `json:"PortName" xml:"PortName"` + RouteProtocol string `json:"RouteProtocol" xml:"RouteProtocol"` ConflictCidrs []string `json:"ConflictCidrs" xml:"ConflictCidrs"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_sag_vbr_relation.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_sag_vbr_relation.go index b2ee21bfc51..ca6b7ddaced 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_sag_vbr_relation.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_sag_vbr_relation.go @@ -18,6 +18,6 @@ package smartag // SagVbrRelation is a nested struct in smartag response type SagVbrRelation struct { VbrInstanceId string `json:"VbrInstanceId" xml:"VbrInstanceId"` - SagInstanceId string `json:"SagInstanceId" xml:"SagInstanceId"` SagUid string `json:"SagUid" xml:"SagUid"` + SagInstanceId string `json:"SagInstanceId" xml:"SagInstanceId"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_setting.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_setting.go deleted file mode 100644 index 062a3eb2402..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_setting.go +++ /dev/null @@ -1,22 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// Setting is a nested struct in smartag response -type Setting struct { - Type string `json:"Type" xml:"Type"` - Domain string `json:"Domain" xml:"Domain"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_settings.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_settings.go deleted file mode 100644 index 41991b91c25..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_settings.go +++ /dev/null @@ -1,21 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// Settings is a nested struct in smartag response -type Settings struct { - Setting []Setting `json:"Setting" xml:"Setting"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_smart_access_gateway.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_smart_access_gateway.go index ba5ed9a91d0..1a6ff98447a 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_smart_access_gateway.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_smart_access_gateway.go @@ -17,46 +17,46 @@ package smartag // SmartAccessGateway is a nested struct in smartag response type SmartAccessGateway struct { - Name string `json:"Name" xml:"Name"` - AccessPointId string `json:"AccessPointId" xml:"AccessPointId"` - MaxBandwidth string `json:"MaxBandwidth" xml:"MaxBandwidth"` - SmartAGStatus string `json:"SmartAGStatus" xml:"SmartAGStatus"` - HardwareVersion string `json:"HardwareVersion" xml:"HardwareVersion"` - CreateTime int64 `json:"CreateTime" xml:"CreateTime"` - EndTime int64 `json:"EndTime" xml:"EndTime"` - SerialNumber string `json:"SerialNumber" xml:"SerialNumber"` - ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` - ResellerInstanceId string `json:"ResellerInstanceId" xml:"ResellerInstanceId"` - AclIds string `json:"AclIds" xml:"AclIds"` - SmartAGDescription string `json:"SmartAGDescription" xml:"SmartAGDescription"` - InstanceId string `json:"InstanceId" xml:"InstanceId"` - UserCount int `json:"UserCount" xml:"UserCount"` - SecurityLockThreshold int `json:"SecurityLockThreshold" xml:"SecurityLockThreshold"` - VpnStatus string `json:"VpnStatus" xml:"VpnStatus"` - CidrBlock string `json:"CidrBlock" xml:"CidrBlock"` - Description string `json:"Description" xml:"Description"` - IpsecStatus string `json:"IpsecStatus" xml:"IpsecStatus"` - DpiStatus string `json:"DpiStatus" xml:"DpiStatus"` - UpBandwidth4G int `json:"UpBandwidth4G" xml:"UpBandwidth4G"` - SmartAGName string `json:"SmartAGName" xml:"SmartAGName"` - SoftwareVersion string `json:"SoftwareVersion" xml:"SoftwareVersion"` - IdaasId string `json:"IdaasId" xml:"IdaasId"` - EnterpriseCode string `json:"EnterpriseCode" xml:"EnterpriseCode"` - City string `json:"City" xml:"City"` - SmartAGUid int64 `json:"SmartAGUid" xml:"SmartAGUid"` - AssociatedCcnId string `json:"AssociatedCcnId" xml:"AssociatedCcnId"` - State string `json:"State" xml:"State"` - ResellerUid string `json:"ResellerUid" xml:"ResellerUid"` - RoutingStrategy string `json:"RoutingStrategy" xml:"RoutingStrategy"` - IdaasApplicationId string `json:"IdaasApplicationId" xml:"IdaasApplicationId"` - BackupStatus string `json:"BackupStatus" xml:"BackupStatus"` - BackupSoftwareVersion string `json:"BackupSoftwareVersion" xml:"BackupSoftwareVersion"` - QosIds string `json:"QosIds" xml:"QosIds"` - UpBandwidthWan int `json:"UpBandwidthWan" xml:"UpBandwidthWan"` - Status string `json:"Status" xml:"Status"` - AssociatedCcnName string `json:"AssociatedCcnName" xml:"AssociatedCcnName"` - DpiMonitorStatus string `json:"DpiMonitorStatus" xml:"DpiMonitorStatus"` - SmartAGId string `json:"SmartAGId" xml:"SmartAGId"` - DataPlan int64 `json:"DataPlan" xml:"DataPlan"` - Links LinksInDescribeSmartAccessGateways `json:"Links" xml:"Links"` + Name string `json:"Name" xml:"Name"` + AccessPointId string `json:"AccessPointId" xml:"AccessPointId"` + MaxBandwidth string `json:"MaxBandwidth" xml:"MaxBandwidth"` + SmartAGStatus string `json:"SmartAGStatus" xml:"SmartAGStatus"` + HardwareVersion string `json:"HardwareVersion" xml:"HardwareVersion"` + CreateTime int64 `json:"CreateTime" xml:"CreateTime"` + AccelerateBandwidth int64 `json:"AccelerateBandwidth" xml:"AccelerateBandwidth"` + SerialNumber string `json:"SerialNumber" xml:"SerialNumber"` + EndTime int64 `json:"EndTime" xml:"EndTime"` + ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` + AclIds string `json:"AclIds" xml:"AclIds"` + ResellerInstanceId string `json:"ResellerInstanceId" xml:"ResellerInstanceId"` + SmartAGDescription string `json:"SmartAGDescription" xml:"SmartAGDescription"` + SecurityLockThreshold int `json:"SecurityLockThreshold" xml:"SecurityLockThreshold"` + UserCount int `json:"UserCount" xml:"UserCount"` + VpnStatus string `json:"VpnStatus" xml:"VpnStatus"` + CidrBlock string `json:"CidrBlock" xml:"CidrBlock"` + Description string `json:"Description" xml:"Description"` + IpsecStatus string `json:"IpsecStatus" xml:"IpsecStatus"` + DpiStatus string `json:"DpiStatus" xml:"DpiStatus"` + UpBandwidth4G int `json:"UpBandwidth4G" xml:"UpBandwidth4G"` + SmartAGName string `json:"SmartAGName" xml:"SmartAGName"` + SoftwareVersion string `json:"SoftwareVersion" xml:"SoftwareVersion"` + ApplicationBandwidthPackageId string `json:"ApplicationBandwidthPackageId" xml:"ApplicationBandwidthPackageId"` + IdaasId string `json:"IdaasId" xml:"IdaasId"` + City string `json:"City" xml:"City"` + EnterpriseCode string `json:"EnterpriseCode" xml:"EnterpriseCode"` + SmartAGUid int64 `json:"SmartAGUid" xml:"SmartAGUid"` + AssociatedCcnId string `json:"AssociatedCcnId" xml:"AssociatedCcnId"` + ResellerUid string `json:"ResellerUid" xml:"ResellerUid"` + BackupStatus string `json:"BackupStatus" xml:"BackupStatus"` + IdaasApplicationId string `json:"IdaasApplicationId" xml:"IdaasApplicationId"` + RoutingStrategy string `json:"RoutingStrategy" xml:"RoutingStrategy"` + BackupSoftwareVersion string `json:"BackupSoftwareVersion" xml:"BackupSoftwareVersion"` + QosIds string `json:"QosIds" xml:"QosIds"` + UpBandwidthWan int `json:"UpBandwidthWan" xml:"UpBandwidthWan"` + Status string `json:"Status" xml:"Status"` + AssociatedCcnName string `json:"AssociatedCcnName" xml:"AssociatedCcnName"` + DpiMonitorStatus string `json:"DpiMonitorStatus" xml:"DpiMonitorStatus"` + SmartAGId string `json:"SmartAGId" xml:"SmartAGId"` + DataPlan int64 `json:"DataPlan" xml:"DataPlan"` + Links LinksInDescribeSmartAccessGateways `json:"Links" xml:"Links"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_smart_access_gateways_in_describe_network_optimization_sags.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_smart_access_gateways_in_describe_network_optimization_sags.go deleted file mode 100644 index 6ca2725cebf..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_smart_access_gateways_in_describe_network_optimization_sags.go +++ /dev/null @@ -1,21 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// SmartAccessGatewaysInDescribeNetworkOptimizationSags is a nested struct in smartag response -type SmartAccessGatewaysInDescribeNetworkOptimizationSags struct { - SmartAccessGateway []SmartAccessGateway `json:"SmartAccessGateway" xml:"SmartAccessGateway"` -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_smart_ag_version.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_smart_ag_version.go index 49b62ec69b7..d96fe28b782 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_smart_ag_version.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_smart_ag_version.go @@ -17,8 +17,8 @@ package smartag // SmartAGVersion is a nested struct in smartag response type SmartAGVersion struct { - VersionCode string `json:"VersionCode" xml:"VersionCode"` Type string `json:"Type" xml:"Type"` CreateTime int64 `json:"CreateTime" xml:"CreateTime"` VersionName string `json:"VersionName" xml:"VersionName"` + VersionCode string `json:"VersionCode" xml:"VersionCode"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_snat_entry.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_snat_entry.go index 693551aa98e..0d3d78825e8 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_snat_entry.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_snat_entry.go @@ -17,8 +17,8 @@ package smartag // SnatEntry is a nested struct in smartag response type SnatEntry struct { - InstanceId string `json:"InstanceId" xml:"InstanceId"` - CreateTime int64 `json:"CreateTime" xml:"CreateTime"` CidrBlock string `json:"CidrBlock" xml:"CidrBlock"` + CreateTime int64 `json:"CreateTime" xml:"CreateTime"` + InstanceId string `json:"InstanceId" xml:"InstanceId"` SnatIp string `json:"SnatIp" xml:"SnatIp"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_static_route.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_static_route.go index f97fb00ee30..01e0af16ea6 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_static_route.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_static_route.go @@ -18,7 +18,7 @@ package smartag // StaticRoute is a nested struct in smartag response type StaticRoute struct { NextHop string `json:"NextHop" xml:"NextHop"` - Vlan string `json:"Vlan" xml:"Vlan"` - PortName string `json:"PortName" xml:"PortName"` DestinationCidr string `json:"DestinationCidr" xml:"DestinationCidr"` + PortName string `json:"PortName" xml:"PortName"` + Vlan string `json:"Vlan" xml:"Vlan"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_strategy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_strategy.go index dd7ded39056..51ba7e84d23 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_strategy.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_strategy.go @@ -18,15 +18,15 @@ package smartag // Strategy is a nested struct in smartag response type Strategy struct { Status string `json:"Status" xml:"Status"` - InstanceId string `json:"InstanceId" xml:"InstanceId"` - HcInstanceId string `json:"HcInstanceId" xml:"HcInstanceId"` - RouteSource string `json:"RouteSource" xml:"RouteSource"` - SourceType string `json:"SourceType" xml:"SourceType"` - CreateTime int64 `json:"CreateTime" xml:"CreateTime"` + StrategyPublishStatus string `json:"StrategyPublishStatus" xml:"StrategyPublishStatus"` RouteDistribution string `json:"RouteDistribution" xml:"RouteDistribution"` - IsConflict bool `json:"IsConflict" xml:"IsConflict"` + CreateTime int64 `json:"CreateTime" xml:"CreateTime"` SmartAGId string `json:"SmartAGId" xml:"SmartAGId"` - StrategyPublishStatus string `json:"StrategyPublishStatus" xml:"StrategyPublishStatus"` - ConflictInfo string `json:"ConflictInfo" xml:"ConflictInfo"` + SourceType string `json:"SourceType" xml:"SourceType"` + IsConflict bool `json:"IsConflict" xml:"IsConflict"` + InstanceId string `json:"InstanceId" xml:"InstanceId"` DestCidrBlock string `json:"DestCidrBlock" xml:"DestCidrBlock"` + ConflictInfo string `json:"ConflictInfo" xml:"ConflictInfo"` + HcInstanceId string `json:"HcInstanceId" xml:"HcInstanceId"` + RouteSource string `json:"RouteSource" xml:"RouteSource"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_tag.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_tag.go index d3fecf45fd4..1ff09fe556f 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_tag.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_tag.go @@ -17,6 +17,6 @@ package smartag // Tag is a nested struct in smartag response type Tag struct { - Value string `json:"Value" xml:"Value"` Key string `json:"Key" xml:"Key"` + Value string `json:"Value" xml:"Value"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_traffic_top_n_item.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_traffic_top_n_item.go index 7d96b2d1220..882d5d955cc 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_traffic_top_n_item.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_traffic_top_n_item.go @@ -17,8 +17,8 @@ package smartag // TrafficTopNItem is a nested struct in smartag response type TrafficTopNItem struct { - InstanceId string `json:"InstanceId" xml:"InstanceId"` TrafficRate string `json:"TrafficRate" xml:"TrafficRate"` - RegionId string `json:"RegionId" xml:"RegionId"` + InstanceId string `json:"InstanceId" xml:"InstanceId"` Name string `json:"Name" xml:"Name"` + RegionId string `json:"RegionId" xml:"RegionId"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_user.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_user.go index 76f3ca9c7e0..ff11499cd04 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_user.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_user.go @@ -17,10 +17,11 @@ package smartag // User is a nested struct in smartag response type User struct { - Bandwidth int `json:"Bandwidth" xml:"Bandwidth"` - UserMail string `json:"UserMail" xml:"UserMail"` - UserName string `json:"UserName" xml:"UserName"` - OnlineTime string `json:"OnlineTime" xml:"OnlineTime"` - State int `json:"State" xml:"State"` - ClientIp string `json:"ClientIp" xml:"ClientIp"` + Bandwidth int `json:"Bandwidth" xml:"Bandwidth"` + UserMail string `json:"UserMail" xml:"UserMail"` + UserName string `json:"UserName" xml:"UserName"` + OnlineTime string `json:"OnlineTime" xml:"OnlineTime"` + State int `json:"State" xml:"State"` + AccelerateBandwidth int64 `json:"AccelerateBandwidth" xml:"AccelerateBandwidth"` + ClientIp string `json:"ClientIp" xml:"ClientIp"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_wan.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_wan.go index 975d0a0839f..21ea5edfc60 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_wan.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/struct_wan.go @@ -17,19 +17,19 @@ package smartag // Wan is a nested struct in smartag response type Wan struct { + Weight int `json:"Weight" xml:"Weight"` + Mask string `json:"Mask" xml:"Mask"` + Gateway string `json:"Gateway" xml:"Gateway"` + PortName string `json:"PortName" xml:"PortName"` IPType string `json:"IPType" xml:"IPType"` - TrafficState string `json:"TrafficState" xml:"TrafficState"` Priority int `json:"Priority" xml:"Priority"` - SourceIps string `json:"SourceIps" xml:"SourceIps"` - ISP string `json:"ISP" xml:"ISP"` + BandWidth int `json:"BandWidth" xml:"BandWidth"` + TrafficState string `json:"TrafficState" xml:"TrafficState"` IP string `json:"IP" xml:"IP"` - Mask string `json:"Mask" xml:"Mask"` - StartIp string `json:"StartIp" xml:"StartIp"` + ISP string `json:"ISP" xml:"ISP"` + Username string `json:"Username" xml:"Username"` Vlan string `json:"Vlan" xml:"Vlan"` - PortName string `json:"PortName" xml:"PortName"` - Weight int `json:"Weight" xml:"Weight"` + SourceIps string `json:"SourceIps" xml:"SourceIps"` + StartIp string `json:"StartIp" xml:"StartIp"` StopIp string `json:"StopIp" xml:"StopIp"` - BandWidth int `json:"BandWidth" xml:"BandWidth"` - Username string `json:"Username" xml:"Username"` - Gateway string `json:"Gateway" xml:"Gateway"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/synchronize_smart_ag_web_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/synchronize_smart_ag_web_config.go index f19f39cc144..3bcbba4d79f 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/synchronize_smart_ag_web_config.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/synchronize_smart_ag_web_config.go @@ -71,12 +71,12 @@ func (client *Client) SynchronizeSmartAGWebConfigWithCallback(request *Synchroni // SynchronizeSmartAGWebConfigRequest is the request struct for api SynchronizeSmartAGWebConfig type SynchronizeSmartAGWebConfigRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - SmartAGSn string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + SmartAGSn string `position:"Query" name:"SmartAGSn"` } // SynchronizeSmartAGWebConfigResponse is the response struct for api SynchronizeSmartAGWebConfig diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/unbind_serial_number.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/unbind_serial_number.go index 719c70469ae..eb365d47f43 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/unbind_serial_number.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/unbind_serial_number.go @@ -71,12 +71,12 @@ func (client *Client) UnbindSerialNumberWithCallback(request *UnbindSerialNumber // UnbindSerialNumberRequest is the request struct for api UnbindSerialNumber type UnbindSerialNumberRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - SerialNumber string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + SerialNumber string `position:"Query" name:"SerialNumber"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // UnbindSerialNumberResponse is the response struct for api UnbindSerialNumber diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/unbind_smart_access_gateway.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/unbind_smart_access_gateway.go index 7e649c65740..a58cf5ec936 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/unbind_smart_access_gateway.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/unbind_smart_access_gateway.go @@ -71,13 +71,13 @@ func (client *Client) UnbindSmartAccessGatewayWithCallback(request *UnbindSmartA // UnbindSmartAccessGatewayRequest is the request struct for api UnbindSmartAccessGateway type UnbindSmartAccessGatewayRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - CcnId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGUid requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + CcnId string `position:"Query" name:"CcnId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGUid requests.Integer `position:"Query" name:"SmartAGUid"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // UnbindSmartAccessGatewayResponse is the response struct for api UnbindSmartAccessGateway diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/unbind_vbr.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/unbind_vbr.go index 876552ce03a..b0e589eb9cf 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/unbind_vbr.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/unbind_vbr.go @@ -71,14 +71,14 @@ func (client *Client) UnbindVbrWithCallback(request *UnbindVbrRequest, callback // UnbindVbrRequest is the request struct for api UnbindVbr type UnbindVbrRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - VbrId string `position:"Query"` - VbrRegionId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGUid requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + VbrId string `position:"Query" name:"VbrId"` + VbrRegionId string `position:"Query" name:"VbrRegionId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGUid requests.Integer `position:"Query" name:"SmartAGUid"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // UnbindVbrResponse is the response struct for api UnbindVbr diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/unicom_order_confirm.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/unicom_order_confirm.go deleted file mode 100644 index 951001e074c..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/unicom_order_confirm.go +++ /dev/null @@ -1,123 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// UnicomOrderConfirm invokes the smartag.UnicomOrderConfirm API synchronously -func (client *Client) UnicomOrderConfirm(request *UnicomOrderConfirmRequest) (response *UnicomOrderConfirmResponse, err error) { - response = CreateUnicomOrderConfirmResponse() - err = client.DoAction(request, response) - return -} - -// UnicomOrderConfirmWithChan invokes the smartag.UnicomOrderConfirm API asynchronously -func (client *Client) UnicomOrderConfirmWithChan(request *UnicomOrderConfirmRequest) (<-chan *UnicomOrderConfirmResponse, <-chan error) { - responseChan := make(chan *UnicomOrderConfirmResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.UnicomOrderConfirm(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// UnicomOrderConfirmWithCallback invokes the smartag.UnicomOrderConfirm API asynchronously -func (client *Client) UnicomOrderConfirmWithCallback(request *UnicomOrderConfirmRequest, callback func(response *UnicomOrderConfirmResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *UnicomOrderConfirmResponse - var err error - defer close(result) - response, err = client.UnicomOrderConfirm(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// UnicomOrderConfirmRequest is the request struct for api UnicomOrderConfirm -type UnicomOrderConfirmRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - TmsCode string `position:"Query"` - OrderItem *[]UnicomOrderConfirmOrderItem `position:"Query" name:"OrderItem" type:"Repeated"` - OrderPostFee requests.Integer `position:"Query"` - TradeId string `position:"Query"` - OwnerUserId string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - TmsOrderCode string `position:"Query"` -} - -// UnicomOrderConfirmOrderItem is a repeated param struct in UnicomOrderConfirmRequest -type UnicomOrderConfirmOrderItem struct { - ScItemName string `name:"ScItemName"` - ItemAmount string `name:"ItemAmount"` - SnList *[]string `name:"SnList" type:"Repeated"` - OrderItemId string `name:"OrderItemId"` - ScItemCode string `name:"ScItemCode"` - ItemQuantity string `name:"ItemQuantity"` - TradeId string `name:"TradeId"` - TradeItemId string `name:"TradeItemId"` -} - -// UnicomOrderConfirmResponse is the response struct for api UnicomOrderConfirm -type UnicomOrderConfirmResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Message string `json:"Message" xml:"Message"` - Code string `json:"Code" xml:"Code"` - Success bool `json:"Success" xml:"Success"` -} - -// CreateUnicomOrderConfirmRequest creates a request to invoke UnicomOrderConfirm API -func CreateUnicomOrderConfirmRequest() (request *UnicomOrderConfirmRequest) { - request = &UnicomOrderConfirmRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Smartag", "2018-03-13", "UnicomOrderConfirm", "smartag", "openAPI") - request.Method = requests.POST - return -} - -// CreateUnicomOrderConfirmResponse creates a response to parse from UnicomOrderConfirm response -func CreateUnicomOrderConfirmResponse() (response *UnicomOrderConfirmResponse) { - response = &UnicomOrderConfirmResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/unicom_sign_confirm.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/unicom_sign_confirm.go deleted file mode 100644 index ddd62a469df..00000000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/unicom_sign_confirm.go +++ /dev/null @@ -1,114 +0,0 @@ -package smartag - -//Licensed under the Apache License, Version 2.0 (the "License"); -//you may not use this file except in compliance with the License. -//You may obtain a copy of the License at -// -//http://www.apache.org/licenses/LICENSE-2.0 -// -//Unless required by applicable law or agreed to in writing, software -//distributed under the License is distributed on an "AS IS" BASIS, -//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//See the License for the specific language governing permissions and -//limitations under the License. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// UnicomSignConfirm invokes the smartag.UnicomSignConfirm API synchronously -func (client *Client) UnicomSignConfirm(request *UnicomSignConfirmRequest) (response *UnicomSignConfirmResponse, err error) { - response = CreateUnicomSignConfirmResponse() - err = client.DoAction(request, response) - return -} - -// UnicomSignConfirmWithChan invokes the smartag.UnicomSignConfirm API asynchronously -func (client *Client) UnicomSignConfirmWithChan(request *UnicomSignConfirmRequest) (<-chan *UnicomSignConfirmResponse, <-chan error) { - responseChan := make(chan *UnicomSignConfirmResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.UnicomSignConfirm(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// UnicomSignConfirmWithCallback invokes the smartag.UnicomSignConfirm API asynchronously -func (client *Client) UnicomSignConfirmWithCallback(request *UnicomSignConfirmRequest, callback func(response *UnicomSignConfirmResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *UnicomSignConfirmResponse - var err error - defer close(result) - response, err = client.UnicomSignConfirm(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// UnicomSignConfirmRequest is the request struct for api UnicomSignConfirm -type UnicomSignConfirmRequest struct { - *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - TmsOrder *[]UnicomSignConfirmTmsOrder `position:"Query" name:"TmsOrder" type:"Repeated"` - OwnerId requests.Integer `position:"Query"` -} - -// UnicomSignConfirmTmsOrder is a repeated param struct in UnicomSignConfirmRequest -type UnicomSignConfirmTmsOrder struct { - TmsCode string `name:"TmsCode"` - SigningTime string `name:"SigningTime"` - TmsOrderCode string `name:"TmsOrderCode"` - TradeId string `name:"TradeId"` -} - -// UnicomSignConfirmResponse is the response struct for api UnicomSignConfirm -type UnicomSignConfirmResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - Message string `json:"Message" xml:"Message"` - Code string `json:"Code" xml:"Code"` - Success bool `json:"Success" xml:"Success"` -} - -// CreateUnicomSignConfirmRequest creates a request to invoke UnicomSignConfirm API -func CreateUnicomSignConfirmRequest() (request *UnicomSignConfirmRequest) { - request = &UnicomSignConfirmRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Smartag", "2018-03-13", "UnicomSignConfirm", "smartag", "openAPI") - request.Method = requests.POST - return -} - -// CreateUnicomSignConfirmResponse creates a response to parse from UnicomSignConfirm response -func CreateUnicomSignConfirmResponse() (response *UnicomSignConfirmResponse) { - response = &UnicomSignConfirmResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/unlock_smart_access_gateway.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/unlock_smart_access_gateway.go index 41c9bc87742..b5a5f3b23cc 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/unlock_smart_access_gateway.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/unlock_smart_access_gateway.go @@ -71,11 +71,11 @@ func (client *Client) UnlockSmartAccessGatewayWithCallback(request *UnlockSmartA // UnlockSmartAccessGatewayRequest is the request struct for api UnlockSmartAccessGateway type UnlockSmartAccessGatewayRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // UnlockSmartAccessGatewayResponse is the response struct for api UnlockSmartAccessGateway diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/update_enterprise_code.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/update_enterprise_code.go index 75fc40db67e..6fd001b5803 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/update_enterprise_code.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/update_enterprise_code.go @@ -71,10 +71,10 @@ func (client *Client) UpdateEnterpriseCodeWithCallback(request *UpdateEnterprise // UpdateEnterpriseCodeRequest is the request struct for api UpdateEnterpriseCode type UpdateEnterpriseCodeRequest struct { *requests.RpcRequest - ClientToken string `position:"Query"` - EnterpriseCode string `position:"Query"` - IsDefault requests.Boolean `position:"Query"` - DryRun requests.Boolean `position:"Query"` + ClientToken string `position:"Query" name:"ClientToken"` + EnterpriseCode string `position:"Query" name:"EnterpriseCode"` + IsDefault requests.Boolean `position:"Query" name:"IsDefault"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` } // UpdateEnterpriseCodeResponse is the response struct for api UpdateEnterpriseCode diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/update_smart_access_gateway_version.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/update_smart_access_gateway_version.go index 94f91d05492..ab7290f4695 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/update_smart_access_gateway_version.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/update_smart_access_gateway_version.go @@ -71,14 +71,14 @@ func (client *Client) UpdateSmartAccessGatewayVersionWithCallback(request *Updat // UpdateSmartAccessGatewayVersionRequest is the request struct for api UpdateSmartAccessGatewayVersion type UpdateSmartAccessGatewayVersionRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - VersionCode string `position:"Query"` - SerialNumber string `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - VersionType string `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + VersionCode string `position:"Query" name:"VersionCode"` + SerialNumber string `position:"Query" name:"SerialNumber"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + VersionType string `position:"Query" name:"VersionType"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // UpdateSmartAccessGatewayVersionResponse is the response struct for api UpdateSmartAccessGatewayVersion diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/update_smart_ag_access_point.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/update_smart_ag_access_point.go index 579afbefa0c..2eb0240bb5d 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/update_smart_ag_access_point.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/update_smart_ag_access_point.go @@ -71,12 +71,12 @@ func (client *Client) UpdateSmartAGAccessPointWithCallback(request *UpdateSmartA // UpdateSmartAGAccessPointRequest is the request struct for api UpdateSmartAGAccessPoint type UpdateSmartAGAccessPointRequest struct { *requests.RpcRequest - AccessPointId requests.Integer `position:"Query"` - ResourceOwnerId requests.Integer `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + AccessPointId requests.Integer `position:"Query" name:"AccessPointId"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // UpdateSmartAGAccessPointResponse is the response struct for api UpdateSmartAGAccessPoint diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/update_smart_ag_dpi_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/update_smart_ag_dpi_attribute.go index 9da21c7bd38..44d315e679d 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/update_smart_ag_dpi_attribute.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/update_smart_ag_dpi_attribute.go @@ -71,14 +71,14 @@ func (client *Client) UpdateSmartAGDpiAttributeWithCallback(request *UpdateSmart // UpdateSmartAGDpiAttributeRequest is the request struct for api UpdateSmartAGDpiAttribute type UpdateSmartAGDpiAttributeRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - ClientToken string `position:"Query"` - DpiEnabled requests.Boolean `position:"Query"` - DryRun requests.Boolean `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + ClientToken string `position:"Query" name:"ClientToken"` + DpiEnabled requests.Boolean `position:"Query" name:"DpiEnabled"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // UpdateSmartAGDpiAttributeResponse is the response struct for api UpdateSmartAGDpiAttribute diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/update_smart_ag_enterprise_code.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/update_smart_ag_enterprise_code.go index f8077a44d48..8704bfbface 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/update_smart_ag_enterprise_code.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/update_smart_ag_enterprise_code.go @@ -71,10 +71,10 @@ func (client *Client) UpdateSmartAGEnterpriseCodeWithCallback(request *UpdateSma // UpdateSmartAGEnterpriseCodeRequest is the request struct for api UpdateSmartAGEnterpriseCode type UpdateSmartAGEnterpriseCodeRequest struct { *requests.RpcRequest - ClientToken string `position:"Query"` - EnterpriseCode string `position:"Query"` - DryRun requests.Boolean `position:"Query"` - SmartAGId string `position:"Query"` + ClientToken string `position:"Query" name:"ClientToken"` + EnterpriseCode string `position:"Query" name:"EnterpriseCode"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + SmartAGId string `position:"Query" name:"SmartAGId"` } // UpdateSmartAGEnterpriseCodeResponse is the response struct for api UpdateSmartAGEnterpriseCode diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/upgrade_smart_access_gateway.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/upgrade_smart_access_gateway.go index 174eb5d0089..932ec3ed4e4 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/upgrade_smart_access_gateway.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/upgrade_smart_access_gateway.go @@ -71,15 +71,15 @@ func (client *Client) UpgradeSmartAccessGatewayWithCallback(request *UpgradeSmar // UpgradeSmartAccessGatewayRequest is the request struct for api UpgradeSmartAccessGateway type UpgradeSmartAccessGatewayRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - BandWidthSpec requests.Integer `position:"Query"` - UserCount requests.Integer `position:"Query"` - AutoPay requests.Boolean `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - DataPlan requests.Integer `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + BandWidthSpec requests.Integer `position:"Query" name:"BandWidthSpec"` + UserCount requests.Integer `position:"Query" name:"UserCount"` + AutoPay requests.Boolean `position:"Query" name:"AutoPay"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + DataPlan requests.Integer `position:"Query" name:"DataPlan"` } // UpgradeSmartAccessGatewayResponse is the response struct for api UpgradeSmartAccessGateway diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/upgrade_smart_access_gateway_software.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/upgrade_smart_access_gateway_software.go index 2a85166e64c..69effb7ce8a 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/upgrade_smart_access_gateway_software.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/smartag/upgrade_smart_access_gateway_software.go @@ -71,14 +71,14 @@ func (client *Client) UpgradeSmartAccessGatewaySoftwareWithCallback(request *Upg // UpgradeSmartAccessGatewaySoftwareRequest is the request struct for api UpgradeSmartAccessGatewaySoftware type UpgradeSmartAccessGatewaySoftwareRequest struct { *requests.RpcRequest - ResourceOwnerId requests.Integer `position:"Query"` - UserCount requests.Integer `position:"Query"` - AutoPay requests.Boolean `position:"Query"` - ResourceOwnerAccount string `position:"Query"` - OwnerAccount string `position:"Query"` - OwnerId requests.Integer `position:"Query"` - SmartAGId string `position:"Query"` - DataPlan requests.Integer `position:"Query"` + ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` + UserCount requests.Integer `position:"Query" name:"UserCount"` + AutoPay requests.Boolean `position:"Query" name:"AutoPay"` + ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` + OwnerAccount string `position:"Query" name:"OwnerAccount"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + SmartAGId string `position:"Query" name:"SmartAGId"` + DataPlan requests.Integer `position:"Query" name:"DataPlan"` } // UpgradeSmartAccessGatewaySoftwareResponse is the response struct for api UpgradeSmartAccessGatewaySoftware diff --git a/vendor/github.com/aliyun/aliyun-log-go-sdk/.gitignore b/vendor/github.com/aliyun/aliyun-log-go-sdk/.gitignore new file mode 100644 index 00000000000..485dee64bcf --- /dev/null +++ b/vendor/github.com/aliyun/aliyun-log-go-sdk/.gitignore @@ -0,0 +1 @@ +.idea diff --git a/vendor/github.com/aliyun/aliyun-log-go-sdk/client_alert.go b/vendor/github.com/aliyun/aliyun-log-go-sdk/client_alert.go index 16a7f8c318c..989e798222b 100644 --- a/vendor/github.com/aliyun/aliyun-log-go-sdk/client_alert.go +++ b/vendor/github.com/aliyun/aliyun-log-go-sdk/client_alert.go @@ -30,6 +30,38 @@ const ( NotificationTypeMessageCenter = "MessageCenter" ) +const ( + CountConditionKey = "__count__" +) + +type Severity int + +const ( + Report Severity = 2 + Low Severity = 4 + Medium Severity = 6 + High Severity = 8 + Critical Severity = 10 +) + +const ( + JoinTypeCross = "cross_join" + JoinTypeInner = "inner_join" + JoinTypeLeft = "left_join" + JoinTypeRight = "right_join" + JoinTypeFull = "full_join" + JoinTypeLeftExclude = "left_exclude" + JoinTypeRightExclude = "right_exclude" + JoinTypeConcat = "concat" + JoinTypeNo = "no_join" +) + +const ( + GroupTypeNoGroup = "no_group" + GroupTypeLabelsAuto = "labels_auto" + GroupTypeCustom = "custom" +) + const ( ScheduleTypeFixedRate = "FixedRate" ScheduleTypeHourly = "Hourly" @@ -40,6 +72,63 @@ const ( ScheduleTypeResident = "Resident" ) +const ( + StoreTypeLog = "log" + StoreTypeMetric = "metric" + StoreTypeMeta = "meta" +) + +// SeverityConfiguration severity config by group +type SeverityConfiguration struct { + Severity Severity `json:"severity"` + EvalCondition ConditionConfiguration `json:"evalCondition"` +} + +type ConditionConfiguration struct { + Condition string `json:"condition"` + CountCondition string `json:"countCondition"` +} + +type JoinConfiguration struct { + Type string `json:"type"` + Condition string `json:"condition"` +} + +type GroupConfiguration struct { + Type string `json:"type"` + Fields []string `json:"fields"` +} + +type Tag struct { + Key string `json:"key"` + Value string `json:"value"` +} + +type Token struct { + Name string `json:"name"` + DisplayName string `json:"display_name"` + Required bool `json:"required"` + Type string `json:"type"` + Default string `json:"default"` + Hide bool `json:"hide"` +} + +type TemplateConfiguration struct { + Id string `json:"id"` + Type string `json:"type"` + Version string `json:"version"` + Lang string `json:"lang"` + Tokens map[string]string `json:"tokens"` + Annotations map[string]string `json:"annotations"` +} + +type PolicyConfiguration struct { + UseDefault bool `json:"useDefault"` + RepeatInterval string `json:"repeatInterval"` + AlertPolicyId string `json:"alertPolicyId"` + ActionPolicyId string `json:"actionPolicyId"` +} + type Alert struct { Name string `json:"name"` DisplayName string `json:"displayName"` @@ -66,16 +155,6 @@ func (alert *Alert) MarshalJSON() ([]byte, error) { return json.Marshal(body) } -type AlertConfiguration struct { - Condition string `json:"condition"` - Dashboard string `json:"dashboard"` - QueryList []*AlertQuery `json:"queryList"` - MuteUntil int64 `json:"muteUntil"` - NotificationList []*Notification `json:"notificationList"` - NotifyThreshold int32 `json:"notifyThreshold"` - Throttling string `json:"throttling"` -} - type AlertQuery struct { ChartTitle string `json:"chartTitle"` LogStore string `json:"logStore"` @@ -83,6 +162,13 @@ type AlertQuery struct { TimeSpanType string `json:"timeSpanType"` Start string `json:"start"` End string `json:"end"` + + StoreType string `json:"storeType"` + Project string `json:"project"` + Store string `json:"store"` + Region string `json:"region"` + RoleArn string `json:"roleArn"` + DashboardId string `json:"dashboardId"` } type Notification struct { @@ -104,6 +190,33 @@ type Schedule struct { Hour int32 `json:"hour"` } +type AlertConfiguration struct { + Condition string `json:"condition"` + MuteUntil int64 `json:"muteUntil"` + NotificationList []*Notification `json:"notificationList"` + NotifyThreshold int32 `json:"notifyThreshold"` + Throttling string `json:"throttling"` + + Version string `json:"version"` + Type string `json:"type"` + TemplateConfiguration *TemplateConfiguration `json:"templateConfiguration"` + + Dashboard string `json:"dashboard"` + Threshold int `json:"threshold"` + NoDataFire bool `json:"noDataFire"` + NoDataSeverity Severity `json:"noDataSeverity"` + SendResolved bool `json:"sendResolved"` + QueryList []*AlertQuery `json:"queryList"` + Annotations []*Tag `json:"annotations"` + Labels []*Tag `json:"labels"` + SeverityConfigurations []*SeverityConfiguration `json:"severityConfigurations"` + + JoinConfigurations []*JoinConfiguration `json:"joinConfigurations"` + GroupConfiguration GroupConfiguration `json:"groupConfiguration"` + + PolicyConfiguration PolicyConfiguration `json:"policyConfiguration"` +} + func (c *Client) CreateSavedSearch(project string, savedSearch *SavedSearch) error { body, err := json.Marshal(savedSearch) if err != nil { diff --git a/vendor/github.com/aliyun/aliyun-log-go-sdk/client_alert_resource.go b/vendor/github.com/aliyun/aliyun-log-go-sdk/client_alert_resource.go new file mode 100644 index 00000000000..80612aecfbe --- /dev/null +++ b/vendor/github.com/aliyun/aliyun-log-go-sdk/client_alert_resource.go @@ -0,0 +1,120 @@ +package sls + +import "encoding/json" + +const ( + ResourceNameAlertPolicy = "sls.alert.alert_policy" + ResourceNameActionPolicy = "sls.alert.action_policy" + ResourceNameUser = "sls.common.user" + ResourceNameUserGroup = "sls.common.user_group" + ResourceNameContentTemplate = "sls.alert.content_template" + ResourceNameGlobalConfig = "sls.alert.global_config" + ResourceNameWebhookIntegration = "sls.alert.webhook_application" +) + +type ( + // Notified users. + ResourceUser struct { + UserId string `json:"user_id"` + UserName string `json:"user_name"` + Enabled bool `json:"enabled"` + CountryCode string `json:"country_code"` + Phone string `json:"phone"` + Email []string `json:"email"` + SmsEnabled bool `json:"sms_enabled"` + VoiceEnabled bool `json:"voice_enabled"` + } + + // ResourceUserGroup is a collection of users. + ResourceUserGroup struct { + Id string `json:"user_group_id"` + Name string `json:"user_group_name"` + Enabled bool `json:"enabled"` + Members []string `json:"members"` + } + + // ResourceAlertPolicy defines how alerts should be grouped, inhibited and silenced. + ResourceAlertPolicy struct { + PolicyId string `json:"policy_id"` + PolicyName string `json:"policy_name"` + Parent string `json:"parent_id"` + IsDefault bool `json:"is_default"` + GroupPolicy string `json:"group_script"` + InhibitPolicy string `json:"inhibit_script"` + SilencePolicy string `json:"silence_script"` + } + + // ResourceActionPolicy defines how to send alert notifications. + ResourceActionPolicy struct { + ActionPolicyId string `json:"action_policy_id"` + ActionPolicyName string `json:"action_policy_name"` + IsDefault bool `json:"is_default"` + PrimaryPolicyScript string `json:"primary_policy_script"` + SecondaryPolicyScript string `json:"secondary_policy_script"` + EscalationStartEnabled bool `json:"escalation_start_enabled"` + EscalationStartTimeout string `json:"escalation_start_timeout"` + EscalationInprogressEnabled bool `json:"escalation_inprogress_enabled"` + EscalationInprogressTimeout string `json:"escalation_inprogress_timeout"` + EscalationEnabled bool `json:"escalation_enabled"` + EscalationTimeout string `json:"escalation_timeout"` + Labels map[string]string `json:"labels"` + } + + // ContentTemplate + ResourceTemplate struct { + Content string `json:"content"` + Locale string `json:"locale"` + Title string `json:"title"` + Subject string `json:"subject"` + SendType string `json:"send_type"` + Limit int `json:"limit"` + } + + ResourceTemplates struct { + Sms ResourceTemplate `json:"sms"` + Voice ResourceTemplate `json:"voice"` + Email ResourceTemplate `json:"email"` + Dingtalk ResourceTemplate `json:"dingtalk"` + Webhook ResourceTemplate `json:"webhook"` + MessageCenter ResourceTemplate `json:"message_center"` + Wechat ResourceTemplate `json:"wechat"` + Lark ResourceTemplate `json:"lark"` + Slack ResourceTemplate `json:"slack"` + } + ResourceContentTemplate struct { + TemplateId string `json:"template_id"` + TemplateName string `json:"template_name"` + IsDefault bool `json:"is_default"` + Templates ResourceTemplates `json:"templates"` + } + + // WebhookIntegration is a wrap of webhook notification config. + ResourceWebhookHeader struct { + Key string `json:"key"` + Value string `json:"value"` + } + WebhookIntegration struct { + Id string `json:"id"` + Name string `json:"name"` + Method string `json:"method"` + Url string `json:"url"` + Type string `json:"type"` + Headers []*ResourceWebhookHeader `json:"headers"` + } + + // GlobalConfig is the global configuration for alerts. + GlobalConfig struct { + ConfigId string `json:"config_id"` + ConfigName string `json:"config_name"` + ConfigDetail struct { + AlertCenterLog struct { + Region string `json:"region"` + } `json:"alert_center_log"` + } `json:"config_detail"` + } +) + +func JsonMarshal(v interface{}) string { + vBytes, _ := json.Marshal(v) + return string(vBytes) +} diff --git a/vendor/github.com/aliyun/aliyun-log-go-sdk/client_interface.go b/vendor/github.com/aliyun/aliyun-log-go-sdk/client_interface.go index 4dc46c56949..80556dbf788 100644 --- a/vendor/github.com/aliyun/aliyun-log-go-sdk/client_interface.go +++ b/vendor/github.com/aliyun/aliyun-log-go-sdk/client_interface.go @@ -189,6 +189,9 @@ type ClientInterface interface { GetLogLines(project, logstore string, topic string, from int64, to int64, queryExp string, maxLineNum int64, offset int64, reverse bool) (*GetLogLinesResponse, error) + GetLogsV2(project, logstore string, req *GetLogRequest) (*GetLogsResponse, error) + GetLogLinesV2(project, logstore string, req *GetLogRequest) (*GetLogLinesResponse, error) + // #################### Index Operations ##################### // CreateIndex ... CreateIndex(project, logstore string, index Index) error @@ -258,4 +261,32 @@ type ClientInterface interface { resourceIDs []string, tags []ResourceFilterTag, nextToken string) (respTags []*ResourceTagResponse, respNextToken string, err error) + CreateScheduledSQL(project string, scheduledsql *ScheduledSQL) error + DeleteScheduledSQL(project string, name string) error + UpdateScheduledSQL(project string, scheduledsql *ScheduledSQL) error + GetScheduledSQL(project string, name string) (*ScheduledSQL, error) + ListScheduledSQL(project, name, displayName string, offset, size int) ([]*ScheduledSQL, int, int, error) + GetScheduledSQLJobInstance(projectName, jobName, instanceId string, result bool) (instance *ScheduledSQLJobInstance, err error) + ModifyScheduledSQLJobInstanceState(projectName, jobName, instanceId string, state ScheduledSQLState) error + ListScheduledSQLJobInstances(projectName, jobName string, status *InstanceStatus) (instances []*ScheduledSQLJobInstance, total, count int64, err error) + + // #################### Resource Operations ##################### + ListResource(resourceType string, resourceName string, offset, size int) (resourceList []*Resource, count, total int, err error) + GetResource(name string) (resource *Resource, err error) + GetResourceString(name string) (resource string, err error) + DeleteResource(name string) error + UpdateResource(resource *Resource) error + UpdateResourceString(resourceName, resourceStr string) error + CreateResource(resource *Resource) error + CreateResourceString(resourceStr string) error + + // #################### Resource Record Operations ##################### + ListResourceRecord(resourceName string, offset, size int) (recordList []*ResourceRecord, count, total int, err error) + GetResourceRecord(resourceName, recordId string) (record *ResourceRecord, err error) + GetResourceRecordString(resourceName, name string) (record string, err error) + DeleteResourceRecord(resourceName, recordId string) error + UpdateResourceRecord(resourceName string, record *ResourceRecord) error + UpdateResourceRecordString(resourceName, recordStr string) error + CreateResourceRecord(resourceName string, record *ResourceRecord) error + CreateResourceRecordString(resourceName, recordStr string) error } diff --git a/vendor/github.com/aliyun/aliyun-log-go-sdk/client_request.go b/vendor/github.com/aliyun/aliyun-log-go-sdk/client_request.go index b5ec325aa0b..6eb45c48227 100644 --- a/vendor/github.com/aliyun/aliyun-log-go-sdk/client_request.go +++ b/vendor/github.com/aliyun/aliyun-log-go-sdk/client_request.go @@ -37,7 +37,7 @@ func (c *Client) request(project, method, uri string, headers map[string]string, // SLS public request headers var hostStr string if len(project) == 0 { - hostStr = project + hostStr = endpoint } else { hostStr = project + "." + endpoint } diff --git a/vendor/github.com/aliyun/aliyun-log-go-sdk/client_resource.go b/vendor/github.com/aliyun/aliyun-log-go-sdk/client_resource.go new file mode 100644 index 00000000000..ed5c1ce14ce --- /dev/null +++ b/vendor/github.com/aliyun/aliyun-log-go-sdk/client_resource.go @@ -0,0 +1,191 @@ +package sls + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "strconv" +) + +const ResourceTypeUserDefine = "userdefine" + +type Resource struct { + Name string `json:"name"` + Type string `json:"type"` + Schema string `json:"schema"` + Description string `json:"description"` + ExtInfo string `json:"extInfo"` + CreateTime int64 `json:"createTime"` + LastModifyTime int64 `json:"lastModifyTime"` +} + +type ResourceSchema struct { + Schema []*ResourceSchemaItem `json:"schema"` +} + +type ResourceSchemaItem struct { + Column string `json:"column"` + Desc string `json:"desc"` + ExtInfo interface{} `json:"ext_info"` + Required bool `json:"required"` + Type string `json:"type"` +} + +func (rs *ResourceSchema) ToString() string { + rsBytes, _ := json.Marshal(rs) + return string(rsBytes) +} + +func (rs *ResourceSchema) FromJsonString(schema string) error { + return json.Unmarshal([]byte(schema), rs) +} + +func (c *Client) CreateResourceString(resourceStr string) error { + body := []byte(resourceStr) + + h := map[string]string{ + "x-log-bodyrawsize": fmt.Sprintf("%v", len(body)), + "Content-Type": "application/json", + } + + uri := "/resources" + r, err := c.request("", "POST", uri, h, body) + if err != nil { + return err + } + r.Body.Close() + return nil +} + +func (c *Client) CreateResource(resource *Resource) error { + body, err := json.Marshal(resource) + if err != nil { + return NewClientError(err) + } + + h := map[string]string{ + "x-log-bodyrawsize": fmt.Sprintf("%v", len(body)), + "Content-Type": "application/json", + } + + uri := "/resources" + r, err := c.request("", "POST", uri, h, body) + if err != nil { + return err + } + r.Body.Close() + return nil +} + +func (c *Client) UpdateResource(resource *Resource) error { + body, err := json.Marshal(resource) + if err != nil { + return NewClientError(err) + } + + h := map[string]string{ + "x-log-bodyrawsize": fmt.Sprintf("%v", len(body)), + "Content-Type": "application/json", + } + + uri := "/resources/" + resource.Name + r, err := c.request("", "PUT", uri, h, body) + if err != nil { + return err + } + r.Body.Close() + return nil +} + +func (c *Client) UpdateResourceString(resourceName, resourceStr string) error { + body := []byte(resourceStr) + + h := map[string]string{ + "x-log-bodyrawsize": fmt.Sprintf("%v", len(body)), + "Content-Type": "application/json", + } + + uri := "/resources/" + resourceName + r, err := c.request("", "PUT", uri, h, body) + if err != nil { + return err + } + r.Body.Close() + return nil +} + +func (c *Client) DeleteResource(name string) error { + h := map[string]string{ + "x-log-bodyrawsize": "0", + "Content-Type": "application/json", + } + + uri := "/resources/" + name + r, err := c.request("", "DELETE", uri, h, nil) + if err != nil { + return err + } + r.Body.Close() + return nil +} + +func (c *Client) GetResource(name string) (resource *Resource, err error) { + h := map[string]string{ + "x-log-bodyrawsize": "0", + "Content-Type": "application/json", + } + uri := "/resources/" + name + r, err := c.request("", "GET", uri, h, nil) + if err != nil { + return nil, err + } + defer r.Body.Close() + buf, _ := ioutil.ReadAll(r.Body) + resource = &Resource{} + if err = json.Unmarshal(buf, resource); err != nil { + err = NewClientError(err) + } + return resource, err +} + +func (c *Client) GetResourceString(name string) (resource string, err error) { + h := map[string]string{ + "x-log-bodyrawsize": "0", + "Content-Type": "application/json", + } + uri := "/resources/" + name + r, err := c.request("", "GET", uri, h, nil) + if err != nil { + return "", err + } + defer r.Body.Close() + buf, err := ioutil.ReadAll(r.Body) + return string(buf), err +} + +func (c *Client) ListResource(resourceType string, resourceName string, offset, size int) (resourceList []*Resource, count, total int, err error) { + h := map[string]string{ + "x-log-bodyrawsize": "0", + "Content-Type": "application/json", + "offset": strconv.Itoa(offset), + "size": strconv.Itoa(size), + } + uri := fmt.Sprintf("/resources?type=%s&names=%s", resourceType, resourceName) + r, err := c.request("", "GET", uri, h, nil) + if err != nil { + return nil, 0, 0, err + } + defer r.Body.Close() + type ListResourceResponse struct { + ResourceList []*Resource `json:"items"` + Total int `json:"total"` + Count int `json:"count"` + } + + buf, _ := ioutil.ReadAll(r.Body) + resources := &ListResourceResponse{} + if err = json.Unmarshal(buf, resources); err != nil { + err = NewClientError(err) + } + return resources.ResourceList, resources.Count, resources.Total, err +} diff --git a/vendor/github.com/aliyun/aliyun-log-go-sdk/client_resource_record.go b/vendor/github.com/aliyun/aliyun-log-go-sdk/client_resource_record.go new file mode 100644 index 00000000000..8239baedc7d --- /dev/null +++ b/vendor/github.com/aliyun/aliyun-log-go-sdk/client_resource_record.go @@ -0,0 +1,166 @@ +package sls + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "strconv" +) + +type ResourceRecord struct { + Id string `json:"id"` + Tag string `json:"tag"` + Value string `json:"value"` + CreateTime int64 `json:"createTime"` + LastModifyTime int64 `json:"lastModifyTime"` +} + +func (c *Client) CreateResourceRecordString(resourceName, recordStr string) error { + body := []byte(recordStr) + + h := map[string]string{ + "x-log-bodyrawsize": fmt.Sprintf("%v", len(body)), + "Content-Type": "application/json", + } + + uri := fmt.Sprintf("/resources/%s/records", resourceName) + r, err := c.request("", "POST", uri, h, body) + if err != nil { + return err + } + r.Body.Close() + return nil +} + +func (c *Client) CreateResourceRecord(resourceName string, record *ResourceRecord) error { + body, err := json.Marshal(record) + if err != nil { + return NewClientError(err) + } + + h := map[string]string{ + "x-log-bodyrawsize": fmt.Sprintf("%v", len(body)), + "Content-Type": "application/json", + } + uri := fmt.Sprintf("/resources/%s/records", resourceName) + r, err := c.request("", "POST", uri, h, body) + if err != nil { + return err + } + r.Body.Close() + return nil +} + +func (c *Client) UpdateResourceRecord(resourceName string, record *ResourceRecord) error { + body, err := json.Marshal(record) + if err != nil { + return NewClientError(err) + } + + h := map[string]string{ + "x-log-bodyrawsize": fmt.Sprintf("%v", len(body)), + "Content-Type": "application/json", + } + + uri := fmt.Sprintf("/resources/%s/records/%s", resourceName, record.Id) + r, err := c.request("", "PUT", uri, h, body) + if err != nil { + return err + } + r.Body.Close() + return nil +} + +func (c *Client) UpdateResourceRecordString(resourceName, recordStr string) error { + body := []byte(recordStr) + + h := map[string]string{ + "x-log-bodyrawsize": fmt.Sprintf("%v", len(body)), + "Content-Type": "application/json", + } + + uri := fmt.Sprintf("/resources/%s/records", resourceName) + r, err := c.request("", "PUT", uri, h, body) + if err != nil { + return err + } + r.Body.Close() + return nil +} + +func (c *Client) DeleteResourceRecord(resourceName, recordId string) error { + + h := map[string]string{ + "x-log-bodyrawsize": "0", + "Content-Type": "application/json", + } + + uri := fmt.Sprintf("/resources/%s/records?ids=%s", resourceName, recordId) + r, err := c.request("", "DELETE", uri, h, nil) + if err != nil { + return err + } + r.Body.Close() + return nil +} + +func (c *Client) GetResourceRecord(resourceName, recordId string) (record *ResourceRecord, err error) { + h := map[string]string{ + "x-log-bodyrawsize": "0", + "Content-Type": "application/json", + } + uri := fmt.Sprintf("/resources/%s/records/%s", resourceName, recordId) + r, err := c.request("", "GET", uri, h, nil) + if err != nil { + return nil, err + } + defer r.Body.Close() + buf, _ := ioutil.ReadAll(r.Body) + record = &ResourceRecord{} + if err = json.Unmarshal(buf, record); err != nil { + err = NewClientError(err) + } + return record, err +} + +func (c *Client) GetResourceRecordString(resourceName, recordId string) (recordStr string, err error) { + h := map[string]string{ + "x-log-bodyrawsize": "0", + "Content-Type": "application/json", + } + uri := fmt.Sprintf("/resources/%s/records/%s", resourceName, recordId) + r, err := c.request("", "GET", uri, h, nil) + if err != nil { + return "", err + } + defer r.Body.Close() + buf, err := ioutil.ReadAll(r.Body) + return string(buf), err +} + +func (c *Client) ListResourceRecord(resourceName string, offset, size int) (recordList []*ResourceRecord, count, total int, err error) { + h := map[string]string{ + "x-log-bodyrawsize": "0", + "Content-Type": "application/json", + "offset": strconv.Itoa(offset), + "size": strconv.Itoa(size), + } + uri := fmt.Sprintf("/resources/%s/records", resourceName) + r, err := c.request("", "GET", uri, h, nil) + if err != nil { + return nil, 0, 0, err + } + defer r.Body.Close() + type ListResourceRecordResponse struct { + ResourceRecordList []*ResourceRecord `json:"items"` + Total int `json:"total"` + Count int `json:"count"` + } + + buf, _ := ioutil.ReadAll(r.Body) + resources := &ListResourceRecordResponse{} + if err = json.Unmarshal(buf, resources); err != nil { + err = NewClientError(err) + } + return resources.ResourceRecordList, resources.Count, resources.Total, err +} diff --git a/vendor/github.com/aliyun/aliyun-log-go-sdk/client_scheduled_sql.go b/vendor/github.com/aliyun/aliyun-log-go-sdk/client_scheduled_sql.go new file mode 100644 index 00000000000..053ddae55ec --- /dev/null +++ b/vendor/github.com/aliyun/aliyun-log-go-sdk/client_scheduled_sql.go @@ -0,0 +1,311 @@ +package sls + +import ( + "encoding/json" + "errors" + "fmt" + "io/ioutil" + "net/url" +) + +type SqlType string +type ResourcePool string +type DataFormat string +type JobType string +type Status string +type ScheduledSQLState string + +const ( + STANDARD SqlType = "standard" + SEARCH_QUERY SqlType = "searchQuery" +) +const ( + DEFAULT ResourcePool = "default" + ENHANCED ResourcePool = "enhanced" +) +const ( + LOG_TO_LOG DataFormat = "log2log" + LOG_TO_METRIC DataFormat = "log2metric" + METRIC_TO_metric DataFormat = "metric2metric" +) +const ( + ALERT_JOB JobType = "Alert" + REPORT_JOB JobType = "Report" + ETL_JOB JobType = "ETL" + INGESTION_JOB JobType = "Ingestion" + REBUILD_INDEX_JOB JobType = "RebuildIndex" + AUDIT_JOB_JOB JobType = "AuditJob" + EXPORT_JOB JobType = "Export" + SCHEDULED_SQL_JOB JobType = "ScheduledSQL" +) + +const ( + ENABLED Status = "Enabled" + DISABLED Status = "Disabled" +) + +const ( + ScheduledSQL_RUNNING ScheduledSQLState = "RUNNING" + ScheduledSQL_FAILED ScheduledSQLState = "FAILED" + ScheduledSQL_SUCCEEDED ScheduledSQLState = "SUCCEEDED" +) + +type ScheduledSQL struct { + Name string `json:"name"` + DisplayName string `json:"displayName"` + Description string `json:"description"` + Status Status `json:"status"` + ScheduleId string `json:"scheduleId"` + Configuration *ScheduledSQLConfiguration `json:"configuration"` + Schedule *Schedule `json:"schedule"` + CreateTime int64 `json:"createTime,omitempty"` + LastModifiedTime int64 `json:"lastModifiedTime,omitempty"` + Type JobType `json:"type"` +} + +type ScheduledSQLConfiguration struct { + SourceLogStore string `json:"sourceLogstore"` + DestProject string `json:"destProject"` + DestEndpoint string `json:"destEndpoint"` + DestLogStore string `json:"destLogstore"` + Script string `json:"script"` + SqlType SqlType `json:"sqlType"` + ResourcePool ResourcePool `json:"resourcePool"` + RoleArn string `json:"roleArn"` + DestRoleArn string `json:"destRoleArn"` + FromTimeExpr string `json:"fromTimeExpr"` + ToTimeExpr string `json:"toTimeExpr"` + MaxRunTimeInSeconds int32 `json:"maxRunTimeInSeconds"` + MaxRetries int32 `json:"maxRetries"` + FromTime int64 `json:"fromTime"` + ToTime int64 `json:"toTime"` + DataFormat DataFormat `json:"dataFormat"` + Parameters *ScheduledSQLParameters `json:"parameters,omitempty"` +} + +func NewScheduledSQLConfiguration() *ScheduledSQLConfiguration { + return &ScheduledSQLConfiguration{ + SqlType: STANDARD, + ResourcePool: DEFAULT, + FromTime: 0, + ToTime: 0, + DataFormat: LOG_TO_LOG, + } +} + +type ScheduledSQLParameters struct { + TimeKey string `json:"timeKey,omitempty"` + LabelKeys string `json:"labelKeys,omitempty"` + MetricKeys string `json:"metricKeys,omitempty"` + MetricName string `json:"metricName,omitempty"` + HashLabels string `json:"hashLabels,omitempty"` + AddLabels string `json:"addLabels,omitempty"` +} + +func (c *Client) CreateScheduledSQL(project string, scheduledsql *ScheduledSQL) error { + fromTime := scheduledsql.Configuration.FromTime + toTime := scheduledsql.Configuration.ToTime + timeRange := fromTime > 1451577600 && toTime > fromTime + sustained := fromTime > 1451577600 && toTime == 0 + if !timeRange && !sustained { + return fmt.Errorf("invalid fromTime: %d toTime: %d, please ensure fromTime more than 1451577600", fromTime, toTime) + } + body, err := json.Marshal(scheduledsql) + if err != nil { + return NewClientError(err) + } + h := map[string]string{ + "x-log-bodyrawsize": fmt.Sprintf("%v", len(body)), + "Content-Type": "application/json", + } + + uri := "/jobs" + r, err := c.request(project, "POST", uri, h, body) + if err != nil { + return err + } + r.Body.Close() + return nil +} + +func (c *Client) DeleteScheduledSQL(project string, name string) error { + h := map[string]string{ + "x-log-bodyrawsize": "0", + "Content-Type": "application/json", + } + + uri := "/jobs/" + name + r, err := c.request(project, "DELETE", uri, h, nil) + if err != nil { + return err + } + r.Body.Close() + return nil +} + +func (c *Client) UpdateScheduledSQL(project string, scheduledsql *ScheduledSQL) error { + body, err := json.Marshal(scheduledsql) + if err != nil { + return NewClientError(err) + } + h := map[string]string{ + "x-log-bodyrawsize": fmt.Sprintf("%v", len(body)), + "Content-Type": "application/json", + } + + uri := "/jobs/" + scheduledsql.Name + r, err := c.request(project, "PUT", uri, h, body) + if err != nil { + return err + } + r.Body.Close() + return nil +} + +func (c *Client) GetScheduledSQL(project string, name string) (*ScheduledSQL, error) { + h := map[string]string{ + "x-log-bodyrawsize": "0", + "Content-Type": "application/json", + } + uri := "/jobs/" + name + r, err := c.request(project, "GET", uri, h, nil) + if err != nil { + return nil, err + } + defer r.Body.Close() + buf, _ := ioutil.ReadAll(r.Body) + scheduledSQL := &ScheduledSQL{} + if err = json.Unmarshal(buf, scheduledSQL); err != nil { + err = NewClientError(err) + } + return scheduledSQL, err +} + +func (c *Client) ListScheduledSQL(project, name, displayName string, offset, size int) (scheduledsqls []*ScheduledSQL, total, count int, error error) { + h := map[string]string{ + "x-log-bodyrawsize": "0", + "Content-Type": "application/json", + } + v := url.Values{} + v.Add("jobName", name) + if displayName != "" { + v.Add("displayName", displayName) + } + v.Add("jobType", "ScheduledSQL") + v.Add("offset", fmt.Sprintf("%d", offset)) + v.Add("size", fmt.Sprintf("%d", size)) + + uri := "/jobs?" + v.Encode() + r, err := c.request(project, "GET", uri, h, nil) + if err != nil { + return nil, 0, 0, err + } + defer r.Body.Close() + + type ScheduledSqlList struct { + Total int `json:"total"` + Count int `json:"count"` + Results []*ScheduledSQL `json:"results"` + } + buf, _ := ioutil.ReadAll(r.Body) + scheduledSqlList := &ScheduledSqlList{} + if err = json.Unmarshal(buf, scheduledSqlList); err != nil { + err = NewClientError(err) + } + return scheduledSqlList.Results, scheduledSqlList.Total, scheduledSqlList.Count, err +} + +type ScheduledSQLJobInstance struct { + InstanceId string `json:"instanceId"` + JobName string `json:"jobName,omitempty"` + DisplayName string `json:"displayName,omitempty"` + Description string `json:"description,omitempty"` + JobScheduleId string `json:"jobScheduleId,omitempty"` + CreateTimeInMillis int64 `json:"createTimeInMillis"` + ScheduleTimeInMillis int64 `json:"scheduleTimeInMillis"` + UpdateTimeInMillis int64 `json:"updateTimeInMillis"` + State ScheduledSQLState `json:"state"` + ErrorCode string `json:"errorCode"` + ErrorMessage string `json:"errorMessage"` + Summary string `json:"summary,omitempty"` +} + +func (c *Client) GetScheduledSQLJobInstance(projectName, jobName, instanceId string, result bool) (*ScheduledSQLJobInstance, error) { + h := map[string]string{ + "x-log-bodyrawsize": "0", + "Content-Type": "application/json", + } + uri := fmt.Sprintf("/jobs/%s/jobinstances/%s?result=%t", jobName, instanceId, result) + r, err := c.request(projectName, "GET", uri, h, nil) + if err != nil { + return nil, err + } + defer r.Body.Close() + buf, _ := ioutil.ReadAll(r.Body) + instance := &ScheduledSQLJobInstance{} + if err = json.Unmarshal(buf, instance); err != nil { + err = NewClientError(err) + } + return instance, err +} + +func (c *Client) ModifyScheduledSQLJobInstanceState(projectName, jobName, instanceId string, state ScheduledSQLState) error { + if ScheduledSQL_RUNNING != state { + return NewClientError(errors.New(fmt.Sprintf("Invalid state: %s, state must be RUNNING.", state))) + } + h := map[string]string{ + "x-log-bodyrawsize": "0", + "Content-Type": "application/json", + } + + uri := fmt.Sprintf("/jobs/%s/jobinstances/%s?state=%s", jobName, instanceId, state) + r, err := c.request(projectName, "PUT", uri, h, nil) + if err != nil { + return err + } + r.Body.Close() + return nil +} + +type InstanceStatus struct { + FromTime int64 + ToTime int64 + Offset int64 + Size int64 + State ScheduledSQLState +} + +func (c *Client) ListScheduledSQLJobInstances(projectName, jobName string, status *InstanceStatus) (instances []*ScheduledSQLJobInstance, total, count int64, err error) { + h := map[string]string{ + "x-log-bodyrawsize": "0", + "Content-Type": "application/json", + } + v := url.Values{} + v.Add("jobType", "ScheduledSQL") + v.Add("start", fmt.Sprintf("%d", status.FromTime)) + v.Add("end", fmt.Sprintf("%d", status.ToTime)) + v.Add("offset", fmt.Sprintf("%d", status.Offset)) + v.Add("size", fmt.Sprintf("%d", status.Size)) + if status.State != "" { + v.Add("state", string(status.State)) + } + + uri := fmt.Sprintf("/jobs/%s/jobinstances?%s", jobName, v.Encode()) + r, err := c.request(projectName, "GET", uri, h, nil) + if err != nil { + return nil, 0, 0, err + } + defer r.Body.Close() + + type ScheduledSqlJobInstances struct { + Total int64 `json:"total"` + Count int64 `json:"count"` + Results []*ScheduledSQLJobInstance `json:"results"` + } + buf, _ := ioutil.ReadAll(r.Body) + jobInstances := &ScheduledSqlJobInstances{} + if err = json.Unmarshal(buf, jobInstances); err != nil { + err = NewClientError(err) + } + return jobInstances.Results, jobInstances.Total, jobInstances.Count, err +} diff --git a/vendor/github.com/aliyun/aliyun-log-go-sdk/client_store.go b/vendor/github.com/aliyun/aliyun-log-go-sdk/client_store.go index df008b656a4..ebd1181f80a 100644 --- a/vendor/github.com/aliyun/aliyun-log-go-sdk/client_store.go +++ b/vendor/github.com/aliyun/aliyun-log-go-sdk/client_store.go @@ -197,6 +197,18 @@ func (c *Client) GetLogLines(project, logstore string, topic string, from int64, return ls.GetLogLines(topic, from, to, queryExp, maxLineNum, offset, reverse) } +// GetLogsV2 ... +func (c *Client) GetLogsV2(project, logstore string, req *GetLogRequest) (*GetLogsResponse, error) { + ls := convertLogstore(c, project, logstore) + return ls.GetLogsV2(req) +} + +// GetLogLinesV2 ... +func (c *Client) GetLogLinesV2(project, logstore string, req *GetLogRequest) (*GetLogLinesResponse, error) { + ls := convertLogstore(c, project, logstore) + return ls.GetLogLinesV2(req) +} + // CreateIndex ... func (c *Client) CreateIndex(project, logstore string, index Index) error { ls := convertLogstore(c, project, logstore) diff --git a/vendor/github.com/aliyun/aliyun-log-go-sdk/log_config.go b/vendor/github.com/aliyun/aliyun-log-go-sdk/log_config.go index a9fd310170a..793a98d14bf 100644 --- a/vendor/github.com/aliyun/aliyun-log-go-sdk/log_config.go +++ b/vendor/github.com/aliyun/aliyun-log-go-sdk/log_config.go @@ -137,9 +137,10 @@ func ConvertToApsaraLogConfigInputDetail(detail InputDetailInterface) (*ApsaraLo // RegexConfigInputDetail regex log config type RegexConfigInputDetail struct { LocalFileConfigInputDetail - Key []string `json:"key"` - LogBeginRegex string `json:"logBeginRegex"` - Regex string `json:"regex"` + Key []string `json:"key"` + LogBeginRegex string `json:"logBeginRegex"` + Regex string `json:"regex"` + CustomizedFields string `json:"customizedFields,omitempty"` } // InitRegexConfigInputDetail ... @@ -221,11 +222,12 @@ func ConvertToJSONConfigInputDetail(detail InputDetailInterface) (*JSONConfigInp // DelimiterConfigInputDetail delimiter log config type DelimiterConfigInputDetail struct { LocalFileConfigInputDetail - Separator string `json:"separator"` - Quote string `json:"quote"` - Key []string `json:"key"` - TimeKey string `json:"timeKey"` - AutoExtend bool `json:"autoExtend"` + Separator string `json:"separator"` + Quote string `json:"quote"` + Key []string `json:"key"` + TimeKey string `json:"timeKey"` + AutoExtend bool `json:"autoExtend"` + AcceptNoEnoughKeys bool `json:"acceptNoEnoughKeys"` } // InitDelimiterConfigInputDetail ... @@ -271,24 +273,26 @@ func ConvertToDelimiterConfigInputDetail(detail InputDetailInterface) (*Delimite // LocalFileConfigInputDetail all file input detail's basic config type LocalFileConfigInputDetail struct { CommonConfigInputDetail - LogType string `json:"logType"` - LogPath string `json:"logPath"` - FilePattern string `json:"filePattern"` - TimeFormat string `json:"timeFormat"` - TopicFormat string `json:"topicFormat,omitempty"` - Preserve bool `json:"preserve"` - PreserveDepth int `json:"preserveDepth"` - FileEncoding string `json:"fileEncoding,omitempty"` - DiscardUnmatch bool `json:"discardUnmatch"` - MaxDepth int `json:"maxDepth"` - TailExisted bool `json:"tailExisted"` - DiscardNonUtf8 bool `json:"discardNonUtf8"` - DelaySkipBytes int `json:"delaySkipBytes"` - IsDockerFile bool `json:"dockerFile"` - DockerIncludeLabel map[string]string `json:"dockerIncludeLabel,omitempty"` - DockerExcludeLabel map[string]string `json:"dockerExcludeLabel,omitempty"` - DockerIncludeEnv map[string]string `json:"dockerIncludeEnv,omitempty"` - DockerExcludeEnv map[string]string `json:"dockerExcludeEnv,omitempty"` + LogType string `json:"logType"` + LogPath string `json:"logPath"` + FilePattern string `json:"filePattern"` + TimeFormat string `json:"timeFormat"` + TopicFormat string `json:"topicFormat,omitempty"` + Preserve bool `json:"preserve"` + PreserveDepth int `json:"preserveDepth"` + FileEncoding string `json:"fileEncoding,omitempty"` + DiscardUnmatch bool `json:"discardUnmatch"` + MaxDepth int `json:"maxDepth"` + TailExisted bool `json:"tailExisted"` + DiscardNonUtf8 bool `json:"discardNonUtf8"` + DelaySkipBytes int `json:"delaySkipBytes"` + IsDockerFile bool `json:"dockerFile"` + DockerIncludeLabel map[string]string `json:"dockerIncludeLabel,omitempty"` + DockerExcludeLabel map[string]string `json:"dockerExcludeLabel,omitempty"` + DockerIncludeEnv map[string]string `json:"dockerIncludeEnv,omitempty"` + DockerExcludeEnv map[string]string `json:"dockerExcludeEnv,omitempty"` + PluginDetail map[string]interface{} `json:"plugin,omitempty"` + Advanced map[string]interface{} `json:"advanced,omitempty"` } func GetFileConfigInputDetailType(detail InputDetailInterface) (string, bool) { diff --git a/vendor/github.com/aliyun/aliyun-log-go-sdk/log_store.go b/vendor/github.com/aliyun/aliyun-log-go-sdk/log_store.go index d280bab452b..e09e56d1702 100644 --- a/vendor/github.com/aliyun/aliyun-log-go-sdk/log_store.go +++ b/vendor/github.com/aliyun/aliyun-log-go-sdk/log_store.go @@ -27,8 +27,8 @@ type LogStore struct { AutoSplit bool `json:"autoSplit"` MaxSplitShard int `json:"maxSplitShard"` AppendMeta bool `json:"appendMeta"` - ArchiveSecons int `json:"archiveSeconds"` TelemetryType string `json:"telemetryType"` + HotTTL uint32 `json:"hot_ttl,omitempty"` CreateTime uint32 `json:"createTime,omitempty"` LastModifyTime uint32 `json:"lastModifyTime,omitempty"` @@ -534,23 +534,14 @@ func (s *LogStore) GetHistograms(topic string, from int64, to int64, queryExp st } // getLogs query logs with [from, to) time range -func (s *LogStore) getLogs(topic string, from int64, to int64, queryExp string, - maxLineNum int64, offset int64, reverse bool) (*http.Response, []byte, *GetLogsResponse, error) { +func (s *LogStore) getLogs(req *GetLogRequest) (*http.Response, []byte, *GetLogsResponse, error) { h := map[string]string{ "x-log-bodyrawsize": "0", "Accept": "application/json", } - urlVal := url.Values{} - urlVal.Add("type", "log") - urlVal.Add("from", strconv.Itoa(int(from))) - urlVal.Add("to", strconv.Itoa(int(to))) - urlVal.Add("topic", topic) - urlVal.Add("line", strconv.Itoa(int(maxLineNum))) - urlVal.Add("offset", strconv.Itoa(int(offset))) - urlVal.Add("reverse", strconv.FormatBool(reverse)) - urlVal.Add("query", queryExp) + urlVal := req.ToURLParams() uri := fmt.Sprintf("/logstores/%s?%s", s.Name, urlVal.Encode()) r, err := request(s.project, "GET", uri, h, nil) @@ -591,11 +582,24 @@ func (s *LogStore) getLogs(topic string, from int64, to int64, queryExp string, }, nil } -// GetJsonLogs query logs with [from, to) time range +// GetLogLines query logs with [from, to) time range func (s *LogStore) GetLogLines(topic string, from int64, to int64, queryExp string, maxLineNum int64, offset int64, reverse bool) (*GetLogLinesResponse, error) { - rsp, b, logRsp, err := s.getLogs(topic, from, to, queryExp, maxLineNum, offset, reverse) + var req GetLogRequest + req.Topic = topic + req.From = from + req.To = to + req.Query = queryExp + req.Lines = maxLineNum + req.Offset = offset + req.Reverse = reverse + return s.GetLogLinesV2(&req) +} + +// GetLogLinesV2 query logs with [from, to) time range +func (s *LogStore) GetLogLinesV2(req *GetLogRequest) (*GetLogLinesResponse, error) { + rsp, b, logRsp, err := s.getLogs(req) if err != nil { return nil, err } @@ -616,8 +620,20 @@ func (s *LogStore) GetLogLines(topic string, from int64, to int64, queryExp stri // GetLogs query logs with [from, to) time range func (s *LogStore) GetLogs(topic string, from int64, to int64, queryExp string, maxLineNum int64, offset int64, reverse bool) (*GetLogsResponse, error) { + var req GetLogRequest + req.Topic = topic + req.From = from + req.To = to + req.Query = queryExp + req.Lines = maxLineNum + req.Offset = offset + req.Reverse = reverse + return s.GetLogsV2(&req) +} - rsp, b, logRsp, err := s.getLogs(topic, from, to, queryExp, maxLineNum, offset, reverse) +// GetLogsV2 query logs with [from, to) time range +func (s *LogStore) GetLogsV2(req *GetLogRequest) (*GetLogsResponse, error) { + rsp, b, logRsp, err := s.getLogs(req) if err == nil && len(b) != 0 { logs := []map[string]string{} err = json.Unmarshal(b, &logs) @@ -626,7 +642,6 @@ func (s *LogStore) GetLogs(topic string, from int64, to int64, queryExp string, } logRsp.Logs = logs } - return logRsp, err } @@ -754,27 +769,15 @@ func (s *LogStore) UpdateIndexString(indexStr string) error { // DeleteIndex ... func (s *LogStore) DeleteIndex() error { - type Body struct { - project string `json:"projectName"` - store string `json:"logstoreName"` - } - - body, err := json.Marshal(Body{ - project: s.project.Name, - store: s.Name, - }) - if err != nil { - return err - } h := map[string]string{ - "x-log-bodyrawsize": fmt.Sprintf("%v", len(body)), + "x-log-bodyrawsize": "0", "Content-Type": "application/json", "Accept-Encoding": "deflate", // TODO: support lz4 } uri := fmt.Sprintf("/logstores/%s/index", s.Name) - r, err := request(s.project, "DELETE", uri, h, body) + r, err := request(s.project, "DELETE", uri, h, nil) if r != nil { r.Body.Close() } @@ -783,27 +786,14 @@ func (s *LogStore) DeleteIndex() error { // GetIndex ... func (s *LogStore) GetIndex() (*Index, error) { - type Body struct { - project string `json:"projectName"` - store string `json:"logstoreName"` - } - - body, err := json.Marshal(Body{ - project: s.project.Name, - store: s.Name, - }) - if err != nil { - return nil, err - } - h := map[string]string{ - "x-log-bodyrawsize": fmt.Sprintf("%v", len(body)), "Content-Type": "application/json", - "Accept-Encoding": "deflate", // TODO: support lz4 + "x-log-bodyrawsize": "0", + "Accept-Encoding": "deflate", } uri := fmt.Sprintf("/logstores/%s/index", s.Name) - r, err := request(s.project, "GET", uri, h, body) + r, err := request(s.project, "GET", uri, h, nil) if err != nil { return nil, err } @@ -820,27 +810,14 @@ func (s *LogStore) GetIndex() (*Index, error) { // GetIndexString ... func (s *LogStore) GetIndexString() (string, error) { - type Body struct { - project string `json:"projectName"` - store string `json:"logstoreName"` - } - - body, err := json.Marshal(Body{ - project: s.project.Name, - store: s.Name, - }) - if err != nil { - return "", err - } - h := map[string]string{ - "x-log-bodyrawsize": fmt.Sprintf("%v", len(body)), "Content-Type": "application/json", - "Accept-Encoding": "deflate", // TODO: support lz4 + "x-log-bodyrawsize": "0", + "Accept-Encoding": "deflate", } uri := fmt.Sprintf("/logstores/%s/index", s.Name) - r, err := request(s.project, "GET", uri, h, body) + r, err := request(s.project, "GET", uri, h, nil) if err != nil { return "", err } diff --git a/vendor/github.com/aliyun/aliyun-log-go-sdk/model.go b/vendor/github.com/aliyun/aliyun-log-go-sdk/model.go index 243460fed7e..e67f383be35 100644 --- a/vendor/github.com/aliyun/aliyun-log-go-sdk/model.go +++ b/vendor/github.com/aliyun/aliyun-log-go-sdk/model.go @@ -2,9 +2,37 @@ package sls import ( "encoding/json" + "net/url" + "strconv" "strings" ) +// GetLogRequest for GetLogsV2 +type GetLogRequest struct { + From int64 // unix time, eg time.Now().Unix() - 900 + To int64 // unix time, eg time.Now().Unix() + Topic string // @note topic is not used anymore, use __topic__ : xxx in query instead + Lines int64 // max 100; offset, lines and reverse is ignored when use SQL in query + Offset int64 + Reverse bool + Query string + PowerSQL bool +} + +func (glr *GetLogRequest) ToURLParams() url.Values { + urlVal := url.Values{} + urlVal.Add("type", "log") + urlVal.Add("from", strconv.Itoa(int(glr.From))) + urlVal.Add("to", strconv.Itoa(int(glr.To))) + urlVal.Add("topic", glr.Topic) + urlVal.Add("line", strconv.Itoa(int(glr.Lines))) + urlVal.Add("offset", strconv.Itoa(int(glr.Offset))) + urlVal.Add("reverse", strconv.FormatBool(glr.Reverse)) + urlVal.Add("powerSql", strconv.FormatBool(glr.PowerSQL)) + urlVal.Add("query", glr.Query) + return urlVal +} + // GetHistogramsResponse defines response from GetHistograms call type SingleHistogram struct { Progress string `json:"progress"` @@ -36,7 +64,7 @@ type GetLogsResponse struct { // note: GetLogLinesResponse.Logs is nil when use GetLogLinesResponse type GetLogLinesResponse struct { GetLogsResponse - Lines []json.RawMessage + Lines []json.RawMessage } func (resp *GetLogsResponse) IsComplete() bool { diff --git a/vendor/github.com/aliyun/aliyun-log-go-sdk/request.go b/vendor/github.com/aliyun/aliyun-log-go-sdk/request.go index 1fd1ec8e407..c161b8da167 100644 --- a/vendor/github.com/aliyun/aliyun-log-go-sdk/request.go +++ b/vendor/github.com/aliyun/aliyun-log-go-sdk/request.go @@ -5,27 +5,27 @@ import ( "crypto/md5" "encoding/json" "fmt" - "github.com/go-kit/kit/log/level" "io/ioutil" "net/http" "net/http/httputil" "net/url" "time" + "github.com/go-kit/kit/log/level" + "github.com/cenkalti/backoff" "golang.org/x/net/context" ) // timeout configs var ( - defaultRequestTimeout = 10 * time.Second - defaultRetryTimeout = 30 * time.Second + defaultRequestTimeout = 60 * time.Second + defaultRetryTimeout = 90 * time.Second defaultHttpClient = &http.Client{ Timeout: defaultRequestTimeout, } ) - func retryReadErrorCheck(ctx context.Context, err error) (bool, error) { if err == nil { return false, nil diff --git a/vendor/github.com/aliyun/aliyun-log-go-sdk/token_auto_update_client.go b/vendor/github.com/aliyun/aliyun-log-go-sdk/token_auto_update_client.go index 78907ef58a6..b8c2bf75a45 100644 --- a/vendor/github.com/aliyun/aliyun-log-go-sdk/token_auto_update_client.go +++ b/vendor/github.com/aliyun/aliyun-log-go-sdk/token_auto_update_client.go @@ -669,6 +669,26 @@ func (c *TokenAutoUpdateClient) GetHistograms(project, logstore string, topic st return } +func (c *TokenAutoUpdateClient) GetLogsV2(project, logstore string, req *GetLogRequest) (r *GetLogsResponse, err error) { + for i := 0; i < c.maxTryTimes; i++ { + r, err = c.logClient.GetLogsV2(project, logstore, req) + if !c.processError(err) { + return + } + } + return +} + +func (c *TokenAutoUpdateClient) GetLogLinesV2(project, logstore string, req *GetLogRequest) (r *GetLogLinesResponse, err error) { + for i := 0; i < c.maxTryTimes; i++ { + r, err = c.logClient.GetLogLinesV2(project, logstore, req) + if !c.processError(err) { + return + } + } + return +} + func (c *TokenAutoUpdateClient) GetLogs(project, logstore string, topic string, from int64, to int64, queryExp string, maxLineNum int64, offset int64, reverse bool) (r *GetLogsResponse, err error) { for i := 0; i < c.maxTryTimes; i++ { @@ -1179,3 +1199,246 @@ func (c *TokenAutoUpdateClient) ListTagResources(project string, } return } + +// ####################### Scheduled SQL API ###################### +func (c *TokenAutoUpdateClient) CreateScheduledSQL(project string, scheduledsql *ScheduledSQL) (err error) { + for i := 0; i < c.maxTryTimes; i++ { + err = c.logClient.CreateScheduledSQL(project, scheduledsql) + if !c.processError(err) { + return + } + } + return +} + +func (c *TokenAutoUpdateClient) DeleteScheduledSQL(project string, name string) (err error) { + for i := 0; i < c.maxTryTimes; i++ { + err = c.logClient.DeleteScheduledSQL(project, name) + if !c.processError(err) { + return + } + } + return +} + +func (c *TokenAutoUpdateClient) UpdateScheduledSQL(project string, scheduledsql *ScheduledSQL) (err error) { + for i := 0; i < c.maxTryTimes; i++ { + err = c.logClient.UpdateScheduledSQL(project, scheduledsql) + if !c.processError(err) { + return + } + } + return +} + +func (c *TokenAutoUpdateClient) GetScheduledSQL(project string, name string) (s *ScheduledSQL, err error) { + for i := 0; i < c.maxTryTimes; i++ { + s, err = c.logClient.GetScheduledSQL(project, name) + if !c.processError(err) { + return + } + } + return +} + +func (c *TokenAutoUpdateClient) ListScheduledSQL(project, name, displayName string, offset, size int) (scheduledsqls []*ScheduledSQL, total, count int, err error) { + for i := 0; i < c.maxTryTimes; i++ { + scheduledsqls, total, count, err = c.logClient.ListScheduledSQL(project, name, displayName, offset, size) + if !c.processError(err) { + return + } + } + return +} + +func (c *TokenAutoUpdateClient) GetScheduledSQLJobInstance(projectName, jobName, instanceId string, result bool) (instance *ScheduledSQLJobInstance, err error) { + for i := 0; i < c.maxTryTimes; i++ { + instance, err = c.logClient.GetScheduledSQLJobInstance(projectName, jobName, instanceId, result) + if !c.processError(err) { + return + } + } + return instance, err +} + +func (c *TokenAutoUpdateClient) ModifyScheduledSQLJobInstanceState(projectName, jobName, instanceId string, state ScheduledSQLState) (err error) { + for i := 0; i < c.maxTryTimes; i++ { + err = c.logClient.ModifyScheduledSQLJobInstanceState(projectName, jobName, instanceId, state) + if !c.processError(err) { + return + } + } + return err +} + +func (c *TokenAutoUpdateClient) ListScheduledSQLJobInstances(projectName, jobName string, status *InstanceStatus) (instances []*ScheduledSQLJobInstance, total, count int64, err error) { + for i := 0; i < c.maxTryTimes; i++ { + instances, total, count, err = c.logClient.ListScheduledSQLJobInstances(projectName, jobName, status) + if !c.processError(err) { + return + } + } + return instances, total, count, err +} + +// ####################### Resource API ###################### +func (c *TokenAutoUpdateClient) ListResource(resourceType string, resourceName string, offset, size int) (resourceList []*Resource, count, total int, err error) { + for i := 0; i < c.maxTryTimes; i++ { + resourceList, total, count, err = c.logClient.ListResource(resourceType, resourceName, offset, size) + if !c.processError(err) { + return + } + } + return +} + +func (c *TokenAutoUpdateClient) GetResource(name string) (resource *Resource, err error) { + for i := 0; i < c.maxTryTimes; i++ { + resource, err = c.logClient.GetResource(name) + if !c.processError(err) { + return + } + } + return +} + +func (c *TokenAutoUpdateClient) GetResourceString(name string) (resource string, err error) { + for i := 0; i < c.maxTryTimes; i++ { + resource, err = c.logClient.GetResourceString(name) + if !c.processError(err) { + return + } + } + return +} + +func (c *TokenAutoUpdateClient) DeleteResource(name string) (err error) { + for i := 0; i < c.maxTryTimes; i++ { + err = c.logClient.DeleteResource(name) + if !c.processError(err) { + return + } + } + return +} + +func (c *TokenAutoUpdateClient) UpdateResource(resource *Resource) (err error) { + for i := 0; i < c.maxTryTimes; i++ { + err = c.logClient.UpdateResource(resource) + if !c.processError(err) { + return + } + } + return +} + +func (c *TokenAutoUpdateClient) UpdateResourceString(resourceName, resourceStr string) (err error) { + for i := 0; i < c.maxTryTimes; i++ { + err = c.logClient.UpdateResourceString(resourceName, resourceStr) + if !c.processError(err) { + return + } + } + return +} + +func (c *TokenAutoUpdateClient) CreateResource(resource *Resource) (err error) { + for i := 0; i < c.maxTryTimes; i++ { + err = c.logClient.CreateResource(resource) + if !c.processError(err) { + return + } + } + return +} + +func (c *TokenAutoUpdateClient) CreateResourceString(resourceStr string) (err error) { + for i := 0; i < c.maxTryTimes; i++ { + err = c.logClient.CreateResourceString(resourceStr) + if !c.processError(err) { + return + } + } + return +} + +// ####################### Resource Record API ###################### +func (c *TokenAutoUpdateClient) ListResourceRecord(resourceName string, offset, size int) (recordList []*ResourceRecord, count, total int, err error) { + for i := 0; i < c.maxTryTimes; i++ { + recordList, total, count, err = c.logClient.ListResourceRecord(resourceName, offset, size) + if !c.processError(err) { + return + } + } + return +} + +func (c *TokenAutoUpdateClient) GetResourceRecord(resourceName, recordId string) (record *ResourceRecord, err error) { + for i := 0; i < c.maxTryTimes; i++ { + record, err = c.logClient.GetResourceRecord(resourceName, recordId) + if !c.processError(err) { + return + } + } + return +} + +func (c *TokenAutoUpdateClient) GetResourceRecordString(resourceName, name string) (record string, err error) { + for i := 0; i < c.maxTryTimes; i++ { + record, err = c.logClient.GetResourceRecordString(resourceName, name) + if !c.processError(err) { + return + } + } + return +} + +func (c *TokenAutoUpdateClient) DeleteResourceRecord(resourceName, recordId string) (err error) { + for i := 0; i < c.maxTryTimes; i++ { + err = c.logClient.DeleteResourceRecord(resourceName, recordId) + if !c.processError(err) { + return + } + } + return +} + +func (c *TokenAutoUpdateClient) UpdateResourceRecord(resourceName string, record *ResourceRecord) (err error) { + for i := 0; i < c.maxTryTimes; i++ { + err = c.logClient.UpdateResourceRecord(resourceName, record) + if !c.processError(err) { + return + } + } + return +} + +func (c *TokenAutoUpdateClient) UpdateResourceRecordString(resourceName, recordStr string) (err error) { + for i := 0; i < c.maxTryTimes; i++ { + err = c.logClient.UpdateResourceString(resourceName, recordStr) + if !c.processError(err) { + return + } + } + return +} + +func (c *TokenAutoUpdateClient) CreateResourceRecord(resourceName string, record *ResourceRecord) (err error) { + for i := 0; i < c.maxTryTimes; i++ { + err = c.logClient.CreateResourceRecord(resourceName, record) + if !c.processError(err) { + return + } + } + return +} + +func (c *TokenAutoUpdateClient) CreateResourceRecordString(resourceName, recordStr string) (err error) { + for i := 0; i < c.maxTryTimes; i++ { + err = c.logClient.CreateResourceRecordString(resourceName, recordStr) + if !c.processError(err) { + return + } + } + return +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/common.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/common.go index f8545fc89f1..91b2654b4c8 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/common.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/common.go @@ -16,6 +16,8 @@ import ( "strings" "time" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/denverdino/aliyungo/cs" "github.com/aliyun/aliyun-datahub-sdk-go/datahub" @@ -348,6 +350,15 @@ func convertJsonStringToStringList(src interface{}) (result []interface{}) { return } +func convertJsonStringToMap(configured string) (map[string]interface{}, error) { + result := make(map[string]interface{}) + if err := json.Unmarshal([]byte(configured), &result); err != nil { + return nil, err + } + + return result, nil +} + // Convert the result for an array and returns a comma separate func convertListToCommaSeparate(configured []interface{}) string { if len(configured) < 1 { @@ -386,18 +397,46 @@ func convertJsonStringToList(configured string) ([]interface{}, error) { } func convertMaptoJsonString(m map[string]interface{}) (string, error) { - sm := make(map[string]string, len(m)) - for k, v := range m { - sm[k] = v.(string) - } + //sm := make(map[string]string, len(m)) + //for k, v := range m { + // sm[k] = v.(string) + //} - if result, err := json.Marshal(sm); err != nil { + if result, err := json.Marshal(m); err != nil { return "", err } else { return string(result), nil } } +func convertListMapToJsonString(configured []map[string]interface{}) (string, error) { + if len(configured) < 1 { + return "[]", nil + } + + result := "[" + for i, m := range configured { + if m == nil { + continue + } + + sm := make(map[string]interface{}, len(m)) + for k, v := range m { + sm[k] = v + } + + item, err := json.Marshal(sm) + if err == nil { + result += string(item) + if i < len(configured)-1 { + result += "," + } + } + } + result += "]" + return result, nil +} + func convertMapFloat64ToJsonString(m map[string]interface{}) (string, error) { sm := make(map[string]json.Number, len(m)) @@ -971,7 +1010,6 @@ func formatInt(src interface{}) int { default: panic(fmt.Sprintf("Not support type %s", attrType.String())) } - return 0 } func convertArrayObjectToJsonString(src interface{}) (string, error) { @@ -992,3 +1030,66 @@ func convertArrayToString(src interface{}, sep string) string { } return strings.Join(items, sep) } + +func splitMultiZoneId(id string) (ids []string) { + if !(strings.Contains(id, MULTI_IZ_SYMBOL) || strings.Contains(id, "(")) { + return + } + firstIndex := strings.Index(id, MULTI_IZ_SYMBOL) + secondIndex := strings.Index(id, "(") + for _, p := range strings.Split(id[secondIndex+1:len(id)-1], COMMA_SEPARATED) { + ids = append(ids, id[:firstIndex]+string(p)) + } + return +} + +func Case2Camel(name string) string { + name = strings.Replace(name, "_", " ", -1) + name = strings.Title(name) + return strings.Replace(name, " ", "", -1) +} + +func FirstLower(s string) string { + if s == "" { + return "" + } + return strings.ToLower(s[:1]) + s[1:] +} + +// SplitSlice Divides the slice into blocks of the specified size +func SplitSlice(xs []interface{}, chunkSize int) [][]interface{} { + if len(xs) == 0 { + return nil + } + divided := make([][]interface{}, (len(xs)+chunkSize-1)/chunkSize) + prev := 0 + i := 0 + till := len(xs) - chunkSize + for prev < till { + next := prev + chunkSize + divided[i] = xs[prev:next] + prev = next + i++ + } + divided[i] = xs[prev:] + return divided +} + +func isPagingRequest(d *schema.ResourceData) bool { + v, ok := d.GetOk("page_number") + return ok && v.(int) > 0 +} + +func setPagingRequest(d *schema.ResourceData, request map[string]interface{}, maxPageSize int) { + if v, ok := d.GetOk("page_number"); ok && v.(int) > 0 { + request["PageNumber"] = v.(int) + } else { + request["PageNumber"] = 1 + } + if v, ok := d.GetOk("page_size"); ok && v.(int) > 0 { + request["PageSize"] = v.(int) + } else { + request["PageSize"] = PageSizeLarge + } + return +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity/client.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity/client.go index ef5bb26f3ff..a13be8e7214 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity/client.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity/client.go @@ -37,7 +37,6 @@ import ( "github.com/aliyun/alibaba-cloud-sdk-go/services/polardb" r_kvstore "github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore" "github.com/aliyun/alibaba-cloud-sdk-go/services/ram" - "github.com/aliyun/alibaba-cloud-sdk-go/services/rds" "github.com/aliyun/alibaba-cloud-sdk-go/services/slb" slsPop "github.com/aliyun/alibaba-cloud-sdk-go/services/sls" "github.com/aliyun/alibaba-cloud-sdk-go/services/smartag" @@ -72,9 +71,10 @@ import ( ) type AliyunClient struct { - Region Region - RegionId string - SourceIp string + Region Region + RegionId string + SourceIp string + SecureTransport string //In order to build ots table client, add accesskey and secretkey in aliyunclient temporarily. AccessKey string SecretKey string @@ -87,7 +87,6 @@ type AliyunClient struct { accountId string ecsconn *ecs.Client essconn *ess.Client - rdsconn *rds.Client vpcconn *vpc.Client slbconn *slb.Client alikafkaconn *alikafka.Client @@ -173,7 +172,7 @@ var loadSdkfromRemoteMutex = sync.Mutex{} var loadSdkEndpointMutex = sync.Mutex{} // The main version number that is being run at the moment. -var providerVersion = "1.132.0" +var providerVersion = "1.153.0" var terraformVersion = strings.TrimSuffix(schema.Provider{}.TerraformVersion, "-dev") // Temporarily maintain map for old ecs client methods and store special endpoint information @@ -265,6 +264,8 @@ func (client *AliyunClient) WithEcsClient(do func(*ecs.Client) (interface{}, err //} ecsconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) ecsconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + ecsconn.SourceIp = client.config.SourceIp + ecsconn.SecureTransport = client.config.SecureTransport ecsconn.AppendUserAgent(Terraform, terraformVersion) ecsconn.AppendUserAgent(Provider, providerVersion) ecsconn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -294,6 +295,8 @@ func (client *AliyunClient) WithOfficalCSClient(do func(*officalCS.Client) (inte csconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) csconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + csconn.SourceIp = client.config.SourceIp + csconn.SecureTransport = client.config.SecureTransport csconn.AppendUserAgent(Terraform, terraformVersion) csconn.AppendUserAgent(Provider, providerVersion) csconn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -303,32 +306,6 @@ func (client *AliyunClient) WithOfficalCSClient(do func(*officalCS.Client) (inte return do(client.officalCSConn) } -func (client *AliyunClient) WithRdsClient(do func(*rds.Client) (interface{}, error)) (interface{}, error) { - // Initialize the RDS client if necessary - if client.rdsconn == nil { - endpoint := client.config.RdsEndpoint - if endpoint == "" { - endpoint = loadEndpoint(client.config.RegionId, RDSCode) - } - if endpoint != "" { - endpoints.AddEndpointMapping(client.config.RegionId, string(RDSCode), endpoint) - } - rdsconn, err := rds.NewClientWithOptions(client.config.RegionId, client.getSdkConfig(), client.config.getAuthCredential(true)) - if err != nil { - return nil, fmt.Errorf("unable to initialize the RDS client: %#v", err) - } - - rdsconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) - rdsconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) - rdsconn.AppendUserAgent(Terraform, terraformVersion) - rdsconn.AppendUserAgent(Provider, providerVersion) - rdsconn.AppendUserAgent(Module, client.config.ConfigurationSource) - client.rdsconn = rdsconn - } - - return do(client.rdsconn) -} - func (client *AliyunClient) WithPolarDBClient(do func(*polardb.Client) (interface{}, error)) (interface{}, error) { // Initialize the PolarDB client if necessary if client.polarDBconn == nil { @@ -348,6 +325,8 @@ func (client *AliyunClient) WithPolarDBClient(do func(*polardb.Client) (interfac polarDBconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) polarDBconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + polarDBconn.SourceIp = client.config.SourceIp + polarDBconn.SecureTransport = client.config.SecureTransport polarDBconn.AppendUserAgent(Terraform, terraformVersion) polarDBconn.AppendUserAgent(Provider, providerVersion) polarDBconn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -374,6 +353,8 @@ func (client *AliyunClient) WithSlbClient(do func(*slb.Client) (interface{}, err slbconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) slbconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + slbconn.SourceIp = client.config.SourceIp + slbconn.SecureTransport = client.config.SecureTransport slbconn.AppendUserAgent(Terraform, terraformVersion) slbconn.AppendUserAgent(Provider, providerVersion) slbconn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -400,6 +381,8 @@ func (client *AliyunClient) WithVpcClient(do func(*vpc.Client) (interface{}, err vpcconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) vpcconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + vpcconn.SourceIp = client.config.SourceIp + vpcconn.SecureTransport = client.config.SecureTransport vpcconn.AppendUserAgent(Terraform, terraformVersion) vpcconn.AppendUserAgent(Provider, providerVersion) vpcconn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -533,6 +516,8 @@ func (client *AliyunClient) WithCenClient(do func(*cbn.Client) (interface{}, err cenconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) cenconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + cenconn.SourceIp = client.config.SourceIp + cenconn.SecureTransport = client.config.SecureTransport cenconn.AppendUserAgent(Terraform, terraformVersion) cenconn.AppendUserAgent(Provider, providerVersion) cenconn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -559,6 +544,8 @@ func (client *AliyunClient) WithEssClient(do func(*ess.Client) (interface{}, err essconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) essconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + essconn.SourceIp = client.config.SourceIp + essconn.SecureTransport = client.config.SecureTransport essconn.AppendUserAgent(Terraform, terraformVersion) essconn.AppendUserAgent(Provider, providerVersion) essconn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -644,6 +631,8 @@ func (client *AliyunClient) WithDnsClient(do func(*alidns.Client) (interface{}, } dnsconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) dnsconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + dnsconn.SourceIp = client.config.SourceIp + dnsconn.SecureTransport = client.config.SecureTransport dnsconn.AppendUserAgent(Terraform, terraformVersion) dnsconn.AppendUserAgent(Provider, providerVersion) dnsconn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -673,6 +662,8 @@ func (client *AliyunClient) WithRamClient(do func(*ram.Client) (interface{}, err } ramconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) ramconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + ramconn.SourceIp = client.config.SourceIp + ramconn.SecureTransport = client.config.SecureTransport ramconn.AppendUserAgent(Terraform, terraformVersion) ramconn.AppendUserAgent(Provider, providerVersion) ramconn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -748,6 +739,8 @@ func (client *AliyunClient) WithCrClient(do func(*cr.Client) (interface{}, error } crconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) crconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + crconn.SourceIp = client.config.SourceIp + crconn.SecureTransport = client.config.SecureTransport crconn.AppendUserAgent(Terraform, terraformVersion) crconn.AppendUserAgent(Provider, providerVersion) crconn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -776,6 +769,8 @@ func (client *AliyunClient) WithCrEEClient(do func(*cr_ee.Client) (interface{}, } creeconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) creeconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + creeconn.SourceIp = client.config.SourceIp + creeconn.SecureTransport = client.config.SecureTransport creeconn.AppendUserAgent(Terraform, terraformVersion) creeconn.AppendUserAgent(Provider, providerVersion) creeconn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -823,6 +818,8 @@ func (client *AliyunClient) WithCdnClient_new(do func(*cdn_new.Client) (interfac } cdnconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) cdnconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + cdnconn.SourceIp = client.config.SourceIp + cdnconn.SecureTransport = client.config.SecureTransport cdnconn.AppendUserAgent(Terraform, terraformVersion) cdnconn.AppendUserAgent(Provider, providerVersion) cdnconn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -849,6 +846,8 @@ func (client *AliyunClient) WithOtsClient(do func(*ots.Client) (interface{}, err otsconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) otsconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + otsconn.SourceIp = client.config.SourceIp + otsconn.SecureTransport = client.config.SecureTransport otsconn.AppendUserAgent(Terraform, terraformVersion) otsconn.AppendUserAgent(Provider, providerVersion) otsconn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -875,6 +874,8 @@ func (client *AliyunClient) WithCmsClient(do func(*cms.Client) (interface{}, err cmsconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) cmsconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + cmsconn.SourceIp = client.config.SourceIp + cmsconn.SecureTransport = client.config.SecureTransport cmsconn.AppendUserAgent(Terraform, terraformVersion) cmsconn.AppendUserAgent(Provider, providerVersion) cmsconn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -901,6 +902,8 @@ func (client *AliyunClient) WithStsClient(do func(*sts.Client) (interface{}, err stsconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) stsconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + stsconn.SourceIp = client.config.SourceIp + stsconn.SecureTransport = client.config.SecureTransport stsconn.AppendUserAgent(Terraform, terraformVersion) stsconn.AppendUserAgent(Provider, providerVersion) stsconn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -919,6 +922,8 @@ func (client *AliyunClient) WithLogPopClient(do func(*slsPop.Client) (interface{ } logpopconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) logpopconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + logpopconn.SourceIp = client.config.SourceIp + logpopconn.SecureTransport = client.config.SecureTransport logpopconn.AppendUserAgent(Terraform, terraformVersion) logpopconn.AppendUserAgent(Provider, providerVersion) logpopconn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -975,6 +980,8 @@ func (client *AliyunClient) WithDrdsClient(do func(*drds.Client) (interface{}, e } drdsconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) drdsconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + drdsconn.SourceIp = client.config.SourceIp + drdsconn.SecureTransport = client.config.SecureTransport drdsconn.AppendUserAgent(Terraform, terraformVersion) drdsconn.AppendUserAgent(Provider, providerVersion) drdsconn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -1001,6 +1008,8 @@ func (client *AliyunClient) WithDdsClient(do func(*dds.Client) (interface{}, err ddsconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) ddsconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + ddsconn.SourceIp = client.config.SourceIp + ddsconn.SecureTransport = client.config.SecureTransport ddsconn.AppendUserAgent(Terraform, terraformVersion) ddsconn.AppendUserAgent(Provider, providerVersion) ddsconn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -1026,6 +1035,8 @@ func (client *AliyunClient) WithGpdbClient(do func(*gpdb.Client) (interface{}, e } gpdbconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) gpdbconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + gpdbconn.SourceIp = client.config.SourceIp + gpdbconn.SecureTransport = client.config.SecureTransport gpdbconn.AppendUserAgent(Terraform, terraformVersion) gpdbconn.AppendUserAgent(Provider, providerVersion) gpdbconn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -1077,6 +1088,8 @@ func (client *AliyunClient) WithRkvClient(do func(*r_kvstore.Client) (interface{ } rkvconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) rkvconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + rkvconn.SourceIp = client.config.SourceIp + rkvconn.SecureTransport = client.config.SecureTransport rkvconn.AppendUserAgent(Terraform, terraformVersion) rkvconn.AppendUserAgent(Provider, providerVersion) rkvconn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -1139,6 +1152,8 @@ func (client *AliyunClient) WithCloudApiClient(do func(*cloudapi.Client) (interf } cloudapiconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) cloudapiconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + cloudapiconn.SourceIp = client.config.SourceIp + cloudapiconn.SecureTransport = client.config.SecureTransport cloudapiconn.AppendUserAgent(Terraform, terraformVersion) cloudapiconn.AppendUserAgent(Provider, providerVersion) cloudapiconn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -1259,6 +1274,8 @@ func (client *AliyunClient) WithElasticsearchClient(do func(*elasticsearch.Clien } elasticsearchconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) elasticsearchconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + elasticsearchconn.SourceIp = client.config.SourceIp + elasticsearchconn.SecureTransport = client.config.SecureTransport elasticsearchconn.AppendUserAgent(Terraform, terraformVersion) elasticsearchconn.AppendUserAgent(Provider, providerVersion) elasticsearchconn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -1492,6 +1509,8 @@ func (client *AliyunClient) GetCallerIdentity() (*sts.GetCallerIdentityResponse, stsClient.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) stsClient.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + stsClient.SourceIp = client.config.SourceIp + stsClient.SecureTransport = client.config.SecureTransport stsClient.AppendUserAgent(Terraform, terraformVersion) stsClient.AppendUserAgent(Provider, providerVersion) stsClient.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -1523,6 +1542,8 @@ func (client *AliyunClient) WithDdoscooClient(do func(*ddoscoo.Client) (interfac } ddoscooconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) ddoscooconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + ddoscooconn.SourceIp = client.config.SourceIp + ddoscooconn.SecureTransport = client.config.SecureTransport ddoscooconn.AppendUserAgent(Terraform, terraformVersion) ddoscooconn.AppendUserAgent(Provider, providerVersion) ddoscooconn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -1550,6 +1571,8 @@ func (client *AliyunClient) WithDdosbgpClient(do func(*ddosbgp.Client) (interfac } ddosbgpconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) ddosbgpconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + ddosbgpconn.SourceIp = client.config.SourceIp + ddosbgpconn.SecureTransport = client.config.SecureTransport ddosbgpconn.AppendUserAgent(Terraform, terraformVersion) ddosbgpconn.AppendUserAgent(Provider, providerVersion) ddosbgpconn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -1578,6 +1601,8 @@ func (client *AliyunClient) WithBssopenapiClient(do func(*bssopenapi.Client) (in } bssopenapiconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) bssopenapiconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + bssopenapiconn.SourceIp = client.config.SourceIp + bssopenapiconn.SecureTransport = client.config.SecureTransport bssopenapiconn.AppendUserAgent(Terraform, terraformVersion) bssopenapiconn.AppendUserAgent(Provider, providerVersion) bssopenapiconn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -1603,6 +1628,8 @@ func (client *AliyunClient) WithAlikafkaClient(do func(*alikafka.Client) (interf } alikafkaconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) alikafkaconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + alikafkaconn.SourceIp = client.config.SourceIp + alikafkaconn.SecureTransport = client.config.SecureTransport alikafkaconn.AppendUserAgent(Terraform, terraformVersion) alikafkaconn.AppendUserAgent(Provider, providerVersion) alikafkaconn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -1627,6 +1654,8 @@ func (client *AliyunClient) WithEmrClient(do func(*emr.Client) (interface{}, err } emrConn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) emrConn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + emrConn.SourceIp = client.config.SourceIp + emrConn.SecureTransport = client.config.SecureTransport emrConn.AppendUserAgent(Terraform, terraformVersion) emrConn.AppendUserAgent(Provider, providerVersion) emrConn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -1652,6 +1681,8 @@ func (client *AliyunClient) WithSagClient(do func(*smartag.Client) (interface{}, } sagconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) sagconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + sagconn.SourceIp = client.config.SourceIp + sagconn.SecureTransport = client.config.SecureTransport sagconn.AppendUserAgent(Terraform, terraformVersion) sagconn.AppendUserAgent(Provider, providerVersion) sagconn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -1670,6 +1701,8 @@ func (client *AliyunClient) WithDbauditClient(do func(*yundun_dbaudit.Client) (i } dbauditconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) dbauditconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + dbauditconn.SourceIp = client.config.SourceIp + dbauditconn.SecureTransport = client.config.SecureTransport dbauditconn.AppendUserAgent(Terraform, terraformVersion) dbauditconn.AppendUserAgent(Provider, providerVersion) dbauditconn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -1687,6 +1720,8 @@ func (client *AliyunClient) WithBastionhostClient(do func(*yundun_bastionhost.Cl } bastionhostconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) bastionhostconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + bastionhostconn.SourceIp = client.config.SourceIp + bastionhostconn.SecureTransport = client.config.SecureTransport bastionhostconn.AppendUserAgent(Terraform, terraformVersion) bastionhostconn.AppendUserAgent(Provider, providerVersion) bastionhostconn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -1712,6 +1747,8 @@ func (client *AliyunClient) WithMarketClient(do func(*market.Client) (interface{ } marketconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) marketconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + marketconn.SourceIp = client.config.SourceIp + marketconn.SecureTransport = client.config.SecureTransport marketconn.AppendUserAgent(Terraform, terraformVersion) marketconn.AppendUserAgent(Provider, providerVersion) marketconn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -1737,6 +1774,8 @@ func (client *AliyunClient) WithHbaseClient(do func(*hbase.Client) (interface{}, } hbaseconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) hbaseconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + hbaseconn.SourceIp = client.config.SourceIp + hbaseconn.SecureTransport = client.config.SecureTransport hbaseconn.AppendUserAgent(Terraform, terraformVersion) hbaseconn.AppendUserAgent(Provider, providerVersion) hbaseconn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -1750,6 +1789,9 @@ func (client *AliyunClient) NewAdbClient() (*rpc.Client, error) { productCode := "ads" endpoint := "" if client.config.Endpoints[productCode] == nil { + if v := client.config.AdbEndpoint; v != "" { + client.config.Endpoints[productCode] = v + } if err := client.loadEndpoint(productCode); err != nil { return nil, err } @@ -1790,6 +1832,8 @@ func (client *AliyunClient) WithAdbClient(do func(*adb.Client) (interface{}, err } adbconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) adbconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + adbconn.SourceIp = client.config.SourceIp + adbconn.SecureTransport = client.config.SecureTransport adbconn.AppendUserAgent(Terraform, terraformVersion) adbconn.AppendUserAgent(Provider, providerVersion) adbconn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -1845,6 +1889,8 @@ func (client *AliyunClient) WithCbnClient(do func(*cbn.Client) (interface{}, err } cbnConn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) cbnConn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + cbnConn.SourceIp = client.config.SourceIp + cbnConn.SecureTransport = client.config.SecureTransport cbnConn.AppendUserAgent(Terraform, terraformVersion) cbnConn.AppendUserAgent(Provider, providerVersion) cbnConn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -1869,6 +1915,8 @@ func (client *AliyunClient) WithEdasClient(do func(*edas.Client) (interface{}, e } edasconn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) edasconn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + edasconn.SourceIp = client.config.SourceIp + edasconn.SecureTransport = client.config.SecureTransport edasconn.AppendUserAgent(Terraform, terraformVersion) edasconn.AppendUserAgent(Provider, providerVersion) edasconn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -1897,6 +1945,8 @@ func (client *AliyunClient) WithAlidnsClient(do func(*alidns.Client) (interface{ } alidnsConn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) alidnsConn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + alidnsConn.SourceIp = client.config.SourceIp + alidnsConn.SecureTransport = client.config.SecureTransport alidnsConn.AppendUserAgent(Terraform, terraformVersion) alidnsConn.AppendUserAgent(Provider, providerVersion) alidnsConn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -1918,6 +1968,8 @@ func (client *AliyunClient) WithCassandraClient(do func(*cassandra.Client) (inte } cassandraConn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) cassandraConn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + cassandraConn.SourceIp = client.config.SourceIp + cassandraConn.SecureTransport = client.config.SecureTransport cassandraConn.AppendUserAgent(Terraform, terraformVersion) cassandraConn.AppendUserAgent(Provider, providerVersion) cassandraConn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -1945,6 +1997,8 @@ func (client *AliyunClient) WithEciClient(do func(*eci.Client) (interface{}, err } eciConn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) eciConn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + eciConn.SourceIp = client.config.SourceIp + eciConn.SecureTransport = client.config.SecureTransport eciConn.AppendUserAgent(Terraform, terraformVersion) eciConn.AppendUserAgent(Provider, providerVersion) eciConn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -1972,6 +2026,8 @@ func (client *AliyunClient) WithDcdnClient(do func(*dcdn.Client) (interface{}, e } dcdnConn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) dcdnConn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + dcdnConn.SourceIp = client.config.SourceIp + dcdnConn.SecureTransport = client.config.SecureTransport dcdnConn.AppendUserAgent(Terraform, terraformVersion) dcdnConn.AppendUserAgent(Provider, providerVersion) dcdnConn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -1999,6 +2055,8 @@ func (client *AliyunClient) WithRKvstoreClient(do func(*r_kvstore.Client) (inter } r_kvstoreConn.SetReadTimeout(time.Duration(client.config.ClientReadTimeout) * time.Millisecond) r_kvstoreConn.SetConnectTimeout(time.Duration(client.config.ClientConnectTimeout) * time.Millisecond) + r_kvstoreConn.SourceIp = client.config.SourceIp + r_kvstoreConn.SecureTransport = client.config.SecureTransport r_kvstoreConn.AppendUserAgent(Terraform, terraformVersion) r_kvstoreConn.AppendUserAgent(Provider, providerVersion) r_kvstoreConn.AppendUserAgent(Module, client.config.ConfigurationSource) @@ -2284,7 +2342,9 @@ func (client *AliyunClient) NewGaplusClient() (*rpc.Client, error) { endpoint := "" if v, ok := client.config.Endpoints[productCode]; !ok || v.(string) == "" { if err := client.loadEndpoint(productCode); err != nil { - return nil, err + endpoint = "ga.cn-hangzhou.aliyuncs.com" + client.config.Endpoints[productCode] = endpoint + log.Printf("[ERROR] loading %s endpoint got an error: %#v. Using the central endpoint %s instead.", productCode, err, endpoint) } } if v, ok := client.config.Endpoints[productCode]; ok && v.(string) != "" { @@ -3223,10 +3283,34 @@ func (client *AliyunClient) NewMscopensubscriptionClient() (*rpc.Client, error) func (client *AliyunClient) NewSddpClient() (*rpc.Client, error) { productCode := "sddp" + endpoint := "sddp.cn-zhangjiakou.aliyuncs.com" + //todo : Fix after Cloud Product fixing Location Configuration + //if v, ok := client.config.Endpoints[productCode]; !ok || v.(string) == "" { + // if err := client.loadEndpoint(productCode); err != nil { + // endpoint = fmt.Sprintf("sddp.%s.aliyuncs.com", client.config.RegionId) + // client.config.Endpoints[productCode] = endpoint + // log.Printf("[ERROR] loading %s endpoint got an error: %#v. Using the endpoint %s instead.", productCode, err, endpoint) + // } + //} + //if v, ok := client.config.Endpoints[productCode]; ok && v.(string) != "" { + // endpoint = v.(string) + //} + + sdkConfig := client.teaSdkConfig + sdkConfig.SetEndpoint(endpoint) + conn, err := rpc.NewClient(&sdkConfig) + if err != nil { + return nil, fmt.Errorf("unable to initialize the %s client: %#v", productCode, err) + } + return conn, nil +} + +func (client *AliyunClient) NewBastionhostClient() (*rpc.Client, error) { + productCode := "bastionhost" endpoint := "" if v, ok := client.config.Endpoints[productCode]; !ok || v.(string) == "" { if err := client.loadEndpoint(productCode); err != nil { - endpoint = fmt.Sprintf("sddp.%s.aliyuncs.com", client.config.RegionId) + endpoint = fmt.Sprintf("bastionhost.%s.aliyuncs.com", client.config.RegionId) client.config.Endpoints[productCode] = endpoint log.Printf("[ERROR] loading %s endpoint got an error: %#v. Using the endpoint %s instead.", productCode, err, endpoint) } @@ -3234,6 +3318,9 @@ func (client *AliyunClient) NewSddpClient() (*rpc.Client, error) { if v, ok := client.config.Endpoints[productCode]; ok && v.(string) != "" { endpoint = v.(string) } + if endpoint == "" { + return nil, fmt.Errorf("[ERROR] missing the product %s endpoint.", productCode) + } sdkConfig := client.teaSdkConfig sdkConfig.SetEndpoint(endpoint) conn, err := rpc.NewClient(&sdkConfig) @@ -3243,12 +3330,262 @@ func (client *AliyunClient) NewSddpClient() (*rpc.Client, error) { return conn, nil } -func (client *AliyunClient) NewBastionhostClient() (*rpc.Client, error) { - productCode := "bastionhost" +func (client *AliyunClient) NewSasClient() (*rpc.Client, error) { + productCode := "sas" endpoint := "" if v, ok := client.config.Endpoints[productCode]; !ok || v.(string) == "" { if err := client.loadEndpoint(productCode); err != nil { - endpoint = fmt.Sprintf("bastionhost.%s.aliyuncs.com", client.config.RegionId) + endpoint = "sas.aliyuncs.com" + client.config.Endpoints[productCode] = endpoint + log.Printf("[ERROR] loading %s endpoint got an error: %#v. Using the endpoint %s instead.", productCode, err, endpoint) + } + } + if v, ok := client.config.Endpoints[productCode]; ok && v.(string) != "" { + endpoint = v.(string) + } + if endpoint == "" { + return nil, fmt.Errorf("[ERROR] missing the product %s endpoint.", productCode) + } + sdkConfig := client.teaSdkConfig + sdkConfig.SetEndpoint(endpoint) + conn, err := rpc.NewClient(&sdkConfig) + if err != nil { + return nil, fmt.Errorf("unable to initialize the %s client: %#v", productCode, err) + } + return conn, nil +} + +func (client *AliyunClient) NewAlidfsClient() (*rpc.Client, error) { + productCode := "alidfs" + endpoint := "" + if v, ok := client.config.Endpoints[productCode]; !ok || v.(string) == "" { + if err := client.loadEndpoint(productCode); err != nil { + endpoint = fmt.Sprintf("alidfs.%s.aliyuncs.com", client.config.RegionId) + client.config.Endpoints[productCode] = endpoint + log.Printf("[ERROR] loading %s endpoint got an error: %#v. Using the endpoint %s instead.", productCode, err, endpoint) + } + } + if v, ok := client.config.Endpoints[productCode]; ok && v.(string) != "" { + endpoint = v.(string) + } + if endpoint == "" { + return nil, fmt.Errorf("[ERROR] missing the product %s endpoint.", productCode) + } + sdkConfig := client.teaSdkConfig + sdkConfig.SetEndpoint(endpoint) + conn, err := rpc.NewClient(&sdkConfig) + if err != nil { + return nil, fmt.Errorf("unable to initialize the %s client: %#v", productCode, err) + } + return conn, nil +} + +func (client *AliyunClient) NewEhpcClient() (*rpc.Client, error) { + productCode := "ehpc" + endpoint := "" + if v, ok := client.config.Endpoints[productCode]; !ok || v.(string) == "" { + if err := client.loadEndpoint(productCode); err != nil { + endpoint = fmt.Sprintf("ehpc.%s.aliyuncs.com", client.config.RegionId) + client.config.Endpoints[productCode] = endpoint + log.Printf("[ERROR] loading %s endpoint got an error: %#v. Using the endpoint %s instead.", productCode, err, endpoint) + } + } + if v, ok := client.config.Endpoints[productCode]; ok && v.(string) != "" { + endpoint = v.(string) + } + if endpoint == "" { + return nil, fmt.Errorf("[ERROR] missing the product %s endpoint.", productCode) + } + sdkConfig := client.teaSdkConfig + sdkConfig.SetEndpoint(endpoint) + conn, err := rpc.NewClient(&sdkConfig) + if err != nil { + return nil, fmt.Errorf("unable to initialize the %s client: %#v", productCode, err) + } + return conn, nil +} + +func (client *AliyunClient) NewEnsClient() (*rpc.Client, error) { + productCode := "ens" + endpoint := "" + if v, ok := client.config.Endpoints[productCode]; !ok || v.(string) == "" { + if err := client.loadEndpoint(productCode); err != nil { + endpoint = "ens.aliyuncs.com" + client.config.Endpoints[productCode] = endpoint + log.Printf("[ERROR] loading %s endpoint got an error: %#v. Using the endpoint %s instead.", productCode, err, endpoint) + } + } + if v, ok := client.config.Endpoints[productCode]; ok && v.(string) != "" { + endpoint = v.(string) + } + if endpoint == "" { + return nil, fmt.Errorf("[ERROR] missing the product %s endpoint.", productCode) + } + sdkConfig := client.teaSdkConfig + sdkConfig.SetEndpoint(endpoint) + conn, err := rpc.NewClient(&sdkConfig) + if err != nil { + return nil, fmt.Errorf("unable to initialize the %s client: %#v", productCode, err) + } + return conn, nil +} + +func (client *AliyunClient) NewIotClient() (*rpc.Client, error) { + productCode := "iot" + endpoint := "" + if v, ok := client.config.Endpoints[productCode]; !ok || v.(string) == "" { + if err := client.loadEndpoint(productCode); err != nil { + endpoint = fmt.Sprintf("iot.%s.aliyuncs.com", client.config.RegionId) + client.config.Endpoints[productCode] = endpoint + log.Printf("[ERROR] loading %s endpoint got an error: %#v. Using the endpoint %s instead.", productCode, err, endpoint) + } + } + if v, ok := client.config.Endpoints[productCode]; ok && v.(string) != "" { + endpoint = v.(string) + } + if endpoint == "" { + return nil, fmt.Errorf("[ERROR] missing the product %s endpoint.", productCode) + } + sdkConfig := client.teaSdkConfig + sdkConfig.SetEndpoint(endpoint) + conn, err := rpc.NewClient(&sdkConfig) + if err != nil { + return nil, fmt.Errorf("unable to initialize the %s client: %#v", productCode, err) + } + return conn, nil +} + +func (client *AliyunClient) NewImmClient() (*rpc.Client, error) { + productCode := "imm" + endpoint := "" + if v, ok := client.config.Endpoints[productCode]; !ok || v.(string) == "" { + if err := client.loadEndpoint(productCode); err != nil { + endpoint = fmt.Sprintf("imm.%s.aliyuncs.com", client.config.RegionId) + client.config.Endpoints[productCode] = endpoint + log.Printf("[ERROR] loading %s endpoint got an error: %#v. Using the endpoint %s instead.", productCode, err, endpoint) + } + } + if v, ok := client.config.Endpoints[productCode]; ok && v.(string) != "" { + endpoint = v.(string) + } + if endpoint == "" { + return nil, fmt.Errorf("[ERROR] missing the product %s endpoint.", productCode) + } + sdkConfig := client.teaSdkConfig + sdkConfig.SetEndpoint(endpoint) + conn, err := rpc.NewClient(&sdkConfig) + if err != nil { + return nil, fmt.Errorf("unable to initialize the %s client: %#v", productCode, err) + } + return conn, nil +} + +func (client *AliyunClient) NewClickhouseClient() (*rpc.Client, error) { + productCode := "clickhouse" + endpoint := "" + if v, ok := client.config.Endpoints[productCode]; !ok || v.(string) == "" { + if err := client.loadEndpoint(productCode); err != nil { + endpoint = fmt.Sprintf("clickhouse.%s.aliyuncs.com", client.config.RegionId) + client.config.Endpoints[productCode] = endpoint + log.Printf("[ERROR] loading %s endpoint got an error: %#v. Using the endpoint %s instead.", productCode, err, endpoint) + } + } + if v, ok := client.config.Endpoints[productCode]; ok && v.(string) != "" { + endpoint = v.(string) + } + if endpoint == "" { + return nil, fmt.Errorf("[ERROR] missing the product %s endpoint.", productCode) + } + sdkConfig := client.teaSdkConfig + sdkConfig.SetEndpoint(endpoint) + conn, err := rpc.NewClient(&sdkConfig) + if err != nil { + return nil, fmt.Errorf("unable to initialize the %s client: %#v", productCode, err) + } + return conn, nil +} + +func (client *AliyunClient) NewDtsClient() (*rpc.Client, error) { + productCode := "dts" + endpoint := "" + if v, ok := client.config.Endpoints[productCode]; !ok || v.(string) == "" { + if err := client.loadEndpoint(productCode); err != nil { + endpoint = fmt.Sprintf("dts.%s.aliyuncs.com", client.config.RegionId) + client.config.Endpoints[productCode] = endpoint + log.Printf("[ERROR] loading %s endpoint got an error: %#v. Using the endpoint %s instead.", productCode, err, endpoint) + } + } + if v, ok := client.config.Endpoints[productCode]; ok && v.(string) != "" { + endpoint = v.(string) + } + if endpoint == "" { + return nil, fmt.Errorf("[ERROR] missing the product %s endpoint.", productCode) + } + sdkConfig := client.teaSdkConfig + sdkConfig.SetEndpoint(endpoint) + conn, err := rpc.NewClient(&sdkConfig) + if err != nil { + return nil, fmt.Errorf("unable to initialize the %s client: %#v", productCode, err) + } + return conn, nil +} + +func (client *AliyunClient) NewDgClient() (*rpc.Client, error) { + productCode := "dg" + endpoint := "" + if v, ok := client.config.Endpoints[productCode]; !ok || v.(string) == "" { + if err := client.loadEndpoint(productCode); err != nil { + endpoint = fmt.Sprintf("dg.%s.aliyuncs.com", client.config.RegionId) + client.config.Endpoints[productCode] = endpoint + log.Printf("[ERROR] loading %s endpoint got an error: %#v. Using the endpoint %s instead.", productCode, err, endpoint) + } + } + if v, ok := client.config.Endpoints[productCode]; ok && v.(string) != "" { + endpoint = v.(string) + } + if endpoint == "" { + return nil, fmt.Errorf("[ERROR] missing the product %s endpoint.", productCode) + } + sdkConfig := client.teaSdkConfig + sdkConfig.SetEndpoint(endpoint) + conn, err := rpc.NewClient(&sdkConfig) + if err != nil { + return nil, fmt.Errorf("unable to initialize the %s client: %#v", productCode, err) + } + return conn, nil +} + +func (client *AliyunClient) NewCloudssoClient() (*rpc.Client, error) { + productCode := "cloudsso" + endpoint := "cloudsso" + if v, ok := client.config.Endpoints[productCode]; !ok || v.(string) == "" { + if err := client.loadEndpoint(productCode); err != nil { + endpoint = fmt.Sprintf("cloudsso.%s.aliyuncs.com", client.config.RegionId) + client.config.Endpoints[productCode] = endpoint + log.Printf("[ERROR] loading %s endpoint got an error: %#v. Using the endpoint %s instead.", productCode, err, endpoint) + } + } + if v, ok := client.config.Endpoints[productCode]; ok && v.(string) != "" { + endpoint = v.(string) + } + if endpoint == "" { + return nil, fmt.Errorf("[ERROR] missing the product %s endpoint.", productCode) + } + sdkConfig := client.teaSdkConfig + sdkConfig.SetEndpoint(endpoint) + conn, err := rpc.NewClient(&sdkConfig) + if err != nil { + return nil, fmt.Errorf("unable to initialize the %s client: %#v", productCode, err) + } + return conn, nil +} + +func (client *AliyunClient) NewSwasClient() (*rpc.Client, error) { + productCode := "swas" + endpoint := "" + if v, ok := client.config.Endpoints[productCode]; !ok || v.(string) == "" { + if err := client.loadEndpoint(productCode); err != nil { + endpoint = fmt.Sprintf("swas.%s.aliyuncs.com", client.config.RegionId) client.config.Endpoints[productCode] = endpoint log.Printf("[ERROR] loading %s endpoint got an error: %#v. Using the endpoint %s instead.", productCode, err, endpoint) } @@ -3267,3 +3604,426 @@ func (client *AliyunClient) NewBastionhostClient() (*rpc.Client, error) { } return conn, nil } + +func (client *AliyunClient) NewVsClient() (*rpc.Client, error) { + productCode := "vs" + endpoint := "" + if v, ok := client.config.Endpoints[productCode]; !ok || v.(string) == "" { + if err := client.loadEndpoint(productCode); err != nil { + endpoint = fmt.Sprintf("vs.%s.aliyuncs.com", client.config.RegionId) + client.config.Endpoints[productCode] = endpoint + log.Printf("[ERROR] loading %s endpoint got an error: %#v. Using the endpoint %s instead.", productCode, err, endpoint) + } + } + if v, ok := client.config.Endpoints[productCode]; ok && v.(string) != "" { + endpoint = v.(string) + } + if endpoint == "" { + return nil, fmt.Errorf("[ERROR] missing the product %s endpoint.", productCode) + } + sdkConfig := client.teaSdkConfig + sdkConfig.SetEndpoint(endpoint) + conn, err := rpc.NewClient(&sdkConfig) + if err != nil { + return nil, fmt.Errorf("unable to initialize the %s client: %#v", productCode, err) + } + return conn, nil +} + +func (client *AliyunClient) NewQuickbiClient() (*rpc.Client, error) { + productCode := "quickbi" + endpoint := "" + if v, ok := client.config.Endpoints[productCode]; !ok || v.(string) == "" { + if err := client.loadEndpoint(productCode); err != nil { + endpoint = fmt.Sprintf("quickbi.%s.aliyuncs.com", client.config.RegionId) + client.config.Endpoints[productCode] = endpoint + log.Printf("[ERROR] loading %s endpoint got an error: %#v. Using the endpoint %s instead.", productCode, err, endpoint) + } + } + if v, ok := client.config.Endpoints[productCode]; ok && v.(string) != "" { + endpoint = v.(string) + } + if endpoint == "" { + return nil, fmt.Errorf("[ERROR] missing the product %s endpoint.", productCode) + } + sdkConfig := client.teaSdkConfig + sdkConfig.SetEndpoint(endpoint) + conn, err := rpc.NewClient(&sdkConfig) + if err != nil { + return nil, fmt.Errorf("unable to initialize the %s client: %#v", productCode, err) + } + return conn, nil +} + +func (client *AliyunClient) NewDevopsrdcClient() (*rpc.Client, error) { + productCode := "rdcdevops" + endpoint := "" + if v, ok := client.config.Endpoints[productCode]; !ok || v.(string) == "" { + if err := client.loadEndpoint(productCode); err != nil { + endpoint = fmt.Sprintf("api-devops.%s.aliyuncs.com", client.config.RegionId) + client.config.Endpoints[productCode] = endpoint + log.Printf("[ERROR] loading %s endpoint got an error: %#v. Using the endpoint %s instead.", productCode, err, endpoint) + } + } + if v, ok := client.config.Endpoints[productCode]; ok && v.(string) != "" { + endpoint = v.(string) + } + if endpoint == "" { + return nil, fmt.Errorf("[ERROR] missing the product %s endpoint.", productCode) + } + sdkConfig := client.teaSdkConfig + sdkConfig.SetEndpoint(endpoint) + conn, err := rpc.NewClient(&sdkConfig) + if err != nil { + return nil, fmt.Errorf("unable to initialize the %s client: %#v", productCode, err) + } + return conn, nil +} + +func (client *AliyunClient) NewVodClient() (*rpc.Client, error) { + productCode := "vod" + endpoint := "" + if v, ok := client.config.Endpoints[productCode]; !ok || v.(string) == "" { + if err := client.loadEndpoint(productCode); err != nil { + endpoint = fmt.Sprintf("vod.%s.aliyuncs.com", client.config.RegionId) + client.config.Endpoints[productCode] = endpoint + log.Printf("[ERROR] loading %s endpoint got an error: %#v. Using the endpoint %s instead.", productCode, err, endpoint) + } + } + if v, ok := client.config.Endpoints[productCode]; ok && v.(string) != "" { + endpoint = v.(string) + } + if endpoint == "" { + return nil, fmt.Errorf("[ERROR] missing the product %s endpoint.", productCode) + } + sdkConfig := client.teaSdkConfig + sdkConfig.SetEndpoint(endpoint) + conn, err := rpc.NewClient(&sdkConfig) + if err != nil { + return nil, fmt.Errorf("unable to initialize the %s client: %#v", productCode, err) + } + return conn, nil +} + +func (client *AliyunClient) NewOpensearchClient() (*roa.Client, error) { + productCode := "opensearch" + endpoint := "" + if v, ok := client.config.Endpoints[productCode]; !ok || v.(string) == "" { + if err := client.loadEndpoint(productCode); err != nil { + endpoint = fmt.Sprintf("opensearch.%s.aliyuncs.com", client.config.RegionId) + client.config.Endpoints[productCode] = endpoint + log.Printf("[ERROR] loading %s endpoint got an error: %#v. Using the endpoint %s instead.", productCode, err, endpoint) + } + } + if v, ok := client.config.Endpoints[productCode]; ok && v.(string) != "" { + endpoint = v.(string) + } + if endpoint == "" { + return nil, fmt.Errorf("[ERROR] missing the product %s endpoint.", productCode) + } + sdkConfig := client.teaRoaSdkConfig + sdkConfig.SetEndpoint(endpoint) + conn, err := roa.NewClient(&sdkConfig) + if err != nil { + return nil, fmt.Errorf("unable to initialize the %s client: %#v", productCode, err) + } + return conn, nil +} + +func (client *AliyunClient) NewGdsClient() (*rpc.Client, error) { + productCode := "gds" + endpoint := "" + if v, ok := client.config.Endpoints[productCode]; !ok || v.(string) == "" { + if err := client.loadEndpoint(productCode); err != nil { + endpoint = fmt.Sprintf("gds.%s.aliyuncs.com", client.config.RegionId) + client.config.Endpoints[productCode] = endpoint + log.Printf("[ERROR] loading %s endpoint got an error: %#v. Using the endpoint %s instead.", productCode, err, endpoint) + } + } + if v, ok := client.config.Endpoints[productCode]; ok && v.(string) != "" { + endpoint = v.(string) + } + if endpoint == "" { + return nil, fmt.Errorf("[ERROR] missing the product %s endpoint.", productCode) + } + sdkConfig := client.teaSdkConfig + sdkConfig.SetEndpoint(endpoint) + conn, err := rpc.NewClient(&sdkConfig) + if err != nil { + return nil, fmt.Errorf("unable to initialize the %s client: %#v", productCode, err) + } + return conn, nil +} + +func (client *AliyunClient) NewDbfsClient() (*rpc.Client, error) { + productCode := "dbfs" + endpoint := "" + if v, ok := client.config.Endpoints[productCode]; !ok || v.(string) == "" { + if err := client.loadEndpoint(productCode); err != nil { + endpoint = fmt.Sprintf("dbfs.%s.aliyuncs.com", client.config.RegionId) + client.config.Endpoints[productCode] = endpoint + log.Printf("[ERROR] loading %s endpoint got an error: %#v. Using the endpoint %s instead.", productCode, err, endpoint) + } + } + if v, ok := client.config.Endpoints[productCode]; ok && v.(string) != "" { + endpoint = v.(string) + } + if endpoint == "" { + return nil, fmt.Errorf("[ERROR] missing the product %s endpoint.", productCode) + } + sdkConfig := client.teaSdkConfig + sdkConfig.SetEndpoint(endpoint) + conn, err := rpc.NewClient(&sdkConfig) + if err != nil { + return nil, fmt.Errorf("unable to initialize the %s client: %#v", productCode, err) + } + return conn, nil +} + +func (client *AliyunClient) NewEaisClient() (*rpc.Client, error) { + productCode := "eais" + endpoint := "" + if v, ok := client.config.Endpoints[productCode]; !ok || v.(string) == "" { + if err := client.loadEndpoint(productCode); err != nil { + endpoint = fmt.Sprintf("eais.%s.aliyuncs.com", client.config.RegionId) + client.config.Endpoints[productCode] = endpoint + log.Printf("[ERROR] loading %s endpoint got an error: %#v. Using the endpoint %s instead.", productCode, err, endpoint) + } + } + if v, ok := client.config.Endpoints[productCode]; ok && v.(string) != "" { + endpoint = v.(string) + } + if endpoint == "" { + return nil, fmt.Errorf("[ERROR] missing the product %s endpoint.", productCode) + } + sdkConfig := client.teaSdkConfig + sdkConfig.SetEndpoint(endpoint) + conn, err := rpc.NewClient(&sdkConfig) + if err != nil { + return nil, fmt.Errorf("unable to initialize the %s client: %#v", productCode, err) + } + return conn, nil +} + +func (client *AliyunClient) NewCloudauthClient() (*rpc.Client, error) { + productCode := "cloudauth" + endpoint := "" + if v, ok := client.config.Endpoints[productCode]; !ok || v.(string) == "" { + if err := client.loadEndpoint(productCode); err != nil { + endpoint = "cloudauth.aliyuncs.com" + client.config.Endpoints[productCode] = endpoint + log.Printf("[ERROR] loading %s endpoint got an error: %#v. Using the endpoint %s instead.", productCode, err, endpoint) + } + } + if v, ok := client.config.Endpoints[productCode]; ok && v.(string) != "" { + endpoint = v.(string) + } + if endpoint == "" { + return nil, fmt.Errorf("[ERROR] missing the product %s endpoint.", productCode) + } + sdkConfig := client.teaSdkConfig + sdkConfig.SetEndpoint(endpoint) + conn, err := rpc.NewClient(&sdkConfig) + if err != nil { + return nil, fmt.Errorf("unable to initialize the %s client: %#v", productCode, err) + } + return conn, nil +} + +func (client *AliyunClient) NewImpClient() (*rpc.Client, error) { + productCode := "imp" + endpoint := "" + if v, ok := client.config.Endpoints[productCode]; !ok || v.(string) == "" { + if err := client.loadEndpoint(productCode); err != nil { + endpoint = "imp.aliyuncs.com" + client.config.Endpoints[productCode] = endpoint + log.Printf("[ERROR] loading %s endpoint got an error: %#v. Using the endpoint %s instead.", productCode, err, endpoint) + } + } + if v, ok := client.config.Endpoints[productCode]; ok && v.(string) != "" { + endpoint = v.(string) + } + if endpoint == "" { + return nil, fmt.Errorf("[ERROR] missing the product %s endpoint.", productCode) + } + sdkConfig := client.teaSdkConfig + sdkConfig.SetEndpoint(endpoint) + conn, err := rpc.NewClient(&sdkConfig) + if err != nil { + return nil, fmt.Errorf("unable to initialize the %s client: %#v", productCode, err) + } + return conn, nil +} + +func (client *AliyunClient) NewMhubClient() (*rpc.Client, error) { + productCode := "emas" + endpoint := "" + if v, ok := client.config.Endpoints[productCode]; !ok || v.(string) == "" { + if err := client.loadEndpoint(productCode); err != nil { + return nil, fmt.Errorf("[ERROR] loading %s endpoint got an error: %#v. Using the endpoint %s instead.\"", productCode, err, fmt.Sprintf("mhub.%s.aliyuncs.com", client.config.RegionId)) + } + } + if v, ok := client.config.Endpoints[productCode]; ok && v.(string) != "" { + endpoint = v.(string) + } + if endpoint == "" { + return nil, fmt.Errorf("[ERROR] missing the product %s endpoint.", productCode) + } + sdkConfig := client.teaSdkConfig + sdkConfig.SetEndpoint(endpoint) + conn, err := rpc.NewClient(&sdkConfig) + if err != nil { + return nil, fmt.Errorf("unable to initialize the %s client: %#v", productCode, err) + } + return conn, nil +} +func (client *AliyunClient) NewServicemeshClient() (*rpc.Client, error) { + productCode := "servicemesh" + endpoint := "" + if v, ok := client.config.Endpoints[productCode]; !ok || v.(string) == "" { + if err := client.loadEndpoint(productCode); err != nil { + endpoint = fmt.Sprintf("servicemesh.%s.aliyuncs.com", client.config.RegionId) + client.config.Endpoints[productCode] = endpoint + log.Printf("[ERROR] loading %s endpoint got an error: %#v. Using the endpoint %s instead.", productCode, err, endpoint) + } + } + if v, ok := client.config.Endpoints[productCode]; ok && v.(string) != "" { + endpoint = v.(string) + } + if endpoint == "" { + return nil, fmt.Errorf("[ERROR] missing the product %s endpoint.", productCode) + } + sdkConfig := client.teaSdkConfig + sdkConfig.SetEndpoint(endpoint) + conn, err := rpc.NewClient(&sdkConfig) + if err != nil { + return nil, fmt.Errorf("unable to initialize the %s client: %#v", productCode, err) + } + return conn, nil +} + +func (client *AliyunClient) NewAcrClient() (*rpc.Client, error) { + productCode := "acr" + endpoint := "" + if v, ok := client.config.Endpoints[productCode]; !ok || v.(string) == "" { + if err := client.loadEndpoint(productCode); err != nil { + endpoint = fmt.Sprintf("acr.%s.aliyuncs.com", client.config.RegionId) + client.config.Endpoints[productCode] = endpoint + log.Printf("[ERROR] loading %s endpoint got an error: %#v. Using the endpoint %s instead.", productCode, err, endpoint) + } + } + if v, ok := client.config.Endpoints[productCode]; ok && v.(string) != "" { + endpoint = v.(string) + } + if endpoint == "" { + return nil, fmt.Errorf("[ERROR] missing the product %s endpoint.", productCode) + } + sdkConfig := client.teaSdkConfig + sdkConfig.SetEndpoint(endpoint) + conn, err := rpc.NewClient(&sdkConfig) + if err != nil { + return nil, fmt.Errorf("unable to initialize the %s client: %#v", productCode, err) + } + return conn, nil +} + +func (client *AliyunClient) NewEdsuserClient() (*rpc.Client, error) { + productCode := "eds-user" + endpoint := "" + if v, ok := client.config.Endpoints[productCode]; !ok || v.(string) == "" { + if err := client.loadEndpoint(productCode); err != nil { + endpoint = fmt.Sprintf("eds-user.%s.aliyuncs.com", client.config.RegionId) + client.config.Endpoints[productCode] = endpoint + log.Printf("[ERROR] loading %s endpoint got an error: %#v. Using the endpoint %s instead.", productCode, err, endpoint) + } + } + if v, ok := client.config.Endpoints[productCode]; ok && v.(string) != "" { + endpoint = v.(string) + } + if endpoint == "" { + return nil, fmt.Errorf("[ERROR] missing the product %s endpoint.", productCode) + } + sdkConfig := client.teaSdkConfig + sdkConfig.SetEndpoint(endpoint) + conn, err := rpc.NewClient(&sdkConfig) + if err != nil { + return nil, fmt.Errorf("unable to initialize the %s client: %#v", productCode, err) + } + return conn, nil +} + +func (client *AliyunClient) NewEmrClient() (*rpc.Client, error) { + productCode := "emr" + endpoint := "" + if v, ok := client.config.Endpoints[productCode]; !ok || v.(string) == "" { + if err := client.loadEndpoint(productCode); err != nil { + endpoint = fmt.Sprintf("emr.%s.aliyuncs.com", client.config.RegionId) + client.config.Endpoints[productCode] = endpoint + log.Printf("[ERROR] loading %s endpoint got an error: %#v. Using the endpoint %s instead.", productCode, err, endpoint) + } + } + if v, ok := client.config.Endpoints[productCode]; ok && v.(string) != "" { + endpoint = v.(string) + } + if endpoint == "" { + return nil, fmt.Errorf("[ERROR] missing the product %s endpoint.", productCode) + } + sdkConfig := client.teaSdkConfig + sdkConfig.SetEndpoint(endpoint) + conn, err := rpc.NewClient(&sdkConfig) + if err != nil { + return nil, fmt.Errorf("unable to initialize the %s client: %#v", productCode, err) + } + return conn, nil +} + +func (client *AliyunClient) NewDdsClient() (*rpc.Client, error) { + productCode := "dds" + endpoint := "" + if v, ok := client.config.Endpoints[productCode]; !ok || v.(string) == "" { + if err := client.loadEndpoint(productCode); err != nil { + endpoint = fmt.Sprintf("dds.%s.aliyuncs.com", client.config.RegionId) + client.config.Endpoints[productCode] = endpoint + log.Printf("[ERROR] loading %s endpoint got an error: %#v. Using the endpoint %s instead.", productCode, err, endpoint) + } + } + if v, ok := client.config.Endpoints[productCode]; ok && v.(string) != "" { + endpoint = v.(string) + } + if endpoint == "" { + return nil, fmt.Errorf("[ERROR] missing the product %s endpoint.", productCode) + } + sdkConfig := client.teaSdkConfig + sdkConfig.SetEndpoint(endpoint) + conn, err := rpc.NewClient(&sdkConfig) + if err != nil { + return nil, fmt.Errorf("unable to initialize the %s client: %#v", productCode, err) + } + return conn, nil +} + +func (client *AliyunClient) NewAlikafkaClient() (*rpc.Client, error) { + productCode := "alikafka" + endpoint := "" + if v, ok := client.config.Endpoints[productCode]; !ok || v.(string) == "" { + if err := client.loadEndpoint(productCode); err != nil { + return nil, err + } + } + if v, ok := client.config.Endpoints[productCode]; ok && v.(string) != "" { + endpoint = v.(string) + } + if endpoint == "" { + return nil, fmt.Errorf("[ERROR] missing the product %s endpoint.", productCode) + } + + sdkConfig := client.teaSdkConfig + sdkConfig.SetEndpoint(endpoint) + + conn, err := rpc.NewClient(&sdkConfig) + if err != nil { + return nil, fmt.Errorf("unable to initialize the %s client: %#v", productCode, err) + } + + return conn, nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity/config.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity/config.go index 48c51718298..7d4a6f212d2 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity/config.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity/config.go @@ -23,7 +23,6 @@ var securityCredURL = "http://100.100.100.200/latest/meta-data/ram/security-cred // Config of aliyun type Config struct { - SourceIp string AccessKey string SecretKey string EcsRoleName string @@ -35,6 +34,8 @@ type Config struct { Protocol string ClientReadTimeout int ClientConnectTimeout int + SourceIp string + SecureTransport string RamRoleArn string RamRoleSessionName string @@ -132,6 +133,34 @@ type Config struct { MscopensubscriptionEndpoint string SddpEndpoint string BastionhostEndpoint string + SasEndpoint string + AlidfsEndpoint string + EhpcEndpoint string + EnsEndpoint string + IotEndpoint string + ImmEndpoint string + ClickhouseEndpoint string + DtsEndpoint string + DgEndpoint string + CloudssoEndpoint string + WafEndpoint string + SwasEndpoint string + VsEndpoint string + QuickbiEndpoint string + VodEndpoint string + OpensearchEndpoint string + GdsEndpoint string + DbfsEndpoint string + DevopsrdcEndpoint string + EaisEndpoint string + CloudauthEndpoint string + ImpEndpoint string + MhubEndpoint string + ServicemeshEndpoint string + AcrEndpoint string + EdsuserEndpoint string + GpdbEndpoint string + GaplusEndpoint string } func (c *Config) loadAndValidate() error { @@ -268,6 +297,13 @@ func (c *Config) getTeaDslSdkConfig(stsSupported bool) (config rpc.Config, err e SetReadTimeout(c.ClientReadTimeout). SetConnectTimeout(c.ClientConnectTimeout). SetMaxIdleConns(500) + if c.SourceIp != "" { + config.SetSourceIp(c.SourceIp) + } + if c.SecureTransport != "" { + config.SetSecureTransport(c.SecureTransport) + } + return } func (c *Config) getTeaRoaDslSdkConfig(stsSupported bool) (config roa.Config, err error) { @@ -280,6 +316,12 @@ func (c *Config) getTeaRoaDslSdkConfig(stsSupported bool) (config roa.Config, er SetReadTimeout(c.ClientReadTimeout). SetConnectTimeout(c.ClientConnectTimeout). SetMaxIdleConns(500) + if c.SourceIp != "" { + config.SetSourceIp(c.SourceIp) + } + if c.SecureTransport != "" { + config.SetSecureTransport(c.SecureTransport) + } return } func (c *Config) getCredentialConfig(stsSupported bool) *credential.Config { diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity/endpoint.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity/endpoint.go index d1f789a9250..3d2ce73ba84 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity/endpoint.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity/endpoint.go @@ -181,7 +181,10 @@ func (client *AliyunClient) loadEndpoint(productCode string) error { if serviceCode == "" { serviceCode = productCode } - _, err := client.describeEndpointForService(serviceCode) + endpoint, err := client.describeEndpointForService(serviceCode) + if err == nil { + client.config.Endpoints[strings.ToLower(serviceCode)] = endpoint + } return err } @@ -259,7 +262,6 @@ func (client *AliyunClient) describeEndpointForService(serviceCode string) (stri if endpointsResponse != nil && len(endpointsResponse.Endpoints.Endpoint) > 0 { for _, e := range endpointsResponse.Endpoints.Endpoint { if e.Type == "openAPI" { - client.config.Endpoints[strings.ToLower(serviceCode)] = e.Endpoint endpointResult = e.Endpoint return nil } @@ -307,4 +309,5 @@ const ( const ( BssOpenAPIEndpointDomestic = "business.aliyuncs.com" BssOpenAPIEndpointInternational = "business.ap-southeast-1.aliyuncs.com" + EcdOpenAPIEndpointUser = "eds-user.ap-southeast-1.aliyuncs.com" ) diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity/regions.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity/regions.go index 602c84869bf..d20a75cccd1 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity/regions.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity/regions.go @@ -23,6 +23,7 @@ const ( APSouthEast2 = Region("ap-southeast-2") APSouthEast3 = Region("ap-southeast-3") APSouthEast5 = Region("ap-southeast-5") + APSouthEast6 = Region("ap-southeast-6") APSouth1 = Region("ap-south-1") @@ -34,6 +35,8 @@ const ( EUCentral1 = Region("eu-central-1") EUWest1 = Region("eu-west-1") + RusWest1 = Region("rus-west-1") + ShenZhenFinance = Region("cn-shenzhen-finance-1") ShanghaiFinance = Region("cn-shanghai-finance-1") ShanghaiFinance1Pub = Region("cn-shanghai-finance-1-pub") @@ -43,7 +46,7 @@ const ( var ValidRegions = []Region{ Hangzhou, Qingdao, Beijing, Shenzhen, Hongkong, Shanghai, Zhangjiakou, Huhehaote, ChengDu, HeYuan, WuLanChaBu, GuangZhou, USWest1, USEast1, - APNorthEast1, APSouthEast1, APSouthEast2, APSouthEast3, APSouthEast5, + APNorthEast1, APSouthEast1, APSouthEast2, APSouthEast3, APSouthEast5, APSouthEast6, APSouth1, MEEast1, EUCentral1, EUWest1, @@ -52,6 +55,7 @@ var ValidRegions = []Region{ var EcsClassicSupportedRegions = []Region{Shenzhen, Shanghai, Beijing, Qingdao, Hangzhou, Hongkong, USWest1, APSouthEast1} var EcsSpotNoSupportedRegions = []Region{APSouth1} +var EcsSccSupportedRegions = []Region{Shanghai, Beijing, Zhangjiakou} var SlbGuaranteedSupportedRegions = []Region{Qingdao, Beijing, Hangzhou, Shanghai, Shenzhen, Zhangjiakou, Huhehaote, APSouthEast1, USEast1} var DrdsSupportedRegions = []Region{Beijing, Shenzhen, Hangzhou, Qingdao, Hongkong, Shanghai, Huhehaote, Zhangjiakou, APSouthEast1} var DrdsClassicNoSupportedRegions = []Region{Hongkong} @@ -73,12 +77,12 @@ var RdsMultiAzNoSupportedRegions = []Region{Qingdao, APNorthEast1, APSouthEast5, var RdsPPASNoSupportedRegions = []Region{Qingdao, USEast1, APNorthEast1, EUCentral1, MEEast1, APSouthEast2, APSouthEast3, APSouth1, APSouthEast5, ChengDu, EUWest1} var RouteTableNoSupportedRegions = []Region{Beijing, Hangzhou, Shenzhen} var ApiGatewayNoSupportedRegions = []Region{Zhangjiakou, Huhehaote, USEast1, USWest1, EUWest1, MEEast1} -var OtsHighPerformanceNoSupportedRegions = []Region{Qingdao, Zhangjiakou, Huhehaote, Hongkong, APSouthEast1, APSouthEast2, APSouthEast5, APNorthEast1, EUCentral1, MEEast1, APSouth1} +var OtsHighPerformanceNoSupportedRegions = []Region{Qingdao, Zhangjiakou, Huhehaote, APSouthEast2, APSouthEast5, APNorthEast1, EUCentral1, MEEast1} var OtsCapacityNoSupportedRegions = []Region{APSouthEast1, USWest1, USEast1} var PrivateIpNoSupportedRegions = []Region{Beijing, Hangzhou, Shenzhen} var SwarmSupportedRegions = []Region{Qingdao, Beijing, Zhangjiakou, Huhehaote, Hangzhou, Shanghai, Shenzhen, Hongkong, APNorthEast1, APSouthEast1, APSouthEast2, APSouthEast3, USWest1, USEast1, EUCentral1} -var ManagedKubernetesSupportedRegions = []Region{Beijing, Hangzhou, Shanghai, Shenzhen, ChengDu, Hongkong, APSouthEast1, APSouthEast2, USWest1} +var ManagedKubernetesSupportedRegions = []Region{Beijing, Hangzhou, Shanghai, Shenzhen, ChengDu, Hongkong, APSouthEast1, APSouthEast2, EUCentral1, USWest1} var ServerlessKubernetesSupportedRegions = []Region{Beijing, Hangzhou, Shanghai, APSouthEast1, APSouthEast3, APSouthEast5, APSouth1, Huhehaote} var KubernetesSupportedRegions = []Region{Beijing, Zhangjiakou, Huhehaote, Hangzhou, Shanghai, Shenzhen, Hongkong, APNorthEast1, APSouthEast1, APSouthEast2, APSouthEast3, APSouthEast5, APSouth1, USEast1, USWest1, EUWest1, MEEast1, EUCentral1} @@ -104,7 +108,7 @@ var YundunDbauditSupportedRegions = []Region{Hangzhou, Beijing, Shanghai} var HttpHttpsHealthCheckMehtodSupportedRegions = []Region{Hangzhou, Beijing, Shanghai, EUWest1, ChengDu, Qingdao, Hongkong, Shenzhen, APSouthEast5, Zhangjiakou, Huhehaote, MEEast1, APSouth1, EUCentral1, USWest1, APSouthEast3, APSouthEast2, APSouthEast1, APNorthEast1} var HBaseClassicSupportedRegions = []Region{Hangzhou, Beijing, Shanghai, Shenzhen} var EdasSupportedRegions = []Region{Hangzhou, Beijing, Shanghai, Shenzhen, Zhangjiakou, Qingdao, Hongkong} -var CloudConfigSupportedRegions = []Region{Shanghai, APSouthEast1} +var CloudConfigSupportedRegions = []Region{Shanghai} var DBReadwriteSplittingConnectionSupportedRegions = []Region{APSouthEast1} var KVstoreClassicNetworkInstanceSupportRegions = []Region{Hangzhou, Beijing, Shanghai, APSouthEast1, USEast1, USWest1} var MaxComputeSupportRegions = []Region{} @@ -117,15 +121,55 @@ var EipanycastSupportRegions = []Region{Hangzhou} var VpcIpv6SupportRegions = []Region{Hangzhou, Shanghai, Shenzhen, Beijing, Huhehaote, Hongkong, APSouthEast1} var EssdSupportRegions = []Region{Zhangjiakou, Huhehaote} var AdbReserverUnSupportRegions = []Region{EUCentral1} -var KmsKeyUnSupportRegions = []Region{EUCentral1} -var DmSupportRegions = []Region{Hangzhou, APSouthEast1, APSouthEast2} +var KmsKeyHSMSupportRegions = []Region{Beijing, Zhangjiakou, Hangzhou, Shanghai, Shenzhen, Hongkong, APSouthEast1, APSouthEast2, APSouthEast3, APSouthEast5, USEast1} +var DmSupportRegions = []Region{Hangzhou} var BssOpenApiSupportRegions = []Region{Hangzhou, Shanghai, APSouthEast1} var EipAddressBGPProSupportRegions = []Region{Hongkong} var CenTransitRouterVpcAttachmentSupportRegions = []Region{Hangzhou} var ARMSSupportRegions = []Region{Hangzhou, Shanghai, Beijing, APSouthEast1} var SaeSupportRegions = []Region{Hangzhou, Shanghai, Beijing, Zhangjiakou, Shenzhen, USWest1} +var HbrSupportRegions = []Region{Hangzhou} var EcdSupportRegions = []Region{Hangzhou, Shanghai, Beijing, Shenzhen, Hongkong, APSouthEast1, APSouthEast2} var EcpSupportRegions = []Region{Hangzhou, Shanghai, Beijing, Shenzhen} -var CsgSupportRegions = []Region{Shanghai} var SddpSupportRegions = []Region{Hangzhou, Zhangjiakou, APSouthEast1} var CddcSupportRegions = []Region{Shenzhen, Beijing, APSouth1, EUWest1, APNorthEast1, MEEast1, ChengDu, Qingdao, Shanghai, Hongkong, HeYuan, APSouthEast1, APSouthEast2, APSouthEast3, EUCentral1, Huhehaote, APSouthEast5, USEast1, Zhangjiakou, USWest1, Hangzhou} +var DfsSupportRegions = []Region{Hangzhou, Zhangjiakou, Shanghai, Beijing, HeYuan, ChengDu, APSouthEast5, USEast1, RusWest1} +var EventBridgeSupportRegions = []Region{Hangzhou, Zhangjiakou, Shanghai, Shenzhen, Beijing, HeYuan, ChengDu, Huhehaote, Hongkong, EUCentral1, USWest1, USEast1} +var AlbSupportRegions = []Region{Hangzhou, Shanghai, Qingdao, Zhangjiakou, Beijing, WuLanChaBu, Shenzhen, ChengDu, Hongkong, APSouthEast1, APSouthEast2, APSouthEast3, APSouthEast5, APNorthEast1, EUCentral1, USEast1, APSouth1} +var IMMSupportRegions = []Region{Hangzhou, Zhangjiakou, APSouthEast1, Shenzhen, Beijing, Shanghai} +var CenTRSupportRegions = []Region{Hangzhou, Shanghai, Beijing, Shenzhen, Hongkong, APSouthEast1, USEast1, APSouth1} +var VbrSupportRegions = []Region{Hangzhou} +var ClickHouseSupportRegions = []Region{Hangzhou, Qingdao, Beijing, Shenzhen, Hongkong, Shanghai, Zhangjiakou, Huhehaote, ChengDu, USWest1, USEast1, APSouthEast1, EUCentral1, EUWest1, APNorthEast1, APSouthEast1, APSouthEast5} +var DatabaseGatewaySupportRegions = []Region{Hangzhou, Zhangjiakou, Shanghai, Beijing, Qingdao, Huhehaote, Shenzhen, ChengDu, Hongkong, APNorthEast1, APSouth1, APSouthEast1, APSouthEast2, APSouthEast3, EUWest1, EUCentral1, APSouthEast5, USWest1, USEast1} +var CloudSsoSupportRegions = []Region{Shanghai, USWest1} +var SWASSupportRegions = []Region{Qingdao, Hangzhou, Beijing, Shenzhen, Shanghai, GuangZhou, Huhehaote, ChengDu, Zhangjiakou, Hongkong, APSouthEast1} +var SurveillanceSystemSupportRegions = []Region{Beijing, Shenzhen, Qingdao} +var VodSupportRegions = []Region{Shanghai} +var OpenSearchSupportRegions = []Region{Beijing, Shenzhen, Hangzhou, Zhangjiakou, Qingdao, Shanghai, APSouthEast1} +var GraphDatabaseSupportRegions = []Region{Shenzhen, Beijing, Qingdao, Shanghai, Hongkong, Zhangjiakou, Hangzhou, APSouthEast1, APSouthEast5, USWest1, USEast1, APSouth1} +var DBFSSystemSupportRegions = []Region{Hangzhou} +var EAISSystemSupportRegions = []Region{Hangzhou} +var CloudAuthSupportRegions = []Region{Hangzhou} +var MHUBSupportRegions = []Region{Shanghai} +var ActiontrailSupportRegions = []Region{Hangzhou, Qingdao, Beijing, Shenzhen, Hongkong, Shanghai, Zhangjiakou, Huhehaote, ChengDu, HeYuan, WuLanChaBu, GuangZhou, APSouthEast1, APSouthEast2, APSouthEast3, APSouthEast5, APNorthEast1, USWest1, USEast1, EUCentral1, EUWest1, APSouth1, MEEast1} +var VpcTrafficMirrorSupportRegions = []Region{Qingdao, Huhehaote, Shenzhen, Hongkong, APSouthEast2, ChengDu, USEast1, USWest1, EUWest1} +var EcdUserSupportRegions = []Region{Shanghai} +var VpcIpv6GatewaySupportRegions = []Region{Qingdao, Beijing, Zhangjiakou, Huhehaote, WuLanChaBu, Hangzhou, Shanghai, Shenzhen, GuangZhou, Hongkong, ChengDu, HeYuan, APSouthEast1, APSouthEast6, USEast1, EUCentral1} +var CmsDynamicTagGroupSupportRegions = []Region{Shanghai} +var OOSApplicationSupportRegions = []Region{Hangzhou} +var DTSSupportRegions = []Region{Hangzhou, APSouth1, ShenZhenFinance, CnNorth2Gov1, Qingdao, ShanghaiFinance, USWest1, APNorthEast1, Beijing, Hongkong, APSouthEast1, APSouthEast3, EUCentral1, APSouthEast5, Shenzhen, APSouthEast2, Huhehaote, USEast1, Zhangjiakou, EUWest1, MEEast1, Shanghai} +var OOSSupportRegions = []Region{APSouthEast5, USWest1, EUWest1, Qingdao, ChengDu, Shanghai, Huhehaote, Shenzhen, APNorthEast1, APSouthEast1, EUCentral1, Hangzhou, Beijing, APSouth1, APSouthEast3, USEast1, Zhangjiakou, Hongkong, APSouthEast2} +var MongoDBSupportRegions = []Region{APSouth1, Shanghai, APSouthEast2, WuLanChaBu, CnNorth2Gov1, Hangzhou, Beijing, Qingdao, Zhangjiakou, USWest1, GuangZhou, APSouthEast6, EUWest1, ChengDu, APSouthEast1, APSouthEast3, APSouthEast5, ShanghaiFinance, Hongkong, HeYuan, Huhehaote, USEast1, EUCentral1, APNorthEast1, Shenzhen, ShenZhenFinance, MEEast1} +var MongoDBServerlessSupportRegions = []Region{APSouthEast5, Shanghai, USEast1, Hongkong, HeYuan, Zhangjiakou, APSouthEast6, GuangZhou, Huhehaote, Beijing, Shenzhen, WuLanChaBu, ChengDu, Hangzhou, Qingdao, USWest1, APSouthEast1} +var FnFSupportRegions = []Region{Shenzhen, Beijing, Shanghai, APSouthEast1, USWest1, Hangzhou} +var GaSupportRegions = []Region{Hangzhou, APSouthEast1} +var AlidnsSupportRegions = []Region{Hangzhou, APSouthEast1} +var VPCVbrHaSupportRegions = []Region{Hangzhou} +var ROSSupportRegions = []Region{USWest1, HeYuan, Zhangjiakou, Hongkong, APSouthEast3, EUCentral1, Huhehaote, APSouthEast6, Shenzhen, APSouth1, Qingdao, GuangZhou, APSouthEast2, WuLanChaBu, EUWest1, MEEast1, ChengDu, Shanghai, APSouthEast1, APSouthEast5, USEast1, Beijing, APNorthEast1, Hangzhou} +var VPCBgpGroupSupportRegions = []Region{Hangzhou} +var NASSupportRegions = []Region{HeYuan, Huhehaote, APSouthEast5, WuLanChaBu, CnNorth2Gov1, Qingdao, ChengDu, Hangzhou, APSouth1, ShenZhenFinance, EUCentral1, Shenzhen, APSouthEast2, Beijing, Shanghai, ShanghaiFinance, APSouthEast1, APSouthEast6, APNorthEast1, APSouthEast3, GuangZhou, USEast1, EUWest1, Hongkong, Zhangjiakou, USWest1} +var HBRSupportRegions = []Region{Beijing, ChengDu, Huhehaote, Qingdao, Shanghai, Shenzhen, Zhangjiakou, Hangzhou} +var NASCPFSSupportRegions = []Region{Hangzhou, Shenzhen, Beijing, Shanghai, HeYuan, Huhehaote, WuLanChaBu, Qingdao, ChengDu, APSouthEast1} +var WAFSupportRegions = []Region{Hangzhou, APSouth1} +var MSCSupportRegions = []Region{Hangzhou} +var FCSupportRegions = []Region{Hangzhou} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_actiontrail_history_delivery_jobs.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_actiontrail_history_delivery_jobs.go new file mode 100644 index 00000000000..87bbc92fc5e --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_actiontrail_history_delivery_jobs.go @@ -0,0 +1,225 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudActiontrailHistoryDeliveryJobs() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudActiontrailHistoryDeliveryJobsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "status": { + Type: schema.TypeInt, + Optional: true, + ForceNew: true, + ValidateFunc: validation.IntInSlice([]int{0, 1, 2, 3}), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "jobs": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "end_time": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "history_delivery_job_id": { + Type: schema.TypeString, + Computed: true, + }, + "home_region": { + Type: schema.TypeString, + Computed: true, + }, + "start_time": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeInt, + Computed: true, + }, + "trail_name": { + Type: schema.TypeString, + Computed: true, + }, + "updated_time": { + Type: schema.TypeString, + Computed: true, + }, + "job_status": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "region": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeInt, + Computed: true, + }, + }, + }, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudActiontrailHistoryDeliveryJobsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListDeliveryHistoryJobs" + request := make(map[string]interface{}) + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOkExists("status") + var response map[string]interface{} + conn, err := client.NewActiontrailClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-07-06"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_actiontrail_history_delivery_jobs", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.DeliveryHistoryJobs", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.DeliveryHistoryJobs", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["JobId"])]; !ok { + continue + } + } + if statusOk && status.(int) != formatInt(item["JobStatus"]) { + continue + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "create_time": object["CreatedTime"], + "end_time": object["EndTime"], + "id": fmt.Sprint(object["JobId"]), + "history_delivery_job_id": fmt.Sprint(object["JobId"]), + "home_region": object["HomeRegion"], + "start_time": object["StartTime"], + "status": formatInt(object["JobStatus"]), + "trail_name": object["TrailName"], + "updated_time": object["UpdatedTime"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + s = append(s, mapping) + continue + } + id := fmt.Sprint(object["JobId"]) + actiontrailService := ActiontrailService{client} + getResp, err := actiontrailService.DescribeActiontrailHistoryDeliveryJob(id) + if err != nil { + return WrapError(err) + } + jobStatus := make([]map[string]interface{}, 0) + if jobStatusList, ok := getResp["Status"]; ok { + jobStatusListArg, _ := jobStatusList.([]interface{}) + for _, v := range jobStatusListArg { + if m1, ok := v.(map[string]interface{}); ok { + temp1 := map[string]interface{}{ + "region": m1["Region"], + "status": formatInt(m1["Status"]), + } + jobStatus = append(jobStatus, temp1) + } + } + } + mapping["job_status"] = jobStatus + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("jobs", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_adb_db_clusters.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_adb_db_clusters.go index 51e76923ddf..e86bb5ec783 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_adb_db_clusters.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_adb_db_clusters.go @@ -229,6 +229,10 @@ func dataSourceAlicloudAdbDbClusters() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "mode": { + Type: schema.TypeString, + Computed: true, + }, }, }, }, @@ -365,6 +369,8 @@ func dataSourceAlicloudAdbDbClustersRead(d *schema.ResourceData, meta interface{ "vpc_id": object["VPCId"], "vswitch_id": object["VSwitchId"], "zone_id": object["ZoneId"], + "mode": object["Mode"], + "db_cluster_version": object["DBVersion"], } descriptions = append(descriptions, object["DBClusterDescription"].(string)) @@ -409,12 +415,6 @@ func dataSourceAlicloudAdbDbClustersRead(d *schema.ResourceData, meta interface{ mapping["engine_version"] = getResp2["EngineVersion"] mapping["maintain_time"] = getResp2["MaintainTime"] - getResp3, err := adbService.DescribeDBClusters(id) - if err != nil { - return WrapError(err) - } - mapping["db_cluster_version"] = getResp3["DBVersion"] - ids = append(ids, fmt.Sprint(object["DBClusterId"])) s = append(s, mapping) } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alb_acls.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alb_acls.go new file mode 100644 index 00000000000..478a28393d4 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alb_acls.go @@ -0,0 +1,276 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudAlbAcls() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudAlbAclsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "acl_ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "acl_name": { + Type: schema.TypeString, + Optional: true, + }, + "resource_group_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"Available", "Configuring", "Provisioning"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "acls": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "acl_entries": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "description": { + Type: schema.TypeString, + Computed: true, + }, + "entry": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "acl_id": { + Type: schema.TypeString, + Computed: true, + }, + "acl_name": { + Type: schema.TypeString, + Computed: true, + }, + "address_ip_version": { + Type: schema.TypeString, + Computed: true, + }, + "resource_group_id": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudAlbAclsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListAcls" + request := make(map[string]interface{}) + if m, ok := d.GetOk("acl_ids"); ok { + for k, v := range m.([]interface{}) { + request[fmt.Sprintf("AclIds.%d", k+1)] = v.(string) + } + } + if v, ok := d.GetOk("acl_name"); ok { + AclNames := []string{v.(string)} + request["AclNames"] = AclNames + } + + if v, ok := d.GetOk("resource_group_id"); ok { + request["ResourceGroupId"] = v + } + request["MaxResults"] = PageSizeLarge + var objects []map[string]interface{} + var aclNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + aclNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewAlbClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-16"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_alb_acls", action, AlibabaCloudSdkGoERROR) + } + totalCount, err := jsonpath.Get("$.TotalCount", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.TotalCount", response) + } + + if fmt.Sprint(totalCount) == "0" { + break + } + + resp, err := jsonpath.Get("$.Acls", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Acls", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if aclNameRegex != nil && !aclNameRegex.MatchString(fmt.Sprint(item["AclName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["AclId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["AclStatus"].(string) { + continue + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "id": fmt.Sprint(object["AclId"]), + "acl_id": fmt.Sprint(object["AclId"]), + "acl_name": object["AclName"], + "address_ip_version": object["AddressIPVersion"], + "resource_group_id": object["ResourceGroupId"], + "status": object["AclStatus"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["AclName"]) + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + s = append(s, mapping) + continue + } + id := fmt.Sprint(object["AclId"]) + albService := AlbService{client} + getResp, err := albService.ListAclEntries(id) + if err != nil { + return WrapError(err) + } + + aclEntries := make([]map[string]interface{}, 0) + for _, v := range getResp { + temp1 := map[string]interface{}{ + "description": v["Description"], + "entry": v["Entry"], + "status": v["Status"], + } + aclEntries = append(aclEntries, temp1) + } + mapping["acl_entries"] = aclEntries + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("acls", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alb_health_check_templates.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alb_health_check_templates.go new file mode 100644 index 00000000000..66bd8f2d614 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alb_health_check_templates.go @@ -0,0 +1,247 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudAlbHealthCheckTemplates() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudAlbHealthCheckTemplatesRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "health_check_template_ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "health_check_template_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[A-Za-z][A-Za-z0-9\\_\\.\\-]{1,127}$`), "The name must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter."), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "templates": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "health_check_codes": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "health_check_connect_port": { + Type: schema.TypeInt, + Computed: true, + }, + "health_check_host": { + Type: schema.TypeString, + Computed: true, + }, + "health_check_http_version": { + Type: schema.TypeString, + Computed: true, + }, + "health_check_interval": { + Type: schema.TypeInt, + Computed: true, + }, + "health_check_method": { + Type: schema.TypeString, + Computed: true, + }, + "health_check_path": { + Type: schema.TypeString, + Computed: true, + }, + "health_check_protocol": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "health_check_template_id": { + Type: schema.TypeString, + Computed: true, + }, + "health_check_template_name": { + Type: schema.TypeString, + Computed: true, + }, + "health_check_timeout": { + Type: schema.TypeInt, + Computed: true, + }, + "healthy_threshold": { + Type: schema.TypeInt, + Computed: true, + }, + "unhealthy_threshold": { + Type: schema.TypeInt, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudAlbHealthCheckTemplatesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListHealthCheckTemplates" + request := make(map[string]interface{}) + if m, ok := d.GetOk("health_check_template_ids"); ok { + for k, v := range m.([]interface{}) { + request[fmt.Sprintf("HealthCheckTemplateIds.%d", k+1)] = v.(string) + } + } + if v, ok := d.GetOk("health_check_template_name"); ok { + request["HealthCheckTemplateNames.1"] = v + } + request["MaxResults"] = PageSizeLarge + var objects []map[string]interface{} + var healthCheckTemplateNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + healthCheckTemplateNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewAlbClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-16"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_alb_health_check_templates", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.HealthCheckTemplates", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.HealthCheckTemplates", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if healthCheckTemplateNameRegex != nil && !healthCheckTemplateNameRegex.MatchString(fmt.Sprint(item["HealthCheckTemplateName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["HealthCheckTemplateId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "health_check_codes": object["HealthCheckCodes"], + "health_check_connect_port": formatInt(object["HealthCheckConnectPort"]), + "health_check_host": object["HealthCheckHost"], + "health_check_http_version": object["HealthCheckHttpVersion"], + "health_check_interval": formatInt(object["HealthCheckInterval"]), + "health_check_method": object["HealthCheckMethod"], + "health_check_path": object["HealthCheckPath"], + "health_check_protocol": object["HealthCheckProtocol"], + "id": fmt.Sprint(object["HealthCheckTemplateId"]), + "health_check_template_id": fmt.Sprint(object["HealthCheckTemplateId"]), + "health_check_template_name": object["HealthCheckTemplateName"], + "health_check_timeout": formatInt(object["HealthCheckTimeout"]), + "healthy_threshold": formatInt(object["HealthyThreshold"]), + "unhealthy_threshold": formatInt(object["UnhealthyThreshold"]), + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["HealthCheckTemplateName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("templates", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alb_listeners.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alb_listeners.go new file mode 100644 index 00000000000..9bf28d10149 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alb_listeners.go @@ -0,0 +1,498 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudAlbListeners() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudAlbListenersRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "listener_ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "listener_protocol": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"HTTP", "HTTPS", "QUIC"}, false), + }, + "load_balancer_ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Provisioning", "Running", "Configuring", "Stopped"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "listeners": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "access_log_record_customized_headers_enabled": { + Type: schema.TypeBool, + Computed: true, + }, + "access_log_tracing_config": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "tracing_enabled": { + Type: schema.TypeBool, + Computed: true, + }, + "tracing_sample": { + Type: schema.TypeInt, + Computed: true, + }, + "tracing_type": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "acl_config": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "acl_relations": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "acl_id": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "acl_type": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "certificates": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "certificate_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "default_actions": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "type": { + Type: schema.TypeString, + Computed: true, + }, + "forward_group_config": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "server_group_tuples": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "server_group_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + "gzip_enabled": { + Type: schema.TypeBool, + Computed: true, + }, + "http2_enabled": { + Type: schema.TypeBool, + Computed: true, + }, + "idle_timeout": { + Type: schema.TypeInt, + Computed: true, + }, + "listener_description": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "listener_id": { + Type: schema.TypeString, + Computed: true, + }, + "listener_port": { + Type: schema.TypeInt, + Computed: true, + }, + "listener_protocol": { + Type: schema.TypeString, + Computed: true, + }, + "load_balancer_id": { + Type: schema.TypeString, + Computed: true, + }, + "max_results": { + Type: schema.TypeString, + Computed: true, + }, + "next_token": { + Type: schema.TypeString, + Computed: true, + }, + "quic_config": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "quic_listener_id": { + Type: schema.TypeString, + Computed: true, + }, + "quic_upgrade_enabled": { + Type: schema.TypeBool, + Computed: true, + }, + }, + }, + }, + "request_timeout": { + Type: schema.TypeInt, + Computed: true, + }, + "security_policy_id": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "xforwarded_for_config": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "xforwardedforclientcert_issuerdnalias": { + Type: schema.TypeString, + Computed: true, + }, + "xforwardedforclientcert_issuerdnenabled": { + Type: schema.TypeBool, + Computed: true, + }, + "xforwardedforclientcertclientverifyalias": { + Type: schema.TypeString, + Computed: true, + }, + "xforwardedforclientcertclientverifyenabled": { + Type: schema.TypeBool, + Computed: true, + }, + "xforwardedforclientcertfingerprintalias": { + Type: schema.TypeString, + Computed: true, + }, + "xforwardedforclientcertfingerprintenabled": { + Type: schema.TypeBool, + Computed: true, + }, + "xforwardedforclientcertsubjectdnalias": { + Type: schema.TypeString, + Computed: true, + }, + "xforwardedforclientcertsubjectdnenabled": { + Type: schema.TypeBool, + Computed: true, + }, + "xforwardedforclientsrcportenabled": { + Type: schema.TypeBool, + Computed: true, + }, + "xforwardedforenabled": { + Type: schema.TypeBool, + Computed: true, + }, + "xforwardedforprotoenabled": { + Type: schema.TypeBool, + Computed: true, + }, + "xforwardedforslbidenabled": { + Type: schema.TypeBool, + Computed: true, + }, + "xforwardedforslbportenabled": { + Type: schema.TypeBool, + Computed: true, + }, + }, + }, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudAlbListenersRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListListeners" + request := make(map[string]interface{}) + if m, ok := d.GetOk("listener_ids"); ok { + for k, v := range m.([]interface{}) { + request[fmt.Sprintf("ListenerIds.%d", k+1)] = v.(string) + } + } + if v, ok := d.GetOk("listener_protocol"); ok { + request["ListenerProtocol"] = v + } + if m, ok := d.GetOk("load_balancer_ids"); ok { + for k, v := range m.([]interface{}) { + request[fmt.Sprintf("LoadBalancerIds.%d", k+1)] = v.(string) + } + } + request["MaxResults"] = PageSizeLarge + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewAlbClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-16"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_alb_listeners", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Listeners", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Listeners", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["ListenerId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["ListenerStatus"].(string) { + continue + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "max_results": fmt.Sprint(response["MaxResults"]), + "next_token": response["NextToken"], + } + mapping["access_log_record_customized_headers_enabled"] = object["LogConfig.AccessLogRecordCustomizedHeadersEnabled"] + mapping["gzip_enabled"] = object["GzipEnabled"] + mapping["http2_enabled"] = object["Http2Enabled"] + mapping["idle_timeout"] = object["IdleTimeout"] + mapping["listener_description"] = object["ListenerDescription"] + mapping["id"] = fmt.Sprint(object["ListenerId"]) + mapping["listener_id"] = object["ListenerId"] + mapping["listener_port"] = object["ListenerPort"] + mapping["listener_protocol"] = object["ListenerProtocol"] + mapping["load_balancer_id"] = object["LoadBalancerId"] + mapping["request_timeout"] = object["RequestTimeout"] + mapping["security_policy_id"] = object["SecurityPolicyId"] + mapping["status"] = object["ListenerStatus"] + xforwardedForConfigSli := make([]map[string]interface{}, 0) + if xforwardedForConfig, ok := object["XForwardedForConfig"]; ok && len(xforwardedForConfig.(map[string]interface{})) > 0 { + xforwardedForConfigMap := make(map[string]interface{}) + xforwardedForConfigMap["xforwardedforclientcert_issuerdnalias"] = xforwardedForConfig.(map[string]interface{})["XForwardedForClientCertIssuerDNAlias"] + xforwardedForConfigMap["xforwardedforclientcert_issuerdnenabled"] = xforwardedForConfig.(map[string]interface{})["XForwardedForClientCertIssuerDNEnabled"] + xforwardedForConfigMap["xforwardedforclientcertclientverifyalias"] = xforwardedForConfig.(map[string]interface{})["XForwardedForClientCertClientVerifyAlias"] + xforwardedForConfigMap["xforwardedforclientcertclientverifyenabled"] = xforwardedForConfig.(map[string]interface{})["XForwardedForClientCertClientVerifyEnabled"] + xforwardedForConfigMap["xforwardedforclientcertfingerprintalias"] = xforwardedForConfig.(map[string]interface{})["XForwardedForClientCertFingerprintAlias"] + xforwardedForConfigMap["xforwardedforclientcertfingerprintenabled"] = xforwardedForConfig.(map[string]interface{})["XForwardedForClientCertFingerprintEnabled"] + xforwardedForConfigMap["xforwardedforclientcertsubjectdnalias"] = xforwardedForConfig.(map[string]interface{})["XForwardedForClientCertSubjectDNAlias"] + xforwardedForConfigMap["xforwardedforclientcertsubjectdnenabled"] = xforwardedForConfig.(map[string]interface{})["XForwardedForClientCertSubjectDNEnabled"] + xforwardedForConfigMap["xforwardedforclientsrcportenabled"] = xforwardedForConfig.(map[string]interface{})["XForwardedForClientSrcPortEnabled"] + xforwardedForConfigMap["xforwardedforenabled"] = xforwardedForConfig.(map[string]interface{})["XForwardedForEnabled"] + xforwardedForConfigMap["xforwardedforprotoenabled"] = xforwardedForConfig.(map[string]interface{})["XForwardedForProtoEnabled"] + xforwardedForConfigMap["xforwardedforslbidenabled"] = xforwardedForConfig.(map[string]interface{})["XForwardedForSLBIdEnabled"] + xforwardedForConfigMap["xforwardedforslbportenabled"] = xforwardedForConfig.(map[string]interface{})["XForwardedForSLBPortEnabled"] + xforwardedForConfigSli = append(xforwardedForConfigSli, xforwardedForConfigMap) + } + mapping["xforwarded_for_config"] = xforwardedForConfigSli + + ids = append(ids, fmt.Sprint(mapping["id"])) + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + s = append(s, mapping) + continue + } + id := fmt.Sprint(object["ListenerId"]) + albService := AlbService{client} + getResp, err := albService.DescribeAlbListener(id) + if err != nil { + return WrapError(err) + } + certificatesMaps := make([]map[string]interface{}, 0) + if certificatesList, ok := getResp["Certificates"]; ok && certificatesList != nil { + for _, certificatesListItem := range certificatesList.([]interface{}) { + if certificatesListItemArg, ok := certificatesListItem.(map[string]interface{}); ok { + certificatesListItemMap := map[string]interface{}{} + certificatesListItemMap["certificate_id"] = certificatesListItemArg["CertificateId"] + certificatesMaps = append(certificatesMaps, certificatesListItemMap) + } + } + } + mapping["certificates"] = certificatesMaps + defaultActionsMaps := make([]map[string]interface{}, 0) + if defaultActionsList, ok := getResp["DefaultActions"].([]interface{}); ok { + for _, defaultActions := range defaultActionsList { + defaultActionsArg := defaultActions.(map[string]interface{}) + defaultActionsMap := map[string]interface{}{} + defaultActionsMap["type"] = defaultActionsArg["Type"] + forwardGroupConfig := defaultActionsArg["ForwardGroupConfig"] + forwardGroupConfigArg := forwardGroupConfig.(map[string]interface{}) + serverGroupTuplesMaps := make([]map[string]interface{}, 0) + for _, serverGroupTuples := range forwardGroupConfigArg["ServerGroupTuples"].([]interface{}) { + serverGroupTuplesArg := serverGroupTuples.(map[string]interface{}) + serverGroupTuplesMap := map[string]interface{}{} + serverGroupTuplesMap["server_group_id"] = serverGroupTuplesArg["ServerGroupId"] + serverGroupTuplesMaps = append(serverGroupTuplesMaps, serverGroupTuplesMap) + } + forwardGroupConfigMaps := make([]map[string]interface{}, 0) + forwardGroupConfigMap := map[string]interface{}{} + forwardGroupConfigMap["server_group_tuples"] = serverGroupTuplesMaps + forwardGroupConfigMaps = append(forwardGroupConfigMaps, forwardGroupConfigMap) + defaultActionsMap["forward_group_config"] = forwardGroupConfigMaps + defaultActionsMaps = append(defaultActionsMaps, defaultActionsMap) + } + } + mapping["default_actions"] = defaultActionsMaps + aclConfigSli := make([]map[string]interface{}, 0) + if aclConfig, ok := getResp["AclConfig"]; ok && len(aclConfig.(map[string]interface{})) > 0 { + aclConfigMap := make(map[string]interface{}) + aclRelationsSli := make([]map[string]interface{}, 0) + if v, ok := aclConfig.(map[string]interface{})["AclRelations"]; ok && len(v.([]interface{})) > 0 { + for _, aclRelations := range v.([]interface{}) { + aclRelationsMap := make(map[string]interface{}) + aclRelationsMap["acl_id"] = aclRelations.(map[string]interface{})["AclId"] + aclRelationsMap["status"] = aclRelations.(map[string]interface{})["Status"] + aclRelationsSli = append(aclRelationsSli, aclRelationsMap) + } + } + aclConfigMap["acl_relations"] = aclRelationsSli + aclConfigMap["acl_type"] = aclConfig.(map[string]interface{})["AclType"] + aclConfigSli = append(aclConfigSli, aclConfigMap) + } + mapping["acl_config"] = aclConfigSli + + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("listeners", s); err != nil { + return WrapError(err) + } + + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alb_load_balancers.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alb_load_balancers.go index dc19c722028..81b8e8d09c2 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alb_load_balancers.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alb_load_balancers.go @@ -28,6 +28,13 @@ func dataSourceAlicloudAlbLoadBalancers() *schema.Resource { Optional: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{"Abnormal", "Normal"}, false), + Deprecated: "Field 'load_balancer_bussiness_status' has been deprecated from provider version 1.142.0 and it will be removed in the future version. Please use the new attribute 'load_balancer_business_status' instead.", + }, + "load_balancer_business_status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Abnormal", "Normal"}, false), }, "ids": { Type: schema.TypeList, @@ -160,6 +167,11 @@ func dataSourceAlicloudAlbLoadBalancers() *schema.Resource { }, }, "load_balancer_bussiness_status": { + Type: schema.TypeString, + Computed: true, + Deprecated: "Field 'load_balancer_bussiness_status' has been deprecated from provider version 1.142.0 and it will be removed in the future version. Please use the new parameter 'load_balancer_business_status' instead.", + }, + "load_balancer_business_status": { Type: schema.TypeString, Computed: true, }, @@ -275,9 +287,13 @@ func dataSourceAlicloudAlbLoadBalancersRead(d *schema.ResourceData, meta interfa if v, ok := d.GetOk("address_type"); ok { request["AddressType"] = v } - if v, ok := d.GetOk("load_balancer_bussiness_status"); ok { + + if v, ok := d.GetOk("load_balancer_business_status"); ok { + request["LoadBalancerBussinessStatus"] = v + } else if v, ok := d.GetOk("load_balancer_bussiness_status"); ok { request["LoadBalancerBussinessStatus"] = v } + if m, ok := d.GetOk("load_balancer_ids"); ok { for k, v := range m.([]interface{}) { request[fmt.Sprintf("LoadBalancerIds.%d", k+1)] = v.(string) @@ -393,6 +409,7 @@ func dataSourceAlicloudAlbLoadBalancersRead(d *schema.ResourceData, meta interfa "create_time": object["CreateTime"], "deletion_protection_config": object["DeletionProtectionConfig"], "dns_name": object["DNSName"], + "load_balancer_business_status": object["LoadBalancerBussinessStatus"], "load_balancer_bussiness_status": object["LoadBalancerBussinessStatus"], "load_balancer_edition": object["LoadBalancerEdition"], "id": fmt.Sprint(object["LoadBalancerId"]), diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alb_rules.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alb_rules.go new file mode 100644 index 00000000000..c1f27933f87 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alb_rules.go @@ -0,0 +1,669 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudAlbRules() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudAlbRulesRead, + Schema: map[string]*schema.Schema{ + "listener_ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "load_balancer_ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "rule_ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Available", "Configuring", "Provisioning"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "rules": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "listener_id": { + Type: schema.TypeString, + Computed: true, + }, + "load_balancer_id": { + Type: schema.TypeString, + Computed: true, + }, + "priority": { + Type: schema.TypeInt, + Computed: true, + }, + "rule_actions": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "fixed_response_config": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "content": { + Type: schema.TypeString, + Computed: true, + }, + "content_type": { + Type: schema.TypeString, + Computed: true, + }, + "http_code": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "forward_group_config": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "server_group_tuples": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "server_group_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + }, + }, + "insert_header_config": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Computed: true, + }, + "value": { + Type: schema.TypeString, + Computed: true, + }, + "value_type": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "order": { + Type: schema.TypeInt, + Computed: true, + }, + "redirect_config": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "host": { + Type: schema.TypeString, + Computed: true, + }, + "http_code": { + Type: schema.TypeString, + Computed: true, + }, + "path": { + Type: schema.TypeString, + Computed: true, + }, + "port": { + Type: schema.TypeString, + Computed: true, + }, + "protocol": { + Type: schema.TypeString, + Computed: true, + }, + "query": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "rewrite_config": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "host": { + Type: schema.TypeString, + Computed: true, + }, + "path": { + Type: schema.TypeString, + Computed: true, + }, + "query": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "type": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "rule_conditions": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "cookie_config": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "values": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Computed: true, + }, + "value": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + }, + }, + "header_config": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Computed: true, + }, + "values": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + }, + "host_config": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "values": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + }, + "method_config": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "values": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + }, + "path_config": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "values": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + }, + "query_string_config": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "values": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Computed: true, + }, + "value": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + }, + }, + "type": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "rule_id": { + Type: schema.TypeString, + Computed: true, + }, + "rule_name": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudAlbRulesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListRules" + request := make(map[string]interface{}) + if m, ok := d.GetOk("listener_ids"); ok { + for k, v := range m.([]interface{}) { + request[fmt.Sprintf("ListenerIds.%d", k+1)] = v.(string) + } + } + if m, ok := d.GetOk("load_balancer_ids"); ok { + for k, v := range m.([]interface{}) { + request[fmt.Sprintf("LoadBalancerIds.%d", k+1)] = v.(string) + } + } + if m, ok := d.GetOk("rule_ids"); ok { + for k, v := range m.([]interface{}) { + request[fmt.Sprintf("RuleIds.%d", k+1)] = v.(string) + } + } + request["MaxResults"] = PageSizeLarge + var objects []map[string]interface{} + var ruleNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + ruleNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewAlbClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-16"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_alb_rules", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Rules", response) + if formatInt(response["TotalCount"]) != 0 && err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Rules", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if ruleNameRegex != nil && !ruleNameRegex.MatchString(fmt.Sprint(item["RuleName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["RuleId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["RuleStatus"].(string) { + continue + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "listener_id": object["ListenerId"], + "load_balancer_id": object["LoadBalancerId"], + "priority": formatInt(object["Priority"]), + "id": fmt.Sprint(object["RuleId"]), + "rule_id": fmt.Sprint(object["RuleId"]), + "rule_name": object["RuleName"], + "status": object["RuleStatus"], + } + + ruleActionsMaps := make([]map[string]interface{}, 0) + if ruleActionsList, ok := object["RuleActions"]; ok { + for _, ruleActions := range ruleActionsList.([]interface{}) { + ruleActionsArg := ruleActions.(map[string]interface{}) + ruleActionsMap := map[string]interface{}{} + ruleActionsMap["type"] = ruleActionsArg["Type"] + ruleActionsMap["order"] = formatInt(ruleActionsArg["Order"]) + + if forwardGroupConfig, ok := ruleActionsArg["ForwardGroupConfig"]; ok { + forwardGroupConfigArg := forwardGroupConfig.(map[string]interface{}) + if len(forwardGroupConfigArg) > 0 { + serverGroupTuplesMaps := make([]map[string]interface{}, 0) + if forwardGroupConfigArgs, ok := forwardGroupConfigArg["ServerGroupTuples"].([]interface{}); ok { + for _, serverGroupTuples := range forwardGroupConfigArgs { + serverGroupTuplesArg := serverGroupTuples.(map[string]interface{}) + serverGroupTuplesMap := map[string]interface{}{} + serverGroupTuplesMap["server_group_id"] = serverGroupTuplesArg["ServerGroupId"] + serverGroupTuplesMaps = append(serverGroupTuplesMaps, serverGroupTuplesMap) + } + } + if len(serverGroupTuplesMaps) > 0 { + forwardGroupConfigMaps := make([]map[string]interface{}, 0) + forwardGroupConfigMap := map[string]interface{}{} + forwardGroupConfigMap["server_group_tuples"] = serverGroupTuplesMaps + forwardGroupConfigMaps = append(forwardGroupConfigMaps, forwardGroupConfigMap) + ruleActionsMap["forward_group_config"] = forwardGroupConfigMaps + ruleActionsMaps = append(ruleActionsMaps, ruleActionsMap) + } + } + } + + if fixedResponseConfig, ok := ruleActionsArg["FixedResponseConfig"]; ok { + fixedResponseConfigArg := fixedResponseConfig.(map[string]interface{}) + if len(fixedResponseConfigArg) > 0 { + fixedResponseConfigMaps := make([]map[string]interface{}, 0) + fixedResponseConfigMap := make(map[string]interface{}, 0) + fixedResponseConfigMap["content"] = fixedResponseConfigArg["Content"] + fixedResponseConfigMap["content_type"] = fixedResponseConfigArg["ContentType"] + fixedResponseConfigMap["http_code"] = fixedResponseConfigArg["HttpCode"] + fixedResponseConfigMaps = append(fixedResponseConfigMaps, fixedResponseConfigMap) + ruleActionsMap["fixed_response_config"] = fixedResponseConfigMaps + ruleActionsMaps = append(ruleActionsMaps, ruleActionsMap) + } + } + + if insertHeaderConfig, ok := ruleActionsArg["InsertHeaderConfig"]; ok { + insertHeaderConfigArg := insertHeaderConfig.(map[string]interface{}) + if len(insertHeaderConfigArg) > 0 { + insertHeaderConfigMaps := make([]map[string]interface{}, 0) + insertHeaderConfigMap := make(map[string]interface{}, 0) + insertHeaderConfigMap["key"] = insertHeaderConfigArg["Key"] + insertHeaderConfigMap["value"] = insertHeaderConfigArg["Value"] + insertHeaderConfigMap["value_type"] = insertHeaderConfigArg["ValueType"] + insertHeaderConfigMaps = append(insertHeaderConfigMaps, insertHeaderConfigMap) + ruleActionsMap["insert_header_config"] = insertHeaderConfigMaps + ruleActionsMaps = append(ruleActionsMaps, ruleActionsMap) + } + } + + if redirectConfig, ok := ruleActionsArg["RedirectConfig"]; ok { + redirectConfigArg := redirectConfig.(map[string]interface{}) + if len(redirectConfigArg) > 0 { + redirectConfigMaps := make([]map[string]interface{}, 0) + redirectConfigMap := make(map[string]interface{}, 0) + redirectConfigMap["host"] = redirectConfigArg["Host"] + redirectConfigMap["http_code"] = redirectConfigArg["HttpCode"] + redirectConfigMap["path"] = redirectConfigArg["Path"] + redirectConfigMap["port"] = formatInt(redirectConfigArg["Port"]) + redirectConfigMap["protocol"] = redirectConfigArg["Protocol"] + redirectConfigMap["query"] = redirectConfigArg["Query"] + redirectConfigMaps = append(redirectConfigMaps, redirectConfigMap) + ruleActionsMap["redirect_config"] = redirectConfigMaps + ruleActionsMaps = append(ruleActionsMaps, ruleActionsMap) + } + } + + if rewriteConfig, ok := ruleActionsArg["RewriteConfig"]; ok { + rewriteConfigArg := rewriteConfig.(map[string]interface{}) + if len(rewriteConfigArg) > 0 { + rewriteConfigMaps := make([]map[string]interface{}, 0) + rewriteConfigMap := make(map[string]interface{}, 0) + rewriteConfigMap["host"] = rewriteConfigArg["Host"] + rewriteConfigMap["path"] = rewriteConfigArg["Path"] + rewriteConfigMap["query"] = rewriteConfigArg["Query"] + rewriteConfigMaps = append(rewriteConfigMaps, rewriteConfigMap) + ruleActionsMap["rewrite_config"] = rewriteConfigMaps + ruleActionsMaps = append(ruleActionsMaps, ruleActionsMap) + } + } + } + } + mapping["rule_actions"] = ruleActionsMaps + + ruleConditionsMaps := make([]map[string]interface{}, 0) + if ruleConditionsList, ok := object["RuleConditions"]; ok { + for _, ruleConditions := range ruleConditionsList.([]interface{}) { + ruleConditionsArg := ruleConditions.(map[string]interface{}) + ruleConditionsMap := map[string]interface{}{} + ruleConditionsMap["type"] = ruleConditionsArg["Type"] + + if cookieConfig, ok := ruleConditionsArg["CookieConfig"]; ok { + cookieConfigArg := cookieConfig.(map[string]interface{}) + if len(cookieConfigArg) > 0 { + cookieConfigMaps := make([]map[string]interface{}, 0) + valuesMaps := make([]map[string]interface{}, 0) + for _, values := range cookieConfigArg["Values"].([]interface{}) { + valuesArg := values.(map[string]interface{}) + valuesMap := map[string]interface{}{} + valuesMap["key"] = valuesArg["Key"] + valuesMap["value"] = valuesArg["Value"] + valuesMaps = append(valuesMaps, valuesMap) + } + cookieConfigMap := map[string]interface{}{} + cookieConfigMap["values"] = valuesMaps + cookieConfigMaps = append(cookieConfigMaps, cookieConfigMap) + ruleConditionsMap["cookie_config"] = cookieConfigMaps + ruleConditionsMaps = append(ruleConditionsMaps, ruleConditionsMap) + } + } + + if headerConfig, ok := ruleConditionsArg["HeaderConfig"]; ok { + headerConfigArg := headerConfig.(map[string]interface{}) + if len(headerConfigArg) > 0 { + headerConfigMaps := make([]map[string]interface{}, 0) + headerConfigMap := map[string]interface{}{} + headerConfigMap["values"] = headerConfigArg["Values"].([]interface{}) + headerConfigMap["key"] = headerConfigArg["Key"] + headerConfigMaps = append(headerConfigMaps, headerConfigMap) + ruleConditionsMap["header_config"] = headerConfigMaps + ruleConditionsMaps = append(ruleConditionsMaps, ruleConditionsMap) + } + } + + if queryStringConfig, ok := ruleConditionsArg["QueryStringConfig"]; ok { + queryStringConfigArg := queryStringConfig.(map[string]interface{}) + if len(queryStringConfigArg) > 0 { + queryStringConfigMaps := make([]map[string]interface{}, 0) + queryStringValuesMaps := make([]map[string]interface{}, 0) + for _, values := range queryStringConfigArg["Values"].([]interface{}) { + valuesArg := values.(map[string]interface{}) + valuesMap := map[string]interface{}{} + valuesMap["key"] = valuesArg["Key"] + valuesMap["value"] = valuesArg["Value"] + queryStringValuesMaps = append(queryStringValuesMaps, valuesMap) + } + queryStringConfigMap := map[string]interface{}{} + queryStringConfigMap["values"] = queryStringValuesMaps + queryStringConfigMaps = append(queryStringConfigMaps, queryStringConfigMap) + ruleConditionsMap["query_string_config"] = queryStringConfigMaps + ruleConditionsMaps = append(ruleConditionsMaps, ruleConditionsMap) + } + } + + if hostConfig, ok := ruleConditionsArg["HostConfig"]; ok { + hostConfigArg := hostConfig.(map[string]interface{}) + if len(hostConfigArg) > 0 { + hostConfigMaps := make([]map[string]interface{}, 0) + hostConfigMap := map[string]interface{}{} + hostConfigMap["values"] = hostConfigArg["Values"].([]interface{}) + hostConfigMaps = append(hostConfigMaps, hostConfigMap) + ruleConditionsMap["host_config"] = hostConfigMaps + ruleConditionsMaps = append(ruleConditionsMaps, ruleConditionsMap) + } + } + + if methodConfig, ok := ruleConditionsArg["MethodConfig"]; ok { + methodConfigArg := methodConfig.(map[string]interface{}) + if len(methodConfigArg) > 0 { + methodConfigMaps := make([]map[string]interface{}, 0) + methodConfigMap := map[string]interface{}{} + methodConfigMap["values"] = methodConfigArg["Values"].([]interface{}) + methodConfigMaps = append(methodConfigMaps, methodConfigMap) + ruleConditionsMap["method_config"] = methodConfigMaps + ruleConditionsMaps = append(ruleConditionsMaps, ruleConditionsMap) + } + } + + if pathConfig, ok := ruleConditionsArg["PathConfig"]; ok { + pathConfigArg := pathConfig.(map[string]interface{}) + if len(pathConfigArg) > 0 { + pathConfigMaps := make([]map[string]interface{}, 0) + pathConfigMap := map[string]interface{}{} + pathConfigMap["values"] = pathConfigArg["Values"].([]interface{}) + pathConfigMaps = append(pathConfigMaps, pathConfigMap) + ruleConditionsMap["path_config"] = pathConfigMaps + ruleConditionsMaps = append(ruleConditionsMaps, ruleConditionsMap) + } + } + } + } + mapping["rule_conditions"] = ruleConditionsMaps + + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["RuleName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("rules", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alb_security_policies.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alb_security_policies.go index 769be6536f6..4fd84c2798e 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alb_security_policies.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alb_security_policies.go @@ -113,10 +113,10 @@ func dataSourceAlicloudAlbSecurityPoliciesRead(d *schema.ResourceData, meta inte request["ResourceGroupId"] = v } if v, ok := d.GetOk("security_policy_ids"); ok { - request["SecurityPolicyIds"] = convertListToJsonString(v.(*schema.Set).List()) + request["SecurityPolicyIds"] = v } if v, ok := d.GetOk("security_policy_name"); ok { - request["SecurityPolicyNames"] = v + request["SecurityPolicyNames"] = []string{v.(string)} } request["MaxResults"] = PageSizeLarge var objects []map[string]interface{} @@ -164,7 +164,7 @@ func dataSourceAlicloudAlbSecurityPoliciesRead(d *schema.ResourceData, meta inte return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_alb_security_policies", action, AlibabaCloudSdkGoERROR) } resp, err := jsonpath.Get("$.SecurityPolicies", response) - if err != nil { + if formatInt(response["Total"]) != 0 && err != nil { return WrapErrorf(err, FailedGetAttributeMsg, action, "$.SecurityPolicies", response) } result, _ := resp.([]interface{}) diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alb_server_groups.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alb_server_groups.go index b41e161b322..4dbf4250e8c 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alb_server_groups.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alb_server_groups.go @@ -189,6 +189,10 @@ func dataSourceAlicloudAlbServerGroups() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "tags": { + Type: schema.TypeMap, + Computed: true, + }, "sticky_session_config": { Type: schema.TypeList, Computed: true, @@ -339,6 +343,26 @@ func dataSourceAlicloudAlbServerGroupsRead(d *schema.ResourceData, meta interfac "vpc_id": object["VpcId"], } + healthCheckConfigSli := make([]map[string]interface{}, 0) + if len(object["HealthCheckConfig"].(map[string]interface{})) > 0 { + healthCheckConfig := object["HealthCheckConfig"] + healthCheckConfigMap := make(map[string]interface{}) + healthCheckConfigMap["health_check_codes"] = healthCheckConfig.(map[string]interface{})["HealthCheckCodes"] + healthCheckConfigMap["health_check_connect_port"] = formatInt(healthCheckConfig.(map[string]interface{})["HealthCheckConnectPort"]) + healthCheckConfigMap["health_check_enabled"] = healthCheckConfig.(map[string]interface{})["HealthCheckEnabled"] + healthCheckConfigMap["health_check_host"] = healthCheckConfig.(map[string]interface{})["HealthCheckHost"] + healthCheckConfigMap["health_check_http_version"] = healthCheckConfig.(map[string]interface{})["HealthCheckHttpVersion"] + healthCheckConfigMap["health_check_interval"] = formatInt(healthCheckConfig.(map[string]interface{})["HealthCheckInterval"]) + healthCheckConfigMap["health_check_method"] = healthCheckConfig.(map[string]interface{})["HealthCheckMethod"] + healthCheckConfigMap["health_check_path"] = healthCheckConfig.(map[string]interface{})["HealthCheckPath"] + healthCheckConfigMap["health_check_protocol"] = healthCheckConfig.(map[string]interface{})["HealthCheckProtocol"] + healthCheckConfigMap["health_check_timeout"] = formatInt(healthCheckConfig.(map[string]interface{})["HealthCheckTimeout"]) + healthCheckConfigMap["healthy_threshold"] = formatInt(healthCheckConfig.(map[string]interface{})["HealthyThreshold"]) + healthCheckConfigMap["unhealthy_threshold"] = formatInt(healthCheckConfig.(map[string]interface{})["UnhealthyThreshold"]) + healthCheckConfigSli = append(healthCheckConfigSli, healthCheckConfigMap) + } + mapping["health_check_config"] = healthCheckConfigSli + stickySessionConfigSli := make([]map[string]interface{}, 0) if len(object["StickySessionConfig"].(map[string]interface{})) > 0 { stickySessionConfig := object["StickySessionConfig"] diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alidns_access_strategies.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alidns_access_strategies.go new file mode 100644 index 00000000000..5e23fbbf181 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alidns_access_strategies.go @@ -0,0 +1,440 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudAlidnsAccessStrategies() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudAlidnsAccessStrategiesRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "lang": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "strategy_mode": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"GEO", "LATENCY"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "strategies": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, + "access_strategy_id": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "create_timestamp": { + Type: schema.TypeString, + Computed: true, + }, + "default_addr_pool_type": { + Type: schema.TypeString, + Computed: true, + }, + "default_addr_pools": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "addr_count": { + Type: schema.TypeInt, + Computed: true, + }, + "addr_pool_id": { + Type: schema.TypeString, + Computed: true, + }, + "lba_weight": { + Type: schema.TypeInt, + Computed: true, + }, + "name": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "default_available_addr_num": { + Type: schema.TypeInt, + Computed: true, + }, + "default_latency_optimization": { + Type: schema.TypeString, + Computed: true, + }, + "default_lba_strategy": { + Type: schema.TypeString, + Computed: true, + }, + "default_max_return_addr_num": { + Type: schema.TypeInt, + Computed: true, + }, + "default_min_available_addr_num": { + Type: schema.TypeInt, + Computed: true, + }, + "effective_addr_pool_group_type": { + Type: schema.TypeString, + Computed: true, + }, + "failover_addr_pool_type": { + Type: schema.TypeString, + Computed: true, + }, + "failover_addr_pools": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "addr_count": { + Type: schema.TypeInt, + Computed: true, + }, + "addr_pool_id": { + Type: schema.TypeString, + Computed: true, + }, + "lba_weight": { + Type: schema.TypeInt, + Computed: true, + }, + "name": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "failover_available_addr_num": { + Type: schema.TypeInt, + Computed: true, + }, + "failover_latency_optimization": { + Type: schema.TypeString, + Computed: true, + }, + "failover_lba_strategy": { + Type: schema.TypeString, + Computed: true, + }, + "failover_max_return_addr_num": { + Type: schema.TypeInt, + Computed: true, + }, + "failover_min_available_addr_num": { + Type: schema.TypeInt, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "access_mode": { + Type: schema.TypeString, + Computed: true, + }, + "lines": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "group_code": { + Type: schema.TypeString, + Computed: true, + }, + "group_name": { + Type: schema.TypeString, + Computed: true, + }, + "line_code": { + Type: schema.TypeString, + Computed: true, + }, + "line_name": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "strategy_mode": { + Type: schema.TypeString, + Computed: true, + }, + "strategy_name": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudAlidnsAccessStrategiesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeDnsGtmAccessStrategies" + request := make(map[string]interface{}) + request["InstanceId"] = d.Get("instance_id") + if v, ok := d.GetOk("lang"); ok { + request["Lang"] = v + } + request["StrategyMode"] = d.Get("strategy_mode") + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + var nameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + nameRegex = r + } + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewAlidnsClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-01-09"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_alidns_access_strategies", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Strategies.Strategy", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Strategies.Strategy", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if nameRegex != nil { + if !nameRegex.MatchString(fmt.Sprint(item["StrategyName"])) { + continue + } + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["StrategyId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "id": fmt.Sprint(object["StrategyId"]), + "access_strategy_id": fmt.Sprint(object["StrategyId"]), + "create_time": object["CreateTime"], + "create_timestamp": fmt.Sprint(object["CreateTimestamp"]), + "effective_addr_pool_group_type": object["EffectiveAddrPoolGroupType"], + "strategy_name": object["StrategyName"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["StrategyName"]) + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + s = append(s, mapping) + continue + } + id := fmt.Sprint(object["StrategyId"]) + alidnsService := AlidnsService{client} + getResp, err := alidnsService.DescribeAlidnsAccessStrategy(id) + if err != nil { + return WrapError(err) + } + mapping["default_addr_pool_type"] = getResp["DefaultAddrPoolType"] + + defaultAddrPool := make([]map[string]interface{}, 0) + if v, ok := getResp["DefaultAddrPools"]; ok { + defaultAddrPools := v.(map[string]interface{}) + if v, ok := defaultAddrPools["DefaultAddrPool"]; ok { + defaultAddrPoolList := v.([]interface{}) + for _, v := range defaultAddrPoolList { + if m1, ok := v.(map[string]interface{}); ok { + temp1 := map[string]interface{}{ + "addr_count": formatInt(m1["AddrCount"]), + "addr_pool_id": m1["Id"], + "lba_weight": formatInt(m1["LbaWeight"]), + "name": m1["Name"], + } + defaultAddrPool = append(defaultAddrPool, temp1) + } + } + } + } + + mapping["default_addr_pools"] = defaultAddrPool + if v, ok := getResp["DefaultAvailableAddrNum"]; ok && fmt.Sprint(v) != "0" { + mapping["default_available_addr_num"] = formatInt(v) + } + mapping["default_latency_optimization"] = getResp["DefaultLatencyOptimization"] + mapping["default_lba_strategy"] = getResp["DefaultLbaStrategy"] + if v, ok := getResp["DefaultMaxReturnAddrNum"]; ok && fmt.Sprint(v) != "0" { + mapping["default_max_return_addr_num"] = formatInt(v) + } + if v, ok := getResp["DefaultMinAvailableAddrNum"]; ok && fmt.Sprint(v) != "0" { + mapping["default_min_available_addr_num"] = formatInt(v) + } + mapping["failover_addr_pool_type"] = getResp["FailoverAddrPoolType"] + mapping["access_mode"] = getResp["AccessMode"] + + failoverAddrPool := make([]map[string]interface{}, 0) + if v, ok := getResp["FailoverAddrPools"]; ok { + failoverAddrPools := v.(map[string]interface{}) + if v, ok := failoverAddrPools["FailoverAddrPool"]; ok { + failoverAddrPoolList := v.([]interface{}) + for _, v := range failoverAddrPoolList { + if m1, ok := v.(map[string]interface{}); ok { + temp1 := map[string]interface{}{ + "addr_count": formatInt(m1["AddrCount"]), + "addr_pool_id": m1["Id"], + "lba_weight": formatInt(m1["LbaWeight"]), + "name": m1["Name"], + } + failoverAddrPool = append(failoverAddrPool, temp1) + } + } + } + } + mapping["failover_addr_pools"] = failoverAddrPool + if v, ok := getResp["FailoverAvailableAddrNum"]; ok && fmt.Sprint(v) != "0" { + mapping["failover_available_addr_num"] = formatInt(v) + } + mapping["failover_latency_optimization"] = getResp["FailoverLatencyOptimization"] + mapping["failover_lba_strategy"] = getResp["FailoverLbaStrategy"] + if v, ok := getResp["FailoverMaxReturnAddrNum"]; ok && fmt.Sprint(v) != "0" { + mapping["failover_max_return_addr_num"] = formatInt(v) + } + if v, ok := getResp["FailoverMinAvailableAddrNum"]; ok && fmt.Sprint(v) != "0" { + mapping["failover_min_available_addr_num"] = formatInt(v) + } + mapping["instance_id"] = getResp["InstanceId"] + + lineMaps := make([]map[string]interface{}, 0) + if v, ok := getResp["Lines"]; ok { + lines := v.(map[string]interface{}) + if v, ok := lines["Line"]; ok { + lineList := v.([]interface{}) + for _, v := range lineList { + if m1, ok := v.(map[string]interface{}); ok { + temp1 := map[string]interface{}{ + "group_code": m1["GroupCode"], + "group_name": m1["GroupName"], + "line_code": m1["LineCode"], + "line_name": m1["LineName"], + } + lineMaps = append(lineMaps, temp1) + } + } + } + } + mapping["lines"] = lineMaps + mapping["strategy_mode"] = getResp["StrategyMode"] + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + if err := d.Set("strategies", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alidns_address_pools.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alidns_address_pools.go new file mode 100644 index 00000000000..8ba96e015df --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alidns_address_pools.go @@ -0,0 +1,283 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudAlidnsAddressPools() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudAlidnsAddressPoolsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "pools": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "address_pool_id": { + Type: schema.TypeString, + Computed: true, + }, + "address_pool_name": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "create_timestamp": { + Type: schema.TypeString, + Computed: true, + }, + "lba_strategy": { + Type: schema.TypeString, + Computed: true, + }, + "monitor_status": { + Type: schema.TypeString, + Computed: true, + }, + "monitor_config_id": { + Type: schema.TypeString, + Computed: true, + }, + "type": { + Type: schema.TypeString, + Computed: true, + }, + "update_time": { + Type: schema.TypeString, + Computed: true, + }, + "update_timestamp": { + Type: schema.TypeString, + Computed: true, + }, + "address": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "address": { + Type: schema.TypeString, + Computed: true, + }, + "attribute_info": { + Type: schema.TypeString, + Computed: true, + }, + "lba_weight": { + Type: schema.TypeInt, + Computed: true, + }, + "mode": { + Type: schema.TypeString, + Computed: true, + }, + "remark": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudAlidnsAddressPoolsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeDnsGtmInstanceAddressPools" + request := make(map[string]interface{}) + request["InstanceId"] = d.Get("instance_id") + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + var addressPoolNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + addressPoolNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewAlidnsClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-01-09"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_alidns_address_pools", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.AddrPools.AddrPool", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.AddrPools.AddrPool", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if addressPoolNameRegex != nil && !addressPoolNameRegex.MatchString(fmt.Sprint(item["Name"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["AddrPoolId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "id": fmt.Sprint(object["AddrPoolId"]), + "instance_id": request["InstanceId"], + "address_pool_id": fmt.Sprint(object["AddrPoolId"]), + "address_pool_name": object["Name"], + "create_time": object["CreateTime"], + "create_timestamp": fmt.Sprint(object["CreateTimestamp"]), + "lba_strategy": object["LbaStrategy"], + "type": object["Type"], + "update_timestamp": fmt.Sprint(object["UpdateTimestamp"]), + "update_time": fmt.Sprint(object["UpdateTime"]), + "monitor_status": object["MonitorStatus"], + "monitor_config_id": object["MonitorConfigId"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["Name"]) + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + s = append(s, mapping) + continue + } + id := fmt.Sprint(object["AddrPoolId"]) + alidnsService := AlidnsService{client} + getResp, err := alidnsService.DescribeAlidnsAddressPool(id) + if err != nil { + return WrapError(err) + } + addressMaps := make([]map[string]interface{}, 0) + if v, ok := getResp["Addrs"]; ok { + addressList := v.(map[string]interface{}) + if v, ok := addressList["Addr"]; ok { + addressSli := v.([]interface{}) + for _, v := range addressSli { + if m1, ok := v.(map[string]interface{}); ok { + addressMap := make(map[string]interface{}) + addressMap["attribute_info"] = m1["AttributeInfo"] + addressMap["remark"] = m1["Remark"] + if v, ok := m1["LbaWeight"]; ok { + addressMap["lba_weight"] = v + } + addressMap["address"] = m1["Addr"] + addressMap["mode"] = m1["Mode"] + addressMaps = append(addressMaps, addressMap) + } + } + } + } + mapping["address"] = addressMaps + + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + if err := d.Set("pools", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alidns_custom_lines.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alidns_custom_lines.go new file mode 100644 index 00000000000..872bd4ad9b7 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alidns_custom_lines.go @@ -0,0 +1,235 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudAlidnsCustomLines() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudAlidnsCustomLinesRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "domain_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "lang": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "lines": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "code": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "custom_line_id": { + Type: schema.TypeString, + Computed: true, + }, + "custom_line_name": { + Type: schema.TypeString, + Computed: true, + }, + "domain_name": { + Type: schema.TypeString, + Computed: true, + }, + "ip_segment_list": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "end_ip": { + Type: schema.TypeString, + Computed: true, + }, + "start_ip": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudAlidnsCustomLinesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeCustomLines" + request := make(map[string]interface{}) + if v, ok := d.GetOk("lang"); ok { + request["Lang"] = v + } + request["DomainName"] = d.Get("domain_name") + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + var customLineNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + customLineNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewAlidnsClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-01-09"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_alidns_custom_lines", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.CustomLines", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.CustomLines", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if customLineNameRegex != nil && !customLineNameRegex.MatchString(fmt.Sprint(item["Name"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["Id"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "code": object["Code"], + "id": fmt.Sprint(object["Id"]), + "custom_line_id": fmt.Sprint(object["Id"]), + "custom_line_name": object["Name"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["Name"]) + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + s = append(s, mapping) + continue + } + id := fmt.Sprint(object["Id"]) + alidnsService := AlidnsService{client} + getResp, err := alidnsService.DescribeAlidnsCustomLine(id) + if err != nil { + return WrapError(err) + } + mapping["domain_name"] = getResp["DomainName"] + if ipSegmentList, ok := object["IpSegmentList"]; ok { + ipSegments := make([]map[string]interface{}, 0) + for _, ipSegmentListItem := range ipSegmentList.([]interface{}) { + ipSegmentMap := ipSegmentListItem.(map[string]interface{}) + ipSegmentArg := make(map[string]interface{}, 0) + ipSegmentArg["end_ip"] = ipSegmentMap["EndIp"] + ipSegmentArg["start_ip"] = ipSegmentMap["StartIp"] + ipSegments = append(ipSegments, ipSegmentArg) + } + mapping["ip_segment_list"] = ipSegments + } + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("lines", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alidns_gtm_instances.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alidns_gtm_instances.go new file mode 100644 index 00000000000..6d5db21bbbc --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alidns_gtm_instances.go @@ -0,0 +1,275 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudAlidnsGtmInstances() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudAlidnsGtmInstancesRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "lang": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "resource_group_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "output_file": { + Type: schema.TypeString, + Computed: true, + }, + "instances": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "alert_config": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "dingtalk_notice": { + Type: schema.TypeBool, + Computed: true, + }, + "email_notice": { + Type: schema.TypeBool, + Computed: true, + }, + "notice_type": { + Type: schema.TypeString, + Computed: true, + }, + "sms_notice": { + Type: schema.TypeBool, + Computed: true, + }, + }, + }, + }, + "alert_group": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "cname_type": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "expire_time": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "instance_name": { + Type: schema.TypeString, + Computed: true, + }, + "strategy_mode": { + Type: schema.TypeString, + Computed: true, + }, + "payment_type": { + Type: schema.TypeString, + Computed: true, + }, + "public_cname_mode": { + Type: schema.TypeString, + Computed: true, + }, + "public_rr": { + Type: schema.TypeString, + Computed: true, + }, + "public_user_domain_name": { + Type: schema.TypeString, + Computed: true, + }, + "public_zone_name": { + Type: schema.TypeString, + Computed: true, + }, + "resource_group_id": { + Type: schema.TypeString, + Computed: true, + }, + "ttl": { + Type: schema.TypeInt, + Computed: true, + }, + "package_edition": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudAlidnsGtmInstancesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeDnsGtmInstances" + request := make(map[string]interface{}) + if v, ok := d.GetOk("lang"); ok { + request["Lang"] = v + } + if v, ok := d.GetOk("resource_group_id"); ok { + request["ResourceGroupId"] = v + } + + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewAlidnsClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-01-09"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_alidns_gtm_instances", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.GtmInstances", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.GtmInstances", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["InstanceId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "payment_type": object["PaymentType"], + "create_time": object["CreateTime"], + "expire_time": object["ExpireTime"], + "id": fmt.Sprint(object["InstanceId"]), + "instance_id": fmt.Sprint(object["InstanceId"]), + "resource_group_id": object["ResourceGroupId"], + "package_edition": object["VersionCode"], + } + + if config, ok := object["Config"].(map[string]interface{}); ok { + mapping["public_zone_name"] = config["PublicZoneName"] + mapping["cname_type"] = config["CnameType"] + mapping["instance_name"] = config["InstanceName"] + mapping["strategy_mode"] = config["StrategyMode"] + mapping["public_cname_mode"] = config["PublicCnameMode"] + mapping["public_rr"] = config["PublicRr"] + mapping["public_user_domain_name"] = config["PublicUserDomainName"] + if v, ok := config["Ttl"]; ok { + mapping["ttl"] = formatInt(v) + } + if v, ok := config["AlertGroup"].(string); ok { + vv, err := convertJsonStringToList(v) + if err != nil { + return WrapError(err) + } else { + mapping["alert_group"] = vv + } + } + + if alertConfigsList, ok := config["AlertConfig"]; ok { + alertConfigConfigArgs := alertConfigsList.([]interface{}) + alertConfigsMaps := make([]map[string]interface{}, 0) + for _, alertConfigMapArgitem := range alertConfigConfigArgs { + alertConfigMapArg := alertConfigMapArgitem.(map[string]interface{}) + alertConfigsMap := map[string]interface{}{} + alertConfigsMap["sms_notice"] = alertConfigMapArg["SmsNotice"] + alertConfigsMap["notice_type"] = alertConfigMapArg["NoticeType"] + alertConfigsMap["email_notice"] = alertConfigMapArg["EmailNotice"] + alertConfigsMap["dingtalk_notice"] = alertConfigMapArg["DingtalkNotice"] + alertConfigsMaps = append(alertConfigsMaps, alertConfigsMap) + } + mapping["alert_config"] = alertConfigsMaps + } + } + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("instances", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alidns_records.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alidns_records.go index 012ceccf0f2..892b8de62b9 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alidns_records.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alidns_records.go @@ -155,6 +155,10 @@ func dataSourceAlicloudAlidnsRecords() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "remark": { + Type: schema.TypeString, + Computed: true, + }, }, }, }, @@ -285,6 +289,7 @@ func dataSourceAlicloudAlidnsRecordsRead(d *schema.ResourceData, meta interface{ "ttl": object.TTL, "type": object.Type, "value": object.Value, + "remark": object.Remark, } ids[i] = object.RecordId s[i] = mapping diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alikafka_consumer_groups.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alikafka_consumer_groups.go index 4f09237a258..bbf4fa88380 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alikafka_consumer_groups.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alikafka_consumer_groups.go @@ -1,6 +1,7 @@ package alicloud import ( + "fmt" "regexp" "github.com/aliyun/alibaba-cloud-sdk-go/services/alikafka" @@ -25,17 +26,55 @@ func dataSourceAlicloudAlikafkaConsumerGroups() *schema.Resource { ValidateFunc: validation.ValidateRegexp, ForceNew: true, }, + // Computed values + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, "output_file": { Type: schema.TypeString, Optional: true, ForceNew: true, }, // Computed values + "names": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, "consumer_ids": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, + "groups": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, + "consumer_id": { + Type: schema.TypeString, + Computed: true, + }, + "remark": { + Type: schema.TypeString, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "tags": tagsSchema(), + }, + }, + }, }, } } @@ -48,6 +87,16 @@ func dataSourceAlicloudAlikafkaConsumerGroupsRead(d *schema.ResourceData, meta i request.InstanceId = d.Get("instance_id").(string) request.RegionId = client.RegionId + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + raw, err := alikafkaService.client.WithAlikafkaClient(func(alikafkaClient *alikafka.Client) (interface{}, error) { return alikafkaClient.GetConsumerList(request) }) @@ -59,38 +108,63 @@ func dataSourceAlicloudAlikafkaConsumerGroupsRead(d *schema.ResourceData, meta i var filteredConsumerGroups []alikafka.ConsumerVO nameRegex, ok := d.GetOk("consumer_id_regex") - if ok && nameRegex.(string) != "" { + for _, consumer := range response.ConsumerList.ConsumerVO { var r *regexp.Regexp - if nameRegex != "" { - r, err = regexp.Compile(nameRegex.(string)) - if err != nil { - return WrapError(err) + + if ok && nameRegex.(string) != "" { + if nameRegex != "" { + r, err = regexp.Compile(nameRegex.(string)) + if err != nil { + return WrapError(err) + } } } - for _, consumer := range response.ConsumerList.ConsumerVO { - if r != nil && !r.MatchString(consumer.ConsumerId) { + + if r != nil && !r.MatchString(consumer.ConsumerId) { + continue + } + + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(consumer.InstanceId, ":", consumer.ConsumerId)]; !ok { continue } - - filteredConsumerGroups = append(filteredConsumerGroups, consumer) } - } else { - filteredConsumerGroups = response.ConsumerList.ConsumerVO + + filteredConsumerGroups = append(filteredConsumerGroups, consumer) } + return alikafkaConsumerGroupsDecriptionAttributes(d, filteredConsumerGroups, meta) } func alikafkaConsumerGroupsDecriptionAttributes(d *schema.ResourceData, consumerGroupsInfo []alikafka.ConsumerVO, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + alikafkaService := AlikafkaService{client} var ids []string + var names []string + var s []map[string]interface{} for _, item := range consumerGroupsInfo { - - ids = append(ids, item.ConsumerId) + mapping := map[string]interface{}{ + "id": fmt.Sprint(item.InstanceId, ":", item.ConsumerId), + "instance_id": item.InstanceId, + "consumer_id": item.ConsumerId, + "remark": item.Remark, + "tags": alikafkaService.tagVOTagsToMap(item.Tags.TagVO), + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, item.ConsumerId) + s = append(s, mapping) } d.SetId(dataResourceIdHash(ids)) - if err := d.Set("consumer_ids", ids); err != nil { + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + if err := d.Set("groups", s); err != nil { return WrapError(err) } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alikafka_instances.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alikafka_instances.go index d3776e9a59a..8aadb782037 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alikafka_instances.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alikafka_instances.go @@ -1,10 +1,14 @@ package alicloud import ( + "fmt" "regexp" "time" - "github.com/aliyun/alibaba-cloud-sdk-go/services/alikafka" + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" @@ -39,6 +43,11 @@ func dataSourceAlicloudAlikafkaInstances() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, "instances": { Type: schema.TypeList, Computed: true, @@ -120,6 +129,89 @@ func dataSourceAlicloudAlikafkaInstances() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "expired_time": { + Type: schema.TypeInt, + Computed: true, + }, + "msg_retain": { + Type: schema.TypeInt, + Computed: true, + }, + "ssl_end_point": { + Type: schema.TypeString, + Computed: true, + }, + "upgrade_service_detail_info": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "current2_open_source_version": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "allowed_list": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "deploy_type": { + Type: schema.TypeString, + Computed: true, + }, + "vpc_list": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "allowed_ip_list": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "port_range": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "internet_list": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "allowed_ip_list": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "port_range": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + }, + }, + "domain_endpoint": { + Type: schema.TypeString, + Computed: true, + }, + "ssl_domain_endpoint": { + Type: schema.TypeString, + Computed: true, + }, + "sasl_domain_endpoint": { + Type: schema.TypeString, + Computed: true, + }, + "tags": tagsSchema(), }, }, }, @@ -129,10 +221,17 @@ func dataSourceAlicloudAlikafkaInstances() *schema.Resource { func dataSourceAlicloudAlikafkaInstancesRead(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) - alikafkaService := AlikafkaService{client} - request := alikafka.CreateGetInstanceListRequest() - request.RegionId = client.RegionId + action := "GetInstanceList" + request := make(map[string]interface{}) + conn, err := client.NewAlikafkaClient() + if err != nil { + return WrapError(err) + } + + request["RegionId"] = client.RegionId + + var objects []map[string]interface{} idsMap := make(map[string]string) if v, ok := d.GetOk("ids"); ok { @@ -140,87 +239,166 @@ func dataSourceAlicloudAlikafkaInstancesRead(d *schema.ResourceData, meta interf if vv == nil { continue } - idsMap[Trim(vv.(string))] = Trim(vv.(string)) + idsMap[vv.(string)] = vv.(string) } } - - raw, err := alikafkaService.client.WithAlikafkaClient(func(alikafkaClient *alikafka.Client) (interface{}, error) { - return alikafkaClient.GetInstanceList(request) - }) - if err != nil { - return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_alikafka_instances", request.GetActionName(), AlibabaCloudSdkGoERROR) + var nameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + nameRegex = regexp.MustCompile(v.(string)) } - addDebug(request.GetActionName(), raw, request.RpcRequest, request) - response, _ := raw.(*alikafka.GetInstanceListResponse) - - var filteredInstances []alikafka.InstanceVO - nameRegex, ok := d.GetOk("name_regex") - if (ok && nameRegex.(string) != "") || (len(idsMap) > 0) { - var r *regexp.Regexp - if nameRegex != "" { - r, err = regexp.Compile(nameRegex.(string)) + + var response map[string]interface{} + pageNo, pageSize := 1, PageSizeLarge + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-16"), StringPointer("AK"), nil, request, &runtime) if err != nil { - return WrapError(err) + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_alikafka_instances", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.InstanceList.InstanceVO", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.InstanceList.InstanceVO", response) } - for _, instance := range response.InstanceList.InstanceVO { - if r != nil && !r.MatchString(instance.Name) { + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if nameRegex != nil && !nameRegex.MatchString(fmt.Sprint(item["Name"])) { continue } + if len(idsMap) > 0 { - if _, ok := idsMap[instance.InstanceId]; !ok { + if _, ok := idsMap[fmt.Sprint(item["InstanceId"])]; !ok { continue } } - - filteredInstances = append(filteredInstances, instance) + objects = append(objects, item) } - } else { - filteredInstances = response.InstanceList.InstanceVO + if len(result) < pageSize { + break + } + pageNo++ } - return alikafkaInstancesDecriptionAttributes(d, filteredInstances, meta) -} -func alikafkaInstancesDecriptionAttributes(d *schema.ResourceData, instancesInfo []alikafka.InstanceVO, meta interface{}) error { - var ids []string - var names []string - var s []map[string]interface{} - - for _, item := range instancesInfo { + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { paidType := PostPaid - if item.PaidType == 0 { + if object["PaidType"] == 0 { paidType = PrePaid } + mapping := map[string]interface{}{ - "id": item.InstanceId, - "name": item.Name, - "create_time": time.Unix(int64(item.CreateTime)/1000, 0).Format("2006-01-02 03:04:05"), - "service_status": item.ServiceStatus, - "deploy_type": item.DeployType, - "vpc_id": item.VpcId, - "vswitch_id": item.VSwitchId, - "io_max": item.IoMax, - "eip_max": item.EipMax, - "disk_type": item.DiskType, - "disk_size": item.DiskSize, - "topic_quota": item.TopicNumLimit, - "paid_type": paidType, - "spec_type": item.SpecType, - "zone_id": item.ZoneId, - "end_point": item.EndPoint, - "security_group": item.SecurityGroup, - "service_version": item.UpgradeServiceDetailInfo.Current2OpenSourceVersion, - "config": item.AllConfig, + "id": object["InstanceId"], + "name": object["Name"], + "create_time": object["CreateTime"], + "service_status": object["ServiceStatus"], + "deploy_type": object["DeployType"], + "vpc_id": object["VpcId"], + "vswitch_id": object["VSwitchId"], + "io_max": object["IoMax"], + "eip_max": object["EipMax"], + "disk_type": object["DiskType"], + "disk_size": object["DiskSize"], + "topic_quota": object["TopicNumLimit"], + "paid_type": paidType, + "service_version": object["UpgradeServiceDetailInfo"].(map[string]interface{})["Current2OpenSourceVersion"], + "spec_type": object["SpecType"], + "zone_id": object["ZoneId"], + "end_point": object["EndPoint"], + "security_group": object["SecurityGroup"], + "config": object["AllConfig"], + "expired_time": object["ExpiredTime"], + "msg_retain": object["MsgRetain"], + "ssl_end_point": object["SslEndPoint"], + "domain_endpoint": object["DomainEndpoint"], + "ssl_domain_endpoint": object["SslDomainEndpoint"], + "sasl_domain_endpoint": object["SaslDomainEndpoint"], + } + tags := make(map[string]interface{}) + t, _ := jsonpath.Get("$.Tags.TagVO", object) + if t != nil { + for _, t := range t.([]interface{}) { + key := t.(map[string]interface{})["Key"].(string) + value := t.(map[string]interface{})["Value"].(string) + if !ignoredTags(key, value) { + tags[key] = value + } + } + } + mapping["tags"] = tags + + DetailInfoMaps := make([]map[string]interface{}, 0) + if _, ok := object["UpgradeServiceDetailInfo"].(map[string]interface{}); ok { + UpgradeServiceDetailInfoMap := map[string]interface{}{} + UpgradeServiceDetailInfoMap["current2_open_source_version"] = object["UpgradeServiceDetailInfo"].(map[string]interface{})["Current2OpenSourceVersion"] + DetailInfoMaps = append(DetailInfoMaps, UpgradeServiceDetailInfoMap) + } + mapping["upgrade_service_detail_info"] = DetailInfoMaps + + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, mapping["name"]) + id := fmt.Sprint(object["InstanceId"]) + + AlikaService := AlikafkaService{client} + if d.Get("enable_details").(bool) { + getResp, err := AlikaService.GetAllowedIpList(id) + if err != nil { + return WrapError(err) + } + + allowedListMaps := make([]map[string]interface{}, 0) + if defaultActionsList, ok := getResp["AllowedList"].(map[string]interface{}); ok { + defaultActionsMap := map[string]interface{}{} + defaultActionsMap["deploy_type"] = defaultActionsList["DeployType"] + if forwardGroupConfigArg, ok := defaultActionsList["VpcList"].([]interface{}); ok { + serverGroupTuplesMaps := make([]map[string]interface{}, 0) + for _, serverGroupTuples := range forwardGroupConfigArg { + serverGroupTuplesArg := serverGroupTuples.(map[string]interface{}) + serverGroupTuplesMap := map[string]interface{}{} + serverGroupTuplesMap["port_range"] = serverGroupTuplesArg["PortRange"] + serverGroupTuplesMap["allowed_ip_list"] = serverGroupTuplesArg["AllowedIpList"] + serverGroupTuplesMaps = append(serverGroupTuplesMaps, serverGroupTuplesMap) + } + defaultActionsMap["vpc_list"] = serverGroupTuplesMaps + } + + if forwardGroupConfigArg, ok := defaultActionsList["InternetList"].([]interface{}); ok { + serverGroupTuplesMaps := make([]map[string]interface{}, 0) + for _, serverGroupTuples := range forwardGroupConfigArg { + serverGroupTuplesArg := serverGroupTuples.(map[string]interface{}) + serverGroupTuplesMap := map[string]interface{}{} + serverGroupTuplesMap["port_range"] = serverGroupTuplesArg["PortRange"] + serverGroupTuplesMap["allowed_ip_list"] = serverGroupTuplesArg["AllowedIpList"] + serverGroupTuplesMaps = append(serverGroupTuplesMaps, serverGroupTuplesMap) + } + defaultActionsMap["internet_list"] = serverGroupTuplesMaps + } + + allowedListMaps = append(allowedListMaps, defaultActionsMap) + + } + mapping["allowed_list"] = allowedListMaps } - ids = append(ids, item.InstanceId) - names = append(names, item.Name) s = append(s, mapping) } d.SetId(dataResourceIdHash(ids)) - if err := d.Set("ids", ids); err != nil { return WrapError(err) } @@ -230,11 +408,9 @@ func alikafkaInstancesDecriptionAttributes(d *schema.ResourceData, instancesInfo if err := d.Set("instances", s); err != nil { return WrapError(err) } - - // create a json file in current directory and write data source to it if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { writeToFile(output.(string), s) } - return nil + return nil } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alikafka_topics.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alikafka_topics.go index 1f9bc9c27a5..6f6a4295f59 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alikafka_topics.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_alikafka_topics.go @@ -1,12 +1,15 @@ package alicloud import ( + "fmt" "regexp" "time" + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/aliyun/alibaba-cloud-sdk-go/services/alikafka" "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" @@ -28,11 +31,33 @@ func dataSourceAlicloudAlikafkaTopics() *schema.Resource { ValidateFunc: validation.ValidateRegexp, ForceNew: true, }, + // Computed values + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "topic": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, "output_file": { Type: schema.TypeString, Optional: true, ForceNew: true, }, + "page_number": { + Type: schema.TypeInt, + Optional: true, + }, + "page_size": { + Type: schema.TypeInt, + Optional: true, + Default: 50, + }, // Computed values "names": { Type: schema.TypeList, @@ -44,6 +69,10 @@ func dataSourceAlicloudAlikafkaTopics() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, "topic": { Type: schema.TypeString, Computed: true, @@ -72,100 +101,167 @@ func dataSourceAlicloudAlikafkaTopics() *schema.Resource { Type: schema.TypeInt, Computed: true, }, + "status_name": { + Type: schema.TypeString, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "tags": tagsSchema(), }, }, }, + "total_count": { + Type: schema.TypeInt, + Computed: true, + }, }, } } func dataSourceAlicloudAlikafkaTopicsRead(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) - alikafkaService := AlikafkaService{client} - - request := alikafka.CreateGetTopicListRequest() - request.InstanceId = d.Get("instance_id").(string) - request.RegionId = client.RegionId - wait := incrementalWait(3*time.Second, 5*time.Second) - var raw interface{} - var err error + action := "GetTopicList" + request := make(map[string]interface{}) + conn, err := client.NewAlikafkaClient() + if err != nil { + return WrapError(err) + } + request["RegionId"] = client.RegionId + request["InstanceId"] = d.Get("instance_id").(string) + if v, ok := d.GetOk("topic"); ok { + request["Topic"] = v + } - err = resource.Retry(5*time.Minute, func() *resource.RetryError { - raw, err = alikafkaService.client.WithAlikafkaClient(func(alikafkaClient *alikafka.Client) (interface{}, error) { - return alikafkaClient.GetTopicList(request) - }) - if err != nil { - if IsExpectedErrors(err, []string{ThrottlingUser}) { - wait() - return resource.RetryableError(err) + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue } - return resource.NonRetryableError(err) + idsMap[vv.(string)] = vv.(string) } - addDebug(request.GetActionName(), raw, request.RpcRequest, request) - return nil - }) + } + var nameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + nameRegex = regexp.MustCompile(v.(string)) + } - if err != nil { - return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_alikafka_topics", request.GetActionName(), AlibabaCloudSdkGoERROR) + var response map[string]interface{} + + if v, ok := d.GetOk("page_number"); ok && v.(int) > 0 { + request["CurrentPage"] = v.(int) + } else { + request["CurrentPage"] = 1 } - response, _ := raw.(*alikafka.GetTopicListResponse) - - var filteredTopics []alikafka.TopicVO - nameRegex, ok := d.GetOk("name_regex") - if ok && nameRegex.(string) != "" { - var r *regexp.Regexp - if nameRegex != "" { - r, err = regexp.Compile(nameRegex.(string)) + if v, ok := d.GetOk("page_size"); ok && v.(int) > 0 { + request["PageSize"] = v.(int) + } else { + request["PageSize"] = PageSizeLarge + } + + var objects []interface{} + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-16"), StringPointer("AK"), nil, request, &runtime) if err != nil { - return WrapError(err) + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_alikafka_topics", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.TopicList.TopicVO", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.TopicList.TopicVO", response) + } + result, _ := resp.([]interface{}) + if isPagingRequest(d) { + objects = result + break } - for _, topic := range response.TopicList.TopicVO { - if r != nil && !r.MatchString(topic.Topic) { + for _, v := range result { + item := v.(map[string]interface{}) + if nameRegex != nil && !nameRegex.MatchString(fmt.Sprint(item["Topic"])) { continue } - filteredTopics = append(filteredTopics, topic) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["InstanceId"], ":", item["Topic"])]; !ok { + continue + } + } + objects = append(objects, item) } - } else { - filteredTopics = response.TopicList.TopicVO + if len(result) < request["PageSize"].(int) { + break + } + request["CurrentPage"] = request["CurrentPage"].(int) + 1 } - return alikafkaTopicsDecriptionAttributes(d, filteredTopics, meta) -} -func alikafkaTopicsDecriptionAttributes(d *schema.ResourceData, topicsInfo []alikafka.TopicVO, meta interface{}) error { - var names []string - var s []map[string]interface{} + ids := make([]string, 0) + names := make([]interface{}, 0) - for _, item := range topicsInfo { + s := make([]map[string]interface{}, 0) + for _, v := range objects { + object := v.(map[string]interface{}) mapping := map[string]interface{}{ - "topic": item.Topic, - "create_time": time.Unix(int64(item.CreateTime)/1000, 0).Format("2006-01-02 03:04:05"), - "local_topic": item.LocalTopic, - "compact_topic": item.CompactTopic, - "partition_num": item.PartitionNum, - "remark": item.Remark, - "status": item.Status, + "id": fmt.Sprint(object["InstanceId"], ":", object["Topic"]), + "topic": object["Topic"], + "create_time": object["CreateTime"], + "local_topic": object["LocalTopic"], + "compact_topic": object["CompactTopic"], + "partition_num": object["PartitionNum"], + "remark": object["Remark"], + "status": object["Status"], + "status_name": object["StatusName"], + "instance_id": object["InstanceId"], } - - names = append(names, item.Topic) + tags := make(map[string]interface{}) + t, _ := jsonpath.Get("$.Tags.TagVO", object) + if t != nil { + for _, t := range t.([]interface{}) { + key := t.(map[string]interface{})["Key"].(string) + value := t.(map[string]interface{})["Value"].(string) + if !ignoredTags(key, value) { + tags[key] = value + } + } + } + mapping["tags"] = tags + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, mapping["name"]) s = append(s, mapping) } - d.SetId(dataResourceIdHash(names)) - + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } if err := d.Set("names", names); err != nil { return WrapError(err) } if err := d.Set("topics", s); err != nil { return WrapError(err) } - - // create a json file in current directory and write data source to it + if err := d.Set("total_count", formatInt(response["Total"])); err != nil { + return WrapError(err) + } if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { writeToFile(output.(string), s) } - return nil + return nil } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_amqp_bindings.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_amqp_bindings.go new file mode 100644 index 00000000000..e8bb4ec715d --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_amqp_bindings.go @@ -0,0 +1,159 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudAmqpBindings() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudAmqpBindingsRead, + Schema: map[string]*schema.Schema{ + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "virtual_host_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "bindings": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, + "argument": { + Type: schema.TypeString, + Computed: true, + }, + "binding_key": { + Type: schema.TypeString, + Computed: true, + }, + "binding_type": { + Type: schema.TypeString, + Computed: true, + }, + "destination_name": { + Type: schema.TypeString, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "source_exchange": { + Type: schema.TypeString, + Computed: true, + }, + "virtual_host_name": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudAmqpBindingsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListBindings" + request := make(map[string]interface{}) + request["InstanceId"] = d.Get("instance_id") + request["VirtualHost"] = d.Get("virtual_host_name") + request["MaxResults"] = PageSizeLarge + var objects []map[string]interface{} + var response map[string]interface{} + conn, err := client.NewOnsproxyClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("GET"), StringPointer("2019-12-12"), StringPointer("AK"), request, nil, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_amqp_bindings", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Data.Bindings", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Data.Bindings", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "id": fmt.Sprint(request["InstanceId"], ":", request["VirtualHost"], ":", object["SourceExchange"], ":", object["DestinationName"]), + "argument": object["Argument"], + "binding_key": object["BindingKey"], + "binding_type": object["BindingType"], + "destination_name": object["DestinationName"], + "instance_id": request["InstanceId"], + "source_exchange": object["SourceExchange"], + "virtual_host_name": request["VirtualHost"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("bindings", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_amqp_instances.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_amqp_instances.go index 50d8bc81cf7..2ba4db44dda 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_amqp_instances.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_amqp_instances.go @@ -218,7 +218,7 @@ func dataSourceAlicloudAmqpInstancesRead(d *schema.ResourceData, meta interface{ } id := fmt.Sprint(object["InstanceId"]) bssOpenApiService := BssOpenApiService{client} - getResp, err := bssOpenApiService.QueryAvailableInstances(id, "ons", "ons_onsproxy_pre") + getResp, err := bssOpenApiService.QueryAvailableInstances(id, "ons", "ons_onsproxy_pre", "ons_onsproxy_public_intl") if err != nil { return WrapError(err) } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_arms_dispatch_rules.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_arms_dispatch_rules.go new file mode 100644 index 00000000000..2ada756c05e --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_arms_dispatch_rules.go @@ -0,0 +1,355 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudArmsDispatchRules() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudArmsDispatchRulesRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "dispatch_rule_name": { + Type: schema.TypeString, + Optional: true, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "rules": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, + "dispatch_rule_id": { + Type: schema.TypeString, + Computed: true, + }, + "group_rules": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "group_id": { + Type: schema.TypeInt, + Computed: true, + }, + "group_wait_time": { + Type: schema.TypeInt, + Computed: true, + }, + "group_interval": { + Type: schema.TypeInt, + Computed: true, + }, + "grouping_fields": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "repeat_interval": { + Type: schema.TypeInt, + Computed: true, + }, + }, + }, + }, + "dispatch_type": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "label_match_expression_grid": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "label_match_expression_groups": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "label_match_expressions": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Computed: true, + }, + "value": { + Type: schema.TypeString, + Computed: true, + }, + "operator": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + "notify_rules": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "notify_objects": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "notify_object_id": { + Type: schema.TypeString, + Computed: true, + }, + "notify_type": { + Type: schema.TypeString, + Computed: true, + }, + "name": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "notify_channels": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + }, + "dispatch_rule_name": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudArmsDispatchRulesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListDispatchRule" + request := make(map[string]interface{}) + if v, ok := d.GetOk("dispatch_rule_name"); ok { + request["Name"] = v + } + request["RegionId"] = client.RegionId + var objects []map[string]interface{} + var dispatchRuleNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + dispatchRuleNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewArmsClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-08-08"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_arms_dispatch_rules", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.DispatchRules", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.DispatchRules", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if dispatchRuleNameRegex != nil && !dispatchRuleNameRegex.MatchString(fmt.Sprint(item["Name"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["RuleId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "id": fmt.Sprint(object["RuleId"]), + "dispatch_rule_id": fmt.Sprint(object["RuleId"]), + "dispatch_rule_name": object["Name"], + "status": object["State"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["Name"]) + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + s = append(s, mapping) + continue + } + id := fmt.Sprint(object["RuleId"]) + armsService := ArmsService{client} + getResp, err := armsService.DescribeArmsDispatchRule(id) + if err != nil { + return WrapError(err) + } + if groupRulesList, ok := getResp["GroupRules"]; ok && groupRulesList != nil { + groupRulesMaps := make([]map[string]interface{}, 0) + for _, groupRulesListItem := range groupRulesList.([]interface{}) { + if groupRulesItemMap, ok := groupRulesListItem.(map[string]interface{}); ok { + groupRulesMap := make(map[string]interface{}, 0) + groupRulesMap["group_interval"] = groupRulesItemMap["GroupInterval"] + groupRulesMap["group_wait_time"] = groupRulesItemMap["GroupWaitTime"] + groupRulesMap["group_id"] = groupRulesItemMap["GroupId"] + groupRulesMap["grouping_fields"] = groupRulesItemMap["GroupingFields"] + groupRulesMap["repeat_interval"] = groupRulesItemMap["RepeatInterval"] + groupRulesMaps = append(groupRulesMaps, groupRulesMap) + } + } + mapping["group_rules"] = groupRulesMaps + } + if labelMatchExpressionGrid, ok := getResp["LabelMatchExpressionGrid"]; ok && labelMatchExpressionGrid != nil { + labelMatchExpressionGridMaps := make([]map[string]interface{}, 0) + labelMatchExpressionGridMap := make(map[string]interface{}) + + labelMatchExpressionGroupsMaps := make([]map[string]interface{}, 0) + if v, ok := labelMatchExpressionGrid.(map[string]interface{})["LabelMatchExpressionGroups"]; ok && v != nil { + for _, labelMatchExpressionGroups := range v.([]interface{}) { + labelMatchExpressionGroupsMap := make(map[string]interface{}) + labelMatchExpressionsMaps := make([]map[string]interface{}, 0) + if v, ok := labelMatchExpressionGroups.(map[string]interface{})["LabelMatchExpressions"]; ok && v != nil { + for _, labelMatchExpressions := range v.([]interface{}) { + labelMatchExpressionsArg := labelMatchExpressions.(map[string]interface{}) + labelMatchExpressionsMap := make(map[string]interface{}, 0) + labelMatchExpressionsMap["operator"] = labelMatchExpressionsArg["Operator"] + labelMatchExpressionsMap["key"] = labelMatchExpressionsArg["Key"] + labelMatchExpressionsMap["value"] = labelMatchExpressionsArg["Value"] + labelMatchExpressionsMaps = append(labelMatchExpressionsMaps, labelMatchExpressionsMap) + } + } + labelMatchExpressionGroupsMap["label_match_expressions"] = labelMatchExpressionsMaps + labelMatchExpressionGroupsMaps = append(labelMatchExpressionGroupsMaps, labelMatchExpressionGroupsMap) + } + } + labelMatchExpressionGridMap["label_match_expression_groups"] = labelMatchExpressionGroupsMaps + labelMatchExpressionGridMaps = append(labelMatchExpressionGridMaps, labelMatchExpressionGridMap) + mapping["label_match_expression_grid"] = labelMatchExpressionGridMaps + } + + if notifyRulesList, ok := getResp["NotifyRules"]; ok && notifyRulesList != nil { + notifyRulesMaps := make([]map[string]interface{}, 0) + for _, notifyRulesListItem := range notifyRulesList.([]interface{}) { + if notifyRulesItemMap, ok := notifyRulesListItem.(map[string]interface{}); ok { + notifyRulesMap := make(map[string]interface{}, 0) + notifyObjectsMaps := make([]map[string]interface{}, 0) + for _, notifyObjects := range notifyRulesItemMap["NotifyObjects"].([]interface{}) { + notifyObjectsArg := notifyObjects.(map[string]interface{}) + notifyObjectsMap := make(map[string]interface{}, 0) + notifyObjectsMap["notify_type"] = convertArmsDispatchRuleNotifyTypeResponse(notifyObjectsArg["NotifyType"]) + notifyObjectsMap["notify_object_id"] = notifyObjectsArg["NotifyObjectId"] + notifyObjectsMap["name"] = notifyObjectsArg["Name"] + notifyObjectsMaps = append(notifyObjectsMaps, notifyObjectsMap) + } + notifyRulesMap["notify_objects"] = notifyObjectsMaps + notifyRulesMap["notify_channels"] = notifyRulesItemMap["NotifyChannels"] + notifyRulesMaps = append(notifyRulesMaps, notifyRulesMap) + } + } + mapping["notify_rules"] = notifyRulesMaps + } + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("rules", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_arms_prometheus_alert_rules.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_arms_prometheus_alert_rules.go new file mode 100644 index 00000000000..ce204fcf5d6 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_arms_prometheus_alert_rules.go @@ -0,0 +1,291 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudArmsPrometheusAlertRules() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudArmsPrometheusAlertRulesRead, + Schema: map[string]*schema.Schema{ + "cluster_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "match_expressions": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "status": { + Type: schema.TypeInt, + Optional: true, + ForceNew: true, + ValidateFunc: validation.IntInSlice([]int{0, 1}), + }, + "type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "rules": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "annotations": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Computed: true, + }, + "value": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "cluster_id": { + Type: schema.TypeString, + Computed: true, + }, + "dispatch_rule_id": { + Type: schema.TypeString, + Computed: true, + }, + "duration": { + Type: schema.TypeString, + Computed: true, + }, + "expression": { + Type: schema.TypeString, + Computed: true, + }, + "labels": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Computed: true, + }, + "value": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "message": { + Type: schema.TypeString, + Computed: true, + }, + "notify_type": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "prometheus_alert_rule_id": { + Type: schema.TypeString, + Computed: true, + }, + "prometheus_alert_rule_name": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeInt, + Computed: true, + }, + "type": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudArmsPrometheusAlertRulesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListPrometheusAlertRules" + request := make(map[string]interface{}) + request["ClusterId"] = d.Get("cluster_id") + if v, ok := d.GetOk("match_expressions"); ok { + request["MatchExpressions"] = v + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("status"); ok { + request["Status"] = v + } + if v, ok := d.GetOk("type"); ok { + request["Type"] = v + } + var objects []map[string]interface{} + var prometheusAlertRuleNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + prometheusAlertRuleNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewArmsClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-08-08"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_arms_prometheus_alert_rules", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.PrometheusAlertRules", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.PrometheusAlertRules", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if prometheusAlertRuleNameRegex != nil && !prometheusAlertRuleNameRegex.MatchString(fmt.Sprint(item["AlertName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["ClusterId"], ":", item["AlertId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "cluster_id": object["ClusterId"], + "dispatch_rule_id": fmt.Sprint(object["DispatchRuleId"]), + "duration": object["Duration"], + "expression": object["Expression"], + "message": object["Message"], + "notify_type": object["NotifyType"], + "id": fmt.Sprint(object["ClusterId"], ":", object["AlertId"]), + "prometheus_alert_rule_id": fmt.Sprint(object["AlertId"]), + "prometheus_alert_rule_name": object["AlertName"], + "status": formatInt(object["Status"]), + "type": object["Type"], + } + if v, ok := object["Annotations"].([]interface{}); ok { + annotations := make([]map[string]interface{}, 0) + for _, val := range v { + item := val.(map[string]interface{}) + temp := map[string]interface{}{ + "name": item["Name"], + "value": item["Value"], + } + + annotations = append(annotations, temp) + } + mapping["annotations"] = annotations + } + if v, ok := object["Labels"].([]interface{}); ok { + labels := make([]map[string]interface{}, 0) + for _, val := range v { + item := val.(map[string]interface{}) + temp := map[string]interface{}{ + "name": item["Name"], + "value": item["Value"], + } + + labels = append(labels, temp) + } + mapping["labels"] = labels + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["AlertName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("rules", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_bastionhost_host_accounts.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_bastionhost_host_accounts.go new file mode 100644 index 00000000000..8f5941a6bdc --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_bastionhost_host_accounts.go @@ -0,0 +1,224 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudBastionhostHostAccounts() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudBastionhostHostAccountsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "host_account_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "host_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "protocol_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"RDP", "SSH"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "accounts": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "has_password": { + Type: schema.TypeBool, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "host_account_id": { + Type: schema.TypeString, + Computed: true, + }, + "host_account_name": { + Type: schema.TypeString, + Computed: true, + }, + "host_id": { + Type: schema.TypeString, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "private_key_fingerprint": { + Type: schema.TypeString, + Computed: true, + }, + "protocol_name": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudBastionhostHostAccountsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListHostAccounts" + request := make(map[string]interface{}) + if v, ok := d.GetOk("host_account_name"); ok { + request["HostAccountName"] = v + } + request["HostId"] = d.Get("host_id") + request["InstanceId"] = d.Get("instance_id") + if v, ok := d.GetOk("protocol_name"); ok { + request["ProtocolName"] = v + } + request["RegionId"] = client.RegionId + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + var hostAccountNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + hostAccountNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewBastionhostClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_bastionhost_host_accounts", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.HostAccounts", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.HostAccounts", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if hostAccountNameRegex != nil && !hostAccountNameRegex.MatchString(fmt.Sprint(item["HostAccountName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["HostAccountId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "has_password": object["HasPassword"], + "id": fmt.Sprint(object["HostAccountId"]), + "host_account_id": fmt.Sprint(object["HostAccountId"]), + "host_account_name": object["HostAccountName"], + "host_id": object["HostId"], + "instance_id": request["InstanceId"], + "private_key_fingerprint": object["PrivateKeyFingerprint"], + "protocol_name": object["ProtocolName"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["HostAccountName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("accounts", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_bastionhost_host_groups.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_bastionhost_host_groups.go new file mode 100644 index 00000000000..5be453cf8bf --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_bastionhost_host_groups.go @@ -0,0 +1,194 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudBastionhostHostGroups() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudBastionhostHostGroupsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "host_group_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "groups": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "comment": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "host_group_id": { + Type: schema.TypeString, + Computed: true, + }, + "host_group_name": { + Type: schema.TypeString, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudBastionhostHostGroupsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListHostGroups" + request := make(map[string]interface{}) + if v, ok := d.GetOk("host_group_name"); ok { + request["HostGroupName"] = v + } + request["InstanceId"] = d.Get("instance_id") + request["RegionId"] = client.RegionId + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + var hostGroupNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + hostGroupNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewBastionhostClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_bastionhost_host_groups", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.HostGroups", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.HostGroups", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if hostGroupNameRegex != nil && !hostGroupNameRegex.MatchString(fmt.Sprint(item["HostGroupName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["HostGroupId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "comment": object["Comment"], + "id": fmt.Sprint(object["HostGroupId"]), + "host_group_id": fmt.Sprint(object["HostGroupId"]), + "host_group_name": object["HostGroupName"], + "instance_id": request["InstanceId"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["HostGroupName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("groups", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_bastionhost_hosts.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_bastionhost_hosts.go new file mode 100644 index 00000000000..24456411069 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_bastionhost_hosts.go @@ -0,0 +1,291 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudBastionhostHosts() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudBastionhostHostsRead, + Schema: map[string]*schema.Schema{ + "host_address": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "host_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "os_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Linux", "Windows"}, false), + }, + "source": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Ecs", "Local", "Rds"}, false), + }, + "source_instance_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "source_instance_state": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "hosts": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "active_address_type": { + Type: schema.TypeString, + Computed: true, + }, + "comment": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "host_id": { + Type: schema.TypeString, + Computed: true, + }, + "host_name": { + Type: schema.TypeString, + Computed: true, + }, + "host_private_address": { + Type: schema.TypeString, + Computed: true, + }, + "host_public_address": { + Type: schema.TypeString, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "os_type": { + Type: schema.TypeString, + Computed: true, + }, + "protocols": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "host_finger_print": { + Type: schema.TypeString, + Computed: true, + }, + "port": { + Type: schema.TypeInt, + Computed: true, + }, + "protocol_name": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "source": { + Type: schema.TypeString, + Computed: true, + }, + "source_instance_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudBastionhostHostsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListHosts" + request := make(map[string]interface{}) + if v, ok := d.GetOk("host_address"); ok { + request["HostAddress"] = v + } + if v, ok := d.GetOk("host_name"); ok { + request["HostName"] = v + } + request["InstanceId"] = d.Get("instance_id") + if v, ok := d.GetOk("os_type"); ok { + request["OSType"] = v + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("source"); ok { + request["Source"] = v + } + if v, ok := d.GetOk("source_instance_id"); ok { + request["SourceInstanceId"] = v + } + if v, ok := d.GetOk("source_instance_state"); ok { + request["SourceInstanceState"] = v + } + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + var hostNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + hostNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewBastionhostClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_bastionhost_hosts", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Hosts", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Hosts", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if hostNameRegex != nil && !hostNameRegex.MatchString(fmt.Sprint(item["HostName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["HostId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "active_address_type": object["ActiveAddressType"], + "comment": object["Comment"], + "id": fmt.Sprint(object["HostId"]), + "host_id": fmt.Sprint(object["HostId"]), + "host_name": object["HostName"], + "host_private_address": object["HostPrivateAddress"], + "host_public_address": object["HostPublicAddress"], + "instance_id": request["InstanceId"], + "os_type": object["OSType"], + "source": object["Source"], + "source_instance_id": object["SourceInstanceId"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["HostName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("hosts", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_bastionhost_instances.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_bastionhost_instances.go index f344eafd4cf..bd5fefbe62e 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_bastionhost_instances.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_bastionhost_instances.go @@ -174,7 +174,7 @@ func dataSourceAlicloudBastionhostInstancesRead(d *schema.ResourceData, meta int BastionhostService := YundunBastionhostService{client} for _, instanceId := range instanceIds { - object, err := BastionhostService.DescribeBastionhostInstanceAttribute(instanceId) + object, err := BastionhostService.DescribeBastionhostInstance(instanceId) if err != nil { return WrapError(err) } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_bastionhost_users.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_bastionhost_users.go new file mode 100644 index 00000000000..e853c94ed2b --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_bastionhost_users.go @@ -0,0 +1,275 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudBastionhostUsers() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudBastionhostUsersRead, + Schema: map[string]*schema.Schema{ + "display_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "mobile": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "source": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Local", "Ram"}, false), + }, + "source_user_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Expired", "Frozen", "Normal"}, false), + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "user_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "users": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "comment": { + Type: schema.TypeString, + Computed: true, + }, + "display_name": { + Type: schema.TypeString, + Computed: true, + }, + "email": { + Type: schema.TypeString, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "mobile": { + Type: schema.TypeString, + Computed: true, + }, + "mobile_country_code": { + Type: schema.TypeString, + Computed: true, + }, + "source": { + Type: schema.TypeString, + Computed: true, + }, + "source_user_id": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "user_id": { + Type: schema.TypeString, + Computed: true, + }, + "user_name": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudBastionhostUsersRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListUsers" + request := make(map[string]interface{}) + if v, ok := d.GetOk("display_name"); ok { + request["DisplayName"] = v + } + request["InstanceId"] = d.Get("instance_id") + if v, ok := d.GetOk("mobile"); ok { + request["Mobile"] = v + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("source"); ok { + request["Source"] = v + } + if v, ok := d.GetOk("source_user_id"); ok { + request["SourceUserId"] = v + } + if v, ok := d.GetOk("status"); ok { + request["UserState"] = v + } + if v, ok := d.GetOk("user_name"); ok { + request["UserName"] = v + } + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + var userNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + userNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewBastionhostClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_bastionhost_users", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Users", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Users", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if userNameRegex != nil && !userNameRegex.MatchString(fmt.Sprint(item["UserName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["UserId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "comment": object["Comment"], + "display_name": object["DisplayName"], + "email": object["Email"], + "instance_id": request["InstanceId"], + "mobile": object["Mobile"], + "mobile_country_code": object["MobileCountryCode"], + "source": object["Source"], + "source_user_id": object["SourceUserId"], + "id": fmt.Sprint(object["UserId"]), + "user_id": fmt.Sprint(object["UserId"]), + "user_name": object["UserName"], + } + if object["UserState"] != nil { + for _, userState := range object["UserState"].([]interface{}) { + mapping["status"] = fmt.Sprint(userState) + } + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["UserName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("users", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cddc_dedicated_host_accounts.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cddc_dedicated_host_accounts.go new file mode 100644 index 00000000000..83ed4809565 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cddc_dedicated_host_accounts.go @@ -0,0 +1,191 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudCddcDedicatedHostAccounts() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudCddcDedicatedHostAccountsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "dedicated_host_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "page_number": { + Type: schema.TypeInt, + Optional: true, + ForceNew: true, + }, + "page_size": { + Type: schema.TypeInt, + Optional: true, + ForceNew: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "accounts": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, + "account_name": { + Type: schema.TypeString, + Computed: true, + }, + "dedicated_host_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudCddcDedicatedHostAccountsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeDedicatedHosts" + request := make(map[string]interface{}) + if v, ok := d.GetOk("dedicated_host_id"); ok { + request["DedicatedHostId"] = v + } + if v, ok := d.GetOk("page_number"); ok { + request["PageNumbers"] = v + } else { + request["PageNumbers"] = 1 + } + if v, ok := d.GetOk("page_size"); ok { + request["PageSize"] = v + } else { + request["PageSize"] = PageSizeMedium + } + request["RegionId"] = client.RegionId + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var accountNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + accountNameRegex = r + } + var response map[string]interface{} + conn, err := client.NewCddcClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-03-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_cddc_dedicated_host_accounts", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.DedicatedHosts.DedicatedHosts", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.DedicatedHosts.DedicatedHosts", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if accountNameRegex != nil && !accountNameRegex.MatchString(fmt.Sprint(item["AccountName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["DedicatedHostId"], ":", item["AccountName"])]; !ok { + continue + } + } + objects = append(objects, item) + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "id": fmt.Sprint(object["DedicatedHostId"], ":", object["AccountName"]), + "account_name": fmt.Sprint(object["AccountName"]), + "dedicated_host_id": object["DedicatedHostId"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["AccountName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("accounts", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cddc_dedicated_host_groups.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cddc_dedicated_host_groups.go index dc0a34d5a43..e9df2871cd8 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cddc_dedicated_host_groups.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cddc_dedicated_host_groups.go @@ -2,8 +2,11 @@ package alicloud import ( "fmt" + "regexp" "time" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + "github.com/PaesslerAG/jsonpath" util "github.com/alibabacloud-go/tea-utils/service" "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" @@ -27,6 +30,17 @@ func dataSourceAlicloudCddcDedicatedHostGroups() *schema.Resource { Optional: true, ForceNew: true, }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, "output_file": { Type: schema.TypeString, Optional: true, @@ -182,6 +196,14 @@ func dataSourceAlicloudCddcDedicatedHostGroupsRead(d *schema.ResourceData, meta } request["RegionId"] = client.RegionId var objects []map[string]interface{} + var userNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + userNameRegex = r + } idsMap := make(map[string]string) if v, ok := d.GetOk("ids"); ok { @@ -222,6 +244,9 @@ func dataSourceAlicloudCddcDedicatedHostGroupsRead(d *schema.ResourceData, meta result, _ := resp.([]interface{}) for _, v := range result { item := v.(map[string]interface{}) + if userNameRegex != nil && !userNameRegex.MatchString(fmt.Sprint(item["DedicatedHostGroupDesc"])) { + continue + } if len(idsMap) > 0 { if _, ok := idsMap[fmt.Sprint(item["DedicatedHostGroupId"])]; !ok { continue @@ -230,6 +255,7 @@ func dataSourceAlicloudCddcDedicatedHostGroupsRead(d *schema.ResourceData, meta objects = append(objects, item) } ids := make([]string, 0) + names := make([]interface{}, 0) s := make([]map[string]interface{}, 0) for _, object := range objects { mapping := map[string]interface{}{ @@ -261,6 +287,7 @@ func dataSourceAlicloudCddcDedicatedHostGroupsRead(d *schema.ResourceData, meta "vpc_id": object["VPCId"], } ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["DedicatedHostGroupDesc"]) s = append(s, mapping) } @@ -268,7 +295,9 @@ func dataSourceAlicloudCddcDedicatedHostGroupsRead(d *schema.ResourceData, meta if err := d.Set("ids", ids); err != nil { return WrapError(err) } - + if err := d.Set("names", names); err != nil { + return WrapError(err) + } if err := d.Set("groups", s); err != nil { return WrapError(err) } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cddc_dedicated_hosts.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cddc_dedicated_hosts.go new file mode 100644 index 00000000000..5cc173d11c4 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cddc_dedicated_hosts.go @@ -0,0 +1,356 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudCddcDedicatedHosts() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudCddcDedicatedHostsRead, + Schema: map[string]*schema.Schema{ + "allocation_status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Allocatable", "Suspended"}, false), + }, + "dedicated_host_group_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "host_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"dhg_local_ssd", "dhg_cloud_ssd"}, false), + }, + "order_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"0", "1", "2", "3", "4", "5", "6", "7"}, false), + }, + "tags": tagsSchema(), + "zone_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "hosts": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "bastion_instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "cpu_allocation_ratio": { + Type: schema.TypeString, + Computed: true, + }, + "cpu_used": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "dedicated_host_group_id": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "dedicated_host_id": { + Type: schema.TypeString, + Computed: true, + }, + "disk_allocation_ratio": { + Type: schema.TypeString, + Computed: true, + }, + "ecs_class_code": { + Type: schema.TypeString, + Computed: true, + }, + "end_time": { + Type: schema.TypeString, + Computed: true, + }, + "engine": { + Type: schema.TypeString, + Computed: true, + }, + "expired_time": { + Type: schema.TypeString, + Computed: true, + }, + "host_class": { + Type: schema.TypeString, + Computed: true, + }, + "host_cpu": { + Type: schema.TypeString, + Computed: true, + }, + "host_mem": { + Type: schema.TypeString, + Computed: true, + }, + "host_name": { + Type: schema.TypeString, + Computed: true, + }, + "host_storage": { + Type: schema.TypeString, + Computed: true, + }, + "host_type": { + Type: schema.TypeString, + Computed: true, + }, + "image_category": { + Type: schema.TypeString, + Computed: true, + }, + "ip_address": { + Type: schema.TypeString, + Computed: true, + }, + "mem_allocation_ratio": { + Type: schema.TypeString, + Computed: true, + }, + "memory_used": { + Type: schema.TypeString, + Computed: true, + }, + "open_permission": { + Type: schema.TypeString, + Computed: true, + }, + "allocation_status": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "storage_used": { + Type: schema.TypeString, + Computed: true, + }, + "tags": { + Type: schema.TypeMap, + Computed: true, + }, + "vswitch_id": { + Type: schema.TypeString, + Computed: true, + }, + "vpc_id": { + Type: schema.TypeString, + Computed: true, + }, + "zone_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudCddcDedicatedHostsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeDedicatedHosts" + request := make(map[string]interface{}) + if v, ok := d.GetOk("allocation_status"); ok { + request["AllocationStatus"] = v + } + request["DedicatedHostGroupId"] = d.Get("dedicated_host_group_id") + if v, ok := d.GetOk("status"); ok { + request["HostStatus"] = v + } + if v, ok := d.GetOk("host_type"); ok { + request["HostType"] = v + } + if v, ok := d.GetOk("tags"); ok { + respJson, err := convertMaptoJsonString(v.(map[string]interface{})) + if err != nil { + return WrapError(err) + } + request["Tags"] = respJson + } + if v, ok := d.GetOk("order_id"); ok { + request["OrderId"] = v + } + request["PageNumbers"] = 1 + request["PageSize"] = PageSizeLarge + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("zone_id"); ok { + request["ZoneId"] = v + } + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewCddcClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-03-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_cddc_dedicated_hosts", action, AlibabaCloudSdkGoERROR) + } + if _, ok := response["DedicatedHosts"]; !ok { + break + } + resp, err := jsonpath.Get("$.DedicatedHosts.DedicatedHosts", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.DedicatedHosts.DedicatedHosts", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["DedicatedHostGroupId"], ":", item["DedicatedHostId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "bastion_instance_id": object["BastionInstanceId"], + "cpu_allocation_ratio": object["CPUAllocationRatio"], + "cpu_used": object["CpuUsed"], + "create_time": object["CreatedTime"], + "dedicated_host_group_id": object["DedicatedHostGroupId"], + "id": fmt.Sprint(object["DedicatedHostGroupId"], ":", object["DedicatedHostId"]), + "dedicated_host_id": fmt.Sprint(object["DedicatedHostId"]), + "disk_allocation_ratio": object["DiskAllocationRatio"], + "ecs_class_code": object["EcsClassCode"], + "end_time": object["EndTime"], + "engine": object["Engine"], + "host_class": object["HostClass"], + "host_cpu": object["HostCPU"], + "host_mem": object["HostMem"], + "host_name": object["HostName"], + "host_storage": object["HostStorage"], + "host_type": object["HostType"], + "image_category": object["ImageCategory"], + "ip_address": object["IPAddress"], + "mem_allocation_ratio": object["MemAllocationRatio"], + "memory_used": object["MemoryUsed"], + "open_permission": object["OpenPermission"], + "allocation_status": convertCddcAllocationStatusResponse(object["AllocationStatus"].(string)), + "status": object["HostStatus"], + "storage_used": object["StorageUsed"], + "vswitch_id": object["VSwitchId"], + "vpc_id": object["VPCId"], + "zone_id": object["ZoneId"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + s = append(s, mapping) + continue + } + id := fmt.Sprint(object["DedicatedHostGroupId"], ":", object["DedicatedHostId"]) + cddcService := CddcService{client} + getResp, err := cddcService.DescribeCddcDedicatedHost(id) + if err != nil { + return WrapError(err) + } + mapping["expired_time"] = getResp["ExpiredTime"] + getResp1, err := cddcService.ListTagResources(id, "DEDICATEDHOST") + if err != nil { + return WrapError(err) + } + mapping["tags"] = tagsToMap(getResp1) + + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("hosts", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cddc_host_ecs_level_infos.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cddc_host_ecs_level_infos.go new file mode 100644 index 00000000000..523a194ec96 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cddc_host_ecs_level_infos.go @@ -0,0 +1,141 @@ +package alicloud + +import ( + "strconv" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudCddcHostEcsLevelInfos() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudCddcHostEcsLevelInfosRead, + Schema: map[string]*schema.Schema{ + "db_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"mysql", "mssql", "pgsql", "redis"}, false), + }, + "zone_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "storage_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"local_ssd", "cloud_essd", "cloud_essd2", "cloud_essd3"}, false), + }, + "image_category": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"WindowsWithMssqlEntAlwaysonLicense", "WindowsWithMssqlStdLicense", "WindowsWithMssqlEntLicense", "WindowsWithMssqlWebLicense", "AliLinux"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "infos": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "res_class_code": { + Type: schema.TypeString, + Computed: true, + }, + "ecs_class_code": { + Type: schema.TypeString, + Computed: true, + }, + "ecs_class": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudCddcHostEcsLevelInfosRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DescribeHostEcsLevelInfo" + request := make(map[string]interface{}) + request["DbType"] = d.Get("db_type") + request["RegionId"] = client.RegionId + request["ZoneId"] = d.Get("zone_id") + request["StorageType"] = d.Get("storage_type") + if v, ok := d.GetOk("image_category"); ok { + request["ImageCategory"] = v + } + var objects []map[string]interface{} + var response map[string]interface{} + conn, err := client.NewCddcClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-03-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_cddc_host_ecs_level_infos", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.HostEcsLevelInfos", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.HostEcsLevelInfos", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + objects = append(objects, item) + } + s := make([]map[string]interface{}, 0) + for _, object := range objects { + for _, item := range object["Items"].([]interface{}) { + itemArr := item.(map[string]interface{}) + mapping := map[string]interface{}{ + "description": itemArr["Description"], + "res_class_code": itemArr["RdsClassCode"], + "ecs_class_code": itemArr["EcsClassCode"], + "ecs_class": itemArr["EcsClass"], + } + s = append(s, mapping) + } + } + d.SetId(strconv.FormatInt(time.Now().Unix(), 16)) + if err := d.Set("infos", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cddc_zones.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cddc_zones.go new file mode 100644 index 00000000000..790e2b2f682 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cddc_zones.go @@ -0,0 +1,119 @@ +package alicloud + +import ( + "fmt" + "strings" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudCddcZones() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudCddcZonesRead, + Schema: map[string]*schema.Schema{ + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "ids": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "zones": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "region_id": { + Type: schema.TypeString, + Computed: true, + }, + "zone_id": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudCddcZonesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + ids := make([]string, 0) + action := "DescribeRegions" + request := make(map[string]interface{}) + var objects []map[string]interface{} + var response map[string]interface{} + conn, err := client.NewCddcClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-03-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_cddc_zones", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Regions.RDSRegion", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Regions.RDSRegion", response) + } + + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if client.RegionId != item["RegionId"].(string) { + continue + } + if strings.Contains(strings.ToLower(item["ZoneId"].(string)), strings.ToLower("MAZ")) { + continue + } + objects = append(objects, item) + } + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "region_id": object["RegionId"], + "zone_id": object["ZoneId"], + "id": fmt.Sprint(object["ZoneId"]), + } + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("zones", s); err != nil { + return WrapError(err) + } + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cdn_ip_info.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cdn_ip_info.go new file mode 100644 index 00000000000..d48ab253c63 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cdn_ip_info.go @@ -0,0 +1,94 @@ +package alicloud + +import ( + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudCdnIpInfo() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudCdnIpInfoRead, + Schema: map[string]*schema.Schema{ + "ip": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "cdn_ip": { + Type: schema.TypeString, + Computed: true, + }, + "isp": { + Type: schema.TypeString, + Computed: true, + }, + "isp_ename": { + Type: schema.TypeString, + Computed: true, + }, + "region": { + Type: schema.TypeString, + Computed: true, + }, + "region_ename": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func dataSourceAlicloudCdnIpInfoRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeIpInfo" + request := make(map[string]interface{}) + + id := "" + if v, ok := d.GetOk("ip"); ok { + request["IP"] = v.(string) + id = v.(string) + } + var response map[string]interface{} + conn, err := client.NewCdnClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("GET"), StringPointer("2018-05-10"), StringPointer("AK"), request, nil, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_cdn_ip_info", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "", response) + } + object := resp.(map[string]interface{}) + d.SetId(id) + d.Set("cdn_ip", object["CdnIp"]) + d.Set("isp", object["ISP"]) + d.Set("isp_ename", object["IspEname"]) + d.Set("region", object["Region"]) + d.Set("region_ename", object["RegionEname"]) + d.Set("ip", id) + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cdn_real_time_log_deliveries.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cdn_real_time_log_deliveries.go new file mode 100644 index 00000000000..0c4bee1fce7 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cdn_real_time_log_deliveries.go @@ -0,0 +1,132 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudCdnRealTimeLogDeliveries() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudCdnRealTimeLogDeliveriesRead, + Schema: map[string]*schema.Schema{ + "domain": { + Type: schema.TypeString, + Required: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"offline", "online"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "deliveries": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, + "domain": { + Type: schema.TypeString, + Computed: true, + }, + "logstore": { + Type: schema.TypeString, + Computed: true, + }, + "project": { + Type: schema.TypeString, + Computed: true, + }, + "sls_region": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudCdnRealTimeLogDeliveriesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeDomainRealtimeLogDelivery" + request := map[string]interface{}{} + if v, ok := d.GetOk("domain"); ok { + request["Domain"] = v + } + + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewCdnClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("GET"), StringPointer("2018-05-10"), StringPointer("AK"), request, nil, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_cdn_real_time_log_deliveries", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$", response) + } + + s := make([]map[string]interface{}, 0) + if object, ok := resp.(map[string]interface{}); ok { + if statusOk && status.(string) != "" && status.(string) == object["Status"].(string) { + mapping := map[string]interface{}{ + "id": fmt.Sprint(request["Domain"]), + "domain": fmt.Sprint(request["Domain"]), + "logstore": object["Logstore"], + "project": object["Project"], + "sls_region": object["Region"], + "status": object["Status"], + } + s = append(s, mapping) + } + } + + d.SetId(fmt.Sprint(request["Domain"])) + + if err := d.Set("deliveries", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cen_instances.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cen_instances.go index 1bfe0dee90b..5261c376f8d 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cen_instances.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cen_instances.go @@ -85,6 +85,10 @@ func dataSourceAlicloudCenInstances() *schema.Resource { Type: schema.TypeMap, Computed: true, }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, }, }, }, @@ -179,6 +183,7 @@ func dataSourceAlicloudCenInstancesRead(d *schema.ResourceData, meta interface{} "description": object.Description, "protection_level": object.ProtectionLevel, "status": object.Status, + "create_time": object.CreationTime, } ids = append(ids, object.CenId) tags := make(map[string]string) diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cen_transit_router_service.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cen_transit_router_service.go new file mode 100644 index 00000000000..59e3a0ba5d4 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cen_transit_router_service.go @@ -0,0 +1,102 @@ +package alicloud + +import ( + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudCenTransitRouterService() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudCenTransitRouterServiceRead, + Schema: map[string]*schema.Schema{ + "enable": { + Type: schema.TypeString, + ValidateFunc: validation.StringInSlice([]string{"On", "Off"}, false), + Optional: true, + Default: "Off", + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} +func dataSourceAlicloudCenTransitRouterServiceRead(d *schema.ResourceData, meta interface{}) error { + if v, ok := d.GetOk("enable"); !ok || v.(string) != "On" { + d.SetId("CenTransitRouterServiceHasNotBeenOpened") + d.Set("status", "") + return nil + } + + client := meta.(*connectivity.AliyunClient) + conn, err := client.NewCbnClient() + if err != nil { + return WrapError(err) + } + + var response map[string]interface{} + request := map[string]interface{}{} + action := "CheckTransitRouterService" + request["ClientToken"] = buildClientToken(action) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(3*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-09-12"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"USER_NOT_OPEN_TR_SERVICE"}) { + action = "OpenTransitRouterService" + request["ClientToken"] = buildClientToken(action) + err = resource.Retry(3*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-09-12"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"ORDER.OPEND"}) { + d.SetId("CenTransitRouterServiceHasBeenOpened") + d.Set("status", "Opened") + return nil + } + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_cen_transit_router_service", action, AlibabaCloudSdkGoERROR) + } + + d.SetId("CenTransitRouterServiceHasBeenOpened") + d.Set("status", "Opened") + return nil + } + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_cen_transit_router_service", action, AlibabaCloudSdkGoERROR) + } + + if v, ok := response["Enabled"]; ok && v.(bool) { + d.SetId("CenTransitRouterServiceHasBeenOpened") + d.Set("status", "Opened") + return nil + } + + d.SetId("CenTransitRouterServiceHasNotBeenOpened") + d.Set("status", "") + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cen_transit_routers.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cen_transit_routers.go index db5fbd85522..7263f1e8981 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cen_transit_routers.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cen_transit_routers.go @@ -30,7 +30,8 @@ func dataSourceAlicloudCenTransitRouters() *schema.Resource { }, "transit_router_id": { Type: schema.TypeString, - Required: true, + Optional: true, + ForceNew: true, }, "transit_router_ids": { Type: schema.TypeList, @@ -52,7 +53,8 @@ func dataSourceAlicloudCenTransitRouters() *schema.Resource { "ids": { Type: schema.TypeList, Elem: &schema.Schema{Type: schema.TypeString}, - Computed: true, + Optional: true, + ForceNew: true, }, "output_file": { Type: schema.TypeString, @@ -115,7 +117,9 @@ func dataSourceAlicloudCenTransitRoutersRead(d *schema.ResourceData, meta interf request["RegionId"] = client.RegionId request["PageSize"] = PageSizeLarge request["PageNumber"] = 1 - request["TransitRouterId"] = d.Get("transit_router_id") + if v, ok := d.GetOk("transit_router_id"); ok { + request["TransitRouterId"] = v + } var objects []map[string]interface{} var transitRouterNameRegex *regexp.Regexp if v, ok := d.GetOk("name_regex"); ok { @@ -127,7 +131,7 @@ func dataSourceAlicloudCenTransitRoutersRead(d *schema.ResourceData, meta interf } idsMap := make(map[string]string) - if v, ok := d.GetOk("transit_router_ids"); ok { + if v, ok := d.GetOk("ids"); ok { for _, vv := range v.([]interface{}) { if vv == nil { continue @@ -135,7 +139,17 @@ func dataSourceAlicloudCenTransitRoutersRead(d *schema.ResourceData, meta interf idsMap[vv.(string)] = vv.(string) } } - request["TransitRouterIds"] = idsMap + + transitRouterIdsMap := make(map[string]string) + if v, ok := d.GetOk("transit_router_ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + transitRouterIdsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") var response map[string]interface{} conn, err := client.NewCbnClient() @@ -174,7 +188,12 @@ func dataSourceAlicloudCenTransitRoutersRead(d *schema.ResourceData, meta interf } } if len(idsMap) > 0 { - if _, ok := idsMap[fmt.Sprint(item["TransitRouterId"])]; !ok { + if _, ok := idsMap[fmt.Sprint(item["CenId"], ":", item["TransitRouterId"])]; !ok { + continue + } + } + if len(transitRouterIdsMap) > 0 { + if _, ok := transitRouterIdsMap[fmt.Sprint(item["TransitRouterId"])]; !ok { continue } } @@ -197,7 +216,7 @@ func dataSourceAlicloudCenTransitRoutersRead(d *schema.ResourceData, meta interf "cen_id": object["CenId"], "status": object["Status"], "transit_router_description": object["TransitRouterDescription"], - "id": fmt.Sprint(object["TransitRouterId"]), + "id": fmt.Sprint(object["CenId"], ":", object["TransitRouterId"]), "transit_router_id": fmt.Sprint(object["TransitRouterId"]), "transit_router_name": object["TransitRouterName"], "type": object["Type"], diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_click_house_accounts.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_click_house_accounts.go new file mode 100644 index 00000000000..6b72abf170f --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_click_house_accounts.go @@ -0,0 +1,201 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudClickHouseAccounts() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudClickHouseAccountsRead, + Schema: map[string]*schema.Schema{ + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "db_cluster_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Creating", "Available", "Deleting"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "accounts": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "account_description": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "account_name": { + Type: schema.TypeString, + Computed: true, + }, + "account_type": { + Type: schema.TypeString, + Computed: true, + }, + "db_cluster_id": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudClickHouseAccountsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeAccounts" + request := make(map[string]interface{}) + request["DBClusterId"] = d.Get("db_cluster_id") + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + var accountNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + accountNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewClickhouseClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-11"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_click_house_accounts", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Accounts.Account", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Accounts.Account", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if accountNameRegex != nil && !accountNameRegex.MatchString(fmt.Sprint(item["AccountName"])) { + continue + } + + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprintf("%s:%s", request["DBClusterId"].(string), item["AccountName"].(string))]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["AccountStatus"].(string) { + continue + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "account_description": object["AccountDescription"], + "id": fmt.Sprint(object["AccountName"]), + "account_name": fmt.Sprint(object["AccountName"]), + "account_type": object["AccountType"], + "db_cluster_id": request["DBClusterId"], + "status": object["AccountStatus"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["AccountName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("accounts", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_click_house_backup_policies.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_click_house_backup_policies.go new file mode 100644 index 00000000000..a95b51a52bd --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_click_house_backup_policies.go @@ -0,0 +1,95 @@ +package alicloud + +import ( + "fmt" + "strconv" + "strings" + "time" + + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudClickHouseBackupPolicies() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudClickHouseBackupPoliciesRead, + Schema: map[string]*schema.Schema{ + "db_cluster_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "policies": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "backup_retention_period": { + Type: schema.TypeInt, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "db_cluster_id": { + Type: schema.TypeString, + Computed: true, + }, + "preferred_backup_period": { + Type: schema.TypeSet, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "preferred_backup_time": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudClickHouseBackupPoliciesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + dbClusterId := d.Get("db_cluster_id") + clickhouseService := ClickhouseService{client} + object, err := clickhouseService.DescribeClickHouseBackupPolicy(dbClusterId.(string)) + if err != nil { + if NotFoundError(err) { + d.SetId("ClickHouseBackupPolicy") + return nil + } + return WrapError(err) + } + s := make([]map[string]interface{}, 0) + mapping := map[string]interface{}{ + "backup_retention_period": formatInt(object["BackupRetentionPeriod"]), + "id": fmt.Sprint(dbClusterId), + "db_cluster_id": fmt.Sprint(dbClusterId), + "preferred_backup_period": strings.Split(object["PreferredBackupPeriod"].(string), ","), + "preferred_backup_time": object["PreferredBackupTime"], + "status": fmt.Sprint(object["Switch"]), + } + s = append(s, mapping) + + d.SetId(strconv.FormatInt(time.Now().Unix(), 16)) + if err := d.Set("policies", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_click_house_db_clusters.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_click_house_db_clusters.go new file mode 100644 index 00000000000..089a076bca3 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_click_house_db_clusters.go @@ -0,0 +1,406 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudClickHouseDbClusters() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudClickHouseDbClustersRead, + Schema: map[string]*schema.Schema{ + "db_cluster_description": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Creating", "Deleting", "Restarting", "Preparing", "Running"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "clusters": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "ali_uid": { + Type: schema.TypeString, + Computed: true, + }, + "bid": { + Type: schema.TypeString, + Computed: true, + }, + "category": { + Type: schema.TypeString, + Computed: true, + }, + "commodity_code": { + Type: schema.TypeString, + Computed: true, + }, + "connection_string": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "db_cluster_access_white_list": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "db_cluster_ip_array_attribute": { + Type: schema.TypeString, + Computed: true, + }, + "db_cluster_ip_array_name": { + Type: schema.TypeString, + Computed: true, + }, + "security_ip_list": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "db_cluster_description": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "db_cluster_id": { + Type: schema.TypeString, + Computed: true, + }, + "db_cluster_network_type": { + Type: schema.TypeString, + Computed: true, + }, + "db_cluster_type": { + Type: schema.TypeString, + Computed: true, + }, + "db_node_class": { + Type: schema.TypeString, + Computed: true, + }, + "db_node_count": { + Type: schema.TypeString, + Computed: true, + }, + "db_node_storage": { + Type: schema.TypeString, + Computed: true, + }, + "encryption_key": { + Type: schema.TypeString, + Computed: true, + }, + "encryption_type": { + Type: schema.TypeString, + Computed: true, + }, + "engine": { + Type: schema.TypeString, + Computed: true, + }, + "engine_version": { + Type: schema.TypeString, + Computed: true, + }, + "expire_time": { + Type: schema.TypeString, + Computed: true, + }, + "is_expired": { + Type: schema.TypeString, + Computed: true, + }, + "lock_mode": { + Type: schema.TypeString, + Computed: true, + }, + "lock_reason": { + Type: schema.TypeString, + Computed: true, + }, + "maintain_time": { + Type: schema.TypeString, + Computed: true, + }, + "payment_type": { + Type: schema.TypeString, + Computed: true, + }, + "port": { + Type: schema.TypeInt, + Computed: true, + }, + "public_connection_string": { + Type: schema.TypeString, + Computed: true, + }, + "public_port": { + Type: schema.TypeString, + Computed: true, + }, + "scale_out_status": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "progress": { + Type: schema.TypeString, + Computed: true, + }, + "ratio": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "storage_type": { + Type: schema.TypeString, + Computed: true, + }, + "support_backup": { + Type: schema.TypeInt, + Computed: true, + }, + "support_https_port": { + Type: schema.TypeBool, + Computed: true, + }, + "support_mysql_port": { + Type: schema.TypeBool, + Computed: true, + }, + "vswitch_id": { + Type: schema.TypeString, + Computed: true, + }, + "vpc_cloud_instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "vpc_id": { + Type: schema.TypeString, + Computed: true, + }, + "zone_id": { + Type: schema.TypeString, + Computed: true, + }, + "control_version": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudClickHouseDbClustersRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeDBClusters" + request := make(map[string]interface{}) + if v, ok := d.GetOk("db_cluster_description"); ok { + request["DBClusterDescription"] = v + } + if v, ok := d.GetOk("status"); ok { + request["DBClusterStatus"] = v + } + request["RegionId"] = client.RegionId + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewClickhouseClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-11"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_click_house_db_clusters", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.DBClusters.DBCluster", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.DBClusters.DBCluster", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["DBClusterId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + + mapping := map[string]interface{}{ + "ali_uid": object["AliUid"], + "bid": object["Bid"], + "category": object["Category"], + "commodity_code": object["CommodityCode"], + "connection_string": object["ConnectionString"], + "create_time": object["CreateTime"], + "db_cluster_description": object["DBClusterDescription"], + "id": fmt.Sprint(object["DBClusterId"]), + "db_cluster_id": fmt.Sprint(object["DBClusterId"]), + "db_cluster_network_type": object["DBClusterNetworkType"], + "db_node_class": object["DBNodeClass"], + "db_node_count": fmt.Sprint(object["DBNodeCount"]), + "db_node_storage": fmt.Sprint(object["DBNodeStorage"]), + "expire_time": object["ExpireTime"], + "lock_mode": object["LockMode"], + "lock_reason": object["LockReason"], + "payment_type": convertClickHouseDbClusterPaymentTypeResponse(object["PayType"].(string)), + "port": formatInt(object["Port"]), + "storage_type": object["StorageType"], + "vswitch_id": object["VSwitchId"], + "vpc_cloud_instance_id": object["VpcCloudInstanceId"], + "vpc_id": object["VpcId"], + "zone_id": object["ZoneId"], + "control_version": object["ControlVersion"], + "status": object["DBClusterStatus"], + } + if val, exist := object["IsExpired"]; exist { + object["is_expired"] = val.(bool) + } + ids = append(ids, fmt.Sprint(mapping["id"])) + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + s = append(s, mapping) + continue + } + id := fmt.Sprint(object["DBClusterId"]) + clickhouseService := ClickhouseService{client} + getResp1, err := clickhouseService.DescribeDBClusterAccessWhiteList(id) + if err != nil { + return WrapError(err) + } + + iPArray := make([]map[string]interface{}, 0) + if iPArrayList, ok := getResp1["DBClusterAccessWhiteList"].(map[string]interface{})["IPArray"].([]interface{}); ok { + for _, v := range iPArrayList { + if m1, ok := v.(map[string]interface{}); ok { + if m1["DBClusterIPArrayName"].(string) == "default" { + continue + } + temp1 := map[string]interface{}{ + "db_cluster_ip_array_attribute": m1["DBClusterIPArrayAttribute"], + "db_cluster_ip_array_name": m1["DBClusterIPArrayName"], + "security_ip_list": m1["SecurityIPList"], + } + iPArray = append(iPArray, temp1) + } + } + } + mapping["db_cluster_access_white_list"] = iPArray + getResp, err := clickhouseService.DescribeClickHouseDbCluster(id) + if err != nil { + return WrapError(err) + } + mapping["db_cluster_type"] = getResp["DBClusterType"] + mapping["encryption_key"] = getResp["EncryptionKey"] + mapping["encryption_type"] = getResp["EncryptionType"] + mapping["engine"] = getResp["Engine"] + mapping["engine_version"] = getResp["EngineVersion"] + mapping["maintain_time"] = getResp["MaintainTime"] + mapping["public_connection_string"] = getResp["PublicConnectionString"] + mapping["public_port"] = getResp["PublicPort"] + if v, ok := getResp["SupportBackup"]; ok && fmt.Sprint(v) != "0" { + mapping["support_backup"] = formatInt(v) + } + mapping["support_https_port"] = getResp["SupportHttpsPort"] + mapping["support_mysql_port"] = getResp["SupportMysqlPort"] + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("clusters", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_click_house_regions.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_click_house_regions.go new file mode 100644 index 00000000000..8e77bf7ee17 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_click_house_regions.go @@ -0,0 +1,150 @@ +package alicloud + +import ( + "fmt" + "strconv" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudClickHouseRegions() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudClickHouseRegionsRead, + Schema: map[string]*schema.Schema{ + "region_id": { + Type: schema.TypeString, + Optional: true, + ConflictsWith: []string{"current"}, + }, + "current": { + Type: schema.TypeBool, + Optional: true, + ConflictsWith: []string{"region_id"}, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "regions": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "region_id": { + Type: schema.TypeString, + Computed: true, + }, + "zone_ids": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "vpc_enabled": { + Type: schema.TypeBool, + Computed: true, + }, + "zone_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudClickHouseRegionsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DescribeRegions" + request := make(map[string]interface{}) + var objects []map[string]interface{} + var response map[string]interface{} + update := false + conn, err := client.NewClickhouseClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-11"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_click_house_regions", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Regions.Region", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Accounts.Account", response) + } + result, _ := resp.([]interface{}) + if v, exist := d.GetOk("current"); exist { + update = v.(bool) + } + for _, v := range result { + obj := v.(map[string]interface{}) + if update { + if client.RegionId != obj["RegionId"].(string) { + continue + } + } + if v, exist := d.GetOk("region_id"); exist { + if v.(string) != obj["RegionId"].(string) { + continue + } + } + objects = append(objects, obj) + } + + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "region_id": fmt.Sprint(object["RegionId"]), + } + + zoneRes := make([]interface{}, 0) + + if _, exist := object["Zones"]; exist { + for _, zonesmapslicSli := range object["Zones"].(map[string]interface{}) { + for _, obj := range zonesmapslicSli.([]interface{}) { + objMap := obj.(map[string]interface{}) + singleObj := make(map[string]interface{}, 0) + singleObj["vpc_enabled"] = objMap["VpcEnabled"].(bool) + singleObj["zone_id"] = fmt.Sprint(objMap["ZoneId"]) + zoneRes = append(zoneRes, singleObj) + } + } + } + + mapping["zone_ids"] = zoneRes + s = append(s, mapping) + } + + d.SetId(strconv.FormatInt(time.Now().Unix(), 16)) + if err := d.Set("regions", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_firewall_instances.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_firewall_instances.go new file mode 100644 index 00000000000..39819ed8cdc --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_firewall_instances.go @@ -0,0 +1,148 @@ +package alicloud + +import ( + "fmt" + "strconv" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudCloudFirewallInstances() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudCloudFirewallInstancesRead, + Schema: map[string]*schema.Schema{ + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "instances": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "status": { + Type: schema.TypeString, + Computed: true, + }, + "renewal_status": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "end_time": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "renewal_duration_unit": { + Type: schema.TypeString, + Computed: true, + }, + "payment_type": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudCloudFirewallInstancesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "QueryAvailableInstances" + request := make(map[string]interface{}) + request["ProductCode"] = "vipcloudfw" + request["ProductType"] = "vipcloudfw" + request["PageSize"] = PageSizeLarge + request["PageNum"] = 1 + var objects []map[string]interface{} + + var response map[string]interface{} + conn, err := client.NewBssopenapiClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-12-14"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + if IsExpectedErrors(err, []string{"NotApplicable"}) { + conn.Endpoint = String(connectivity.BssOpenAPIEndpointInternational) + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_cloud_firewall_instances", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Code"]) != "Success" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + resp, err := jsonpath.Get("$.Data.InstanceList", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Data.InstanceList", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNum"] = request["PageNum"].(int) + 1 + } + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "status": object["Status"], + "end_time": object["EndTime"], + "create_time": object["CreateTime"], + "payment_type": object["SubscriptionType"], + "renewal_duration_unit": convertCloudFirewallInstanceRenewalDurationUnitResponse(object["RenewalDurationUnit"]), + "id": object["InstanceID"], + "renewal_status": object["RenewStatus"], + "instance_id": object["InstanceID"], + } + s = append(s, mapping) + } + + d.SetId(strconv.FormatInt(time.Now().Unix(), 16)) + + if err := d.Set("instances", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_sso_access_configurations.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_sso_access_configurations.go new file mode 100644 index 00000000000..dd7491cf79b --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_sso_access_configurations.go @@ -0,0 +1,262 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudCloudSsoAccessConfigurations() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudCloudSsoAccessConfigurationsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "directory_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "configurations": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, + "access_configuration_id": { + Type: schema.TypeString, + Computed: true, + }, + "access_configuration_name": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "directory_id": { + Type: schema.TypeString, + Computed: true, + }, + "permission_policies": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "add_time": { + Type: schema.TypeString, + Computed: true, + }, + "permission_policy_document": { + Type: schema.TypeString, + Computed: true, + }, + "permission_policy_name": { + Type: schema.TypeString, + Computed: true, + }, + "permission_policy_type": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "relay_state": { + Type: schema.TypeString, + Computed: true, + }, + "session_duration": { + Type: schema.TypeInt, + Computed: true, + }, + "status_notifications": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudCloudSsoAccessConfigurationsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListAccessConfigurations" + request := make(map[string]interface{}) + request["DirectoryId"] = d.Get("directory_id") + request["MaxResults"] = PageSizeLarge + var objects []map[string]interface{} + var accessConfigurationNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + accessConfigurationNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewCloudssoClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_cloud_sso_access_configurations", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.AccessConfigurations", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.AccessConfigurations", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if accessConfigurationNameRegex != nil && !accessConfigurationNameRegex.MatchString(fmt.Sprint(item["AccessConfigurationName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(request["DirectoryId"], ":", item["AccessConfigurationId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "id": fmt.Sprint(request["DirectoryId"], ":", object["AccessConfigurationId"]), + "access_configuration_id": fmt.Sprint(object["AccessConfigurationId"]), + "access_configuration_name": object["AccessConfigurationName"], + "create_time": object["CreateTime"], + "description": object["Description"], + "directory_id": request["DirectoryId"], + "relay_state": object["RelayState"], + "session_duration": formatInt(object["SessionDuration"]), + "status_notifications": object["StatusNotifications"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["AccessConfigurationName"]) + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + s = append(s, mapping) + continue + } + id := fmt.Sprint(request["DirectoryId"], ":", object["AccessConfigurationId"]) + cloudssoService := CloudssoService{client} + getResp, err := cloudssoService.ListPermissionPoliciesInAccessConfiguration(id) + if err != nil { + return WrapError(err) + } + + permissionPolicies := make([]map[string]interface{}, 0) + if permissionPoliciesList, ok := getResp["PermissionPolicies"]; ok && permissionPoliciesList != nil { + for _, v := range permissionPoliciesList.([]interface{}) { + if m1, ok := v.(map[string]interface{}); ok { + temp1 := map[string]interface{}{ + "add_time": m1["AddTime"], + "permission_policy_document": m1["PermissionPolicyDocument"], + "permission_policy_name": m1["PermissionPolicyName"], + "permission_policy_type": m1["PermissionPolicyType"], + } + permissionPolicies = append(permissionPolicies, temp1) + } + } + } + + mapping["permission_policies"] = permissionPolicies + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("configurations", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_sso_directories.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_sso_directories.go new file mode 100644 index 00000000000..fac1c9897a2 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_sso_directories.go @@ -0,0 +1,340 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudCloudSsoDirectories() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudCloudSsoDirectoriesRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "directories": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "directory_id": { + Type: schema.TypeString, + Computed: true, + }, + "directory_name": { + Type: schema.TypeString, + Computed: true, + }, + "mfa_authentication_status": { + Type: schema.TypeString, + Computed: true, + }, + "region": { + Type: schema.TypeString, + Computed: true, + }, + "saml_identity_provider_configuration": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "encoded_metadata_document": { + Type: schema.TypeString, + Computed: true, + }, + "entity_id": { + Type: schema.TypeString, + Computed: true, + }, + "login_url": { + Type: schema.TypeString, + Computed: true, + }, + "sso_status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "scim_synchronization_status": { + Type: schema.TypeString, + Computed: true, + }, + "tasks": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "access_configuration_id": { + Type: schema.TypeString, + Computed: true, + }, + "access_configuration_name": { + Type: schema.TypeString, + Computed: true, + }, + "end_time": { + Type: schema.TypeString, + Computed: true, + }, + "failure_reason": { + Type: schema.TypeString, + Computed: true, + }, + "principal_id": { + Type: schema.TypeString, + Computed: true, + }, + "principal_name": { + Type: schema.TypeString, + Computed: true, + }, + "principal_type": { + Type: schema.TypeString, + Computed: true, + }, + "start_time": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "target_id": { + Type: schema.TypeString, + Computed: true, + }, + "target_name": { + Type: schema.TypeString, + Computed: true, + }, + "target_path": { + Type: schema.TypeString, + Computed: true, + }, + "target_type": { + Type: schema.TypeString, + Computed: true, + }, + "task_id": { + Type: schema.TypeString, + Computed: true, + }, + "task_type": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudCloudSsoDirectoriesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListDirectories" + request := make(map[string]interface{}) + var objects []map[string]interface{} + var directoryNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + directoryNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewCloudssoClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_cloud_sso_directories", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Directories", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Directories", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if directoryNameRegex != nil && !directoryNameRegex.MatchString(fmt.Sprint(item["DirectoryName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["DirectoryId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "create_time": object["CreateTime"], + "id": fmt.Sprint(object["DirectoryId"]), + "directory_id": fmt.Sprint(object["DirectoryId"]), + "directory_name": object["DirectoryName"], + "region": object["Region"], + } + + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["DirectoryName"]) + + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + s = append(s, mapping) + continue + } + + cloudssoService := CloudssoService{client} + getDirectoryObject, err := cloudssoService.DescribeCloudSsoDirectory(fmt.Sprint(object["DirectoryId"])) + if err != nil { + return WrapError(err) + } + mapping["mfa_authentication_status"] = getDirectoryObject["MFAAuthenticationStatus"] + mapping["scim_synchronization_status"] = getDirectoryObject["SCIMSynchronizationStatus"] + if SAMLIdentityProviderConfiguration, ok := getDirectoryObject["SAMLIdentityProviderConfiguration"]; ok && len(SAMLIdentityProviderConfiguration.(map[string]interface{})) > 0 { + SAMLIdentityProviderConfigurationSli := make([]map[string]interface{}, 0) + SAMLIdentityProviderConfigurationMap := make(map[string]interface{}) + SAMLIdentityProviderConfigurationMap["sso_status"] = SAMLIdentityProviderConfiguration.(map[string]interface{})["SSOStatus"] + SAMLIdentityProviderConfigurationMap["entity_id"] = SAMLIdentityProviderConfiguration.(map[string]interface{})["EntityId"] + SAMLIdentityProviderConfigurationMap["create_time"] = SAMLIdentityProviderConfiguration.(map[string]interface{})["CreateTime"] + SAMLIdentityProviderConfigurationMap["login_url"] = SAMLIdentityProviderConfiguration.(map[string]interface{})["LoginUrl"] + if v, ok := SAMLIdentityProviderConfiguration.(map[string]interface{})["EncodedMetadataDocument"]; ok { + SAMLIdentityProviderConfigurationMap["encoded_metadata_document"] = v + } + SAMLIdentityProviderConfigurationSli = append(SAMLIdentityProviderConfigurationSli, SAMLIdentityProviderConfigurationMap) + mapping["saml_identity_provider_configuration"] = SAMLIdentityProviderConfigurationSli + } + + getResp, err := cloudssoService.GetDirectoryTasks(fmt.Sprint(object["DirectoryId"])) + if err != nil { + return WrapError(err) + } + + if getDirectoryTasks, ok := getResp["Tasks"]; ok { + tasks := make([]map[string]interface{}, 0) + for _, v := range getDirectoryTasks.([]interface{}) { + if t, ok := v.(map[string]interface{}); ok { + temp := map[string]interface{}{ + "access_configuration_id": t["AccessConfigurationId"], + "access_configuration_name": t["AccessConfigurationName"], + "end_time": t["EndTime"], + "failure_reason": t["FailureReason"], + "principal_id": t["PrincipalId"], + "principal_name": t["PrincipalName"], + "principal_type": t["PrincipalType"], + "start_time": t["StartTime"], + "status": t["Status"], + "target_id": t["TargetId"], + "target_name": t["TargetName"], + "target_path": t["TargetPath"], + "target_type": t["TargetType"], + "task_id": t["TaskId"], + "task_type": t["TaskType"], + } + tasks = append(tasks, temp) + } + } + mapping["tasks"] = tasks + } + + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("directories", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_sso_groups.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_sso_groups.go new file mode 100644 index 00000000000..a9922b4752e --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_sso_groups.go @@ -0,0 +1,205 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudCloudSsoGroups() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudCloudSsoGroupsRead, + Schema: map[string]*schema.Schema{ + "directory_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "provision_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Manual", "Synchronized"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "groups": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "directory_id": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "group_id": { + Type: schema.TypeString, + Computed: true, + }, + "group_name": { + Type: schema.TypeString, + Computed: true, + }, + "provision_type": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudCloudSsoGroupsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListGroups" + request := make(map[string]interface{}) + request["DirectoryId"] = d.Get("directory_id") + + if v, ok := d.GetOk("provision_type"); ok { + request["ProvisionType"] = v + } + request["MaxResults"] = PageSizeLarge + var objects []map[string]interface{} + var groupNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + groupNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewCloudssoClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_cloud_sso_groups", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Groups", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Groups", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if groupNameRegex != nil && !groupNameRegex.MatchString(fmt.Sprint(item["GroupName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(request["DirectoryId"], ":", item["GroupId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "create_time": object["CreateTime"], + "description": object["Description"], + "directory_id": request["DirectoryId"], + "id": fmt.Sprint(request["DirectoryId"], ":", object["GroupId"]), + "group_id": fmt.Sprint(object["GroupId"]), + "group_name": object["GroupName"], + "provision_type": object["ProvisionType"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["GroupName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("groups", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_sso_scim_server_credentials.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_sso_scim_server_credentials.go new file mode 100644 index 00000000000..937e9c77b19 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_sso_scim_server_credentials.go @@ -0,0 +1,173 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudCloudSsoScimServerCredentials() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudCloudSsoScimServerCredentialsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "directory_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Disabled", "Enabled"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "credentials": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "credential_id": { + Type: schema.TypeString, + Computed: true, + }, + "credential_secret": { + Type: schema.TypeString, + Computed: true, + }, + "credential_type": { + Type: schema.TypeString, + Computed: true, + }, + "directory_id": { + Type: schema.TypeString, + Computed: true, + }, + "expire_time": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudCloudSsoScimServerCredentialsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListSCIMServerCredentials" + request := make(map[string]interface{}) + request["DirectoryId"] = d.Get("directory_id") + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewCloudssoClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_cloud_sso_scim_server_credentials", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.SCIMServerCredentials", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.SCIMServerCredentials", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["DirectoryId"], ":", item["CredentialId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["Status"].(string) { + continue + } + objects = append(objects, item) + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "create_time": object["CreateTime"], + "id": fmt.Sprint(object["DirectoryId"], ":", object["CredentialId"]), + "credential_id": fmt.Sprint(object["CredentialId"]), + "credential_secret": object["CredentialSecret"], + "credential_type": object["CredentialType"], + "directory_id": object["DirectoryId"], + "expire_time": object["ExpireTime"], + "status": object["Status"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("credentials", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_sso_service.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_sso_service.go new file mode 100644 index 00000000000..fc7f4a9e32d --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_sso_service.go @@ -0,0 +1,92 @@ +package alicloud + +import ( + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudCloudSsoService() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudCloudSsoServiceRead, + Schema: map[string]*schema.Schema{ + "enable": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"On", "Off"}, false), + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} +func dataSourceAlicloudCloudSsoServiceRead(d *schema.ResourceData, meta interface{}) error { + var response map[string]interface{} + request := map[string]interface{}{} + conn, err := meta.(*connectivity.AliyunClient).NewCloudssoClient() + if err != nil { + return WrapError(err) + } + + enable := d.Get("enable").(string) + if enable == "On" { + action := "EnableService" + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(3*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_cloud_sso_service", action, AlibabaCloudSdkGoERROR) + } + + d.SetId("CloudSsoServiceHasBeenOpened") + d.Set("status", "Opened") + return nil + } + + if enable == "Off" { + action := "DisableService" + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(3*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_cloud_sso_service", action, AlibabaCloudSdkGoERROR) + } + + d.SetId("CloudSsoServiceHasNotBeenOpened") + d.Set("status", "") + return nil + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_sso_users.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_sso_users.go new file mode 100644 index 00000000000..b87213036b0 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_sso_users.go @@ -0,0 +1,293 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudCloudSsoUsers() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudCloudSsoUsersRead, + Schema: map[string]*schema.Schema{ + "directory_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "provision_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Manual", "Synchronized"}, false), + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Disabled", "Enabled"}, false), + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "users": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "directory_id": { + Type: schema.TypeString, + Computed: true, + }, + "display_name": { + Type: schema.TypeString, + Computed: true, + }, + "email": { + Type: schema.TypeString, + Computed: true, + }, + "first_name": { + Type: schema.TypeString, + Computed: true, + }, + "last_name": { + Type: schema.TypeString, + Computed: true, + }, + "mfa_devices": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "device_id": { + Type: schema.TypeString, + Computed: true, + }, + "device_name": { + Type: schema.TypeString, + Computed: true, + }, + "device_type": { + Type: schema.TypeString, + Computed: true, + }, + "effective_time": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "provision_type": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "user_id": { + Type: schema.TypeString, + Computed: true, + }, + "user_name": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudCloudSsoUsersRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListUsers" + request := make(map[string]interface{}) + request["DirectoryId"] = d.Get("directory_id") + if v, ok := d.GetOk("provision_type"); ok { + request["ProvisionType"] = v + } + if v, ok := d.GetOk("status"); ok { + request["Status"] = v + } + request["MaxResults"] = PageSizeLarge + var objects []map[string]interface{} + var userNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + userNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewCloudssoClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_cloud_sso_users", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Users", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Users", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if userNameRegex != nil && !userNameRegex.MatchString(fmt.Sprint(item["UserName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprintf("%s:%s", request["DirectoryId"], item["UserId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "create_time": object["CreateTime"], + "description": object["Description"], + "directory_id": request["DirectoryId"], + "display_name": object["DisplayName"], + "email": object["Email"], + "first_name": object["FirstName"], + "last_name": object["LastName"], + "provision_type": object["ProvisionType"], + "status": object["Status"], + "id": fmt.Sprint(request["DirectoryId"], ":", object["UserId"]), + "user_id": fmt.Sprint(object["UserId"]), + "user_name": object["UserName"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["UserName"]) + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + s = append(s, mapping) + continue + } + id := fmt.Sprint(request["DirectoryId"], ":", object["UserId"]) + cloudssoService := CloudssoService{client} + getResp, err := cloudssoService.ListMFADevicesForUser(id) + if err != nil { + return WrapError(err) + } + + mFADevices := make([]map[string]interface{}, 0) + if mFADevicesList, ok := getResp["MFADevices"]; ok { + for _, v := range mFADevicesList.([]interface{}) { + if m1, ok := v.(map[string]interface{}); ok { + temp1 := map[string]interface{}{ + "device_id": m1["DeviceId"], + "device_name": m1["DeviceName"], + "device_type": m1["DeviceType"], + "effective_time": m1["EffectiveTime"], + } + mFADevices = append(mFADevices, temp1) + } + } + } + mapping["mfa_devices"] = mFADevices + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("users", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_storage_gateway_express_syncs.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_storage_gateway_express_syncs.go new file mode 100644 index 00000000000..1f0eacc96e0 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_storage_gateway_express_syncs.go @@ -0,0 +1,189 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudCloudStorageGatewayExpressSyncs() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudCloudStorageGatewayExpressSyncsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "syncs": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "bucket_name": { + Type: schema.TypeString, + Computed: true, + }, + "bucket_prefix": { + Type: schema.TypeString, + Computed: true, + }, + "bucket_region": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "express_sync_id": { + Type: schema.TypeString, + Computed: true, + }, + "express_sync_name": { + Type: schema.TypeString, + Computed: true, + }, + "mns_topic": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudCloudStorageGatewayExpressSyncsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeExpressSyncs" + request := make(map[string]interface{}) + var objects []map[string]interface{} + var expressSyncNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + expressSyncNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewHcsSgwClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-05-11"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_cloud_storage_gateway_express_syncs", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + resp, err := jsonpath.Get("$.ExpressSyncs.ExpressSync", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.ExpressSyncs.ExpressSync", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if expressSyncNameRegex != nil && !expressSyncNameRegex.MatchString(fmt.Sprint(item["Name"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["ExpressSyncId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "bucket_name": object["BucketName"], + "bucket_prefix": fmt.Sprint(object["BucketPrefix"]), + "bucket_region": object["BucketRegion"], + "description": object["Description"], + "id": fmt.Sprint(object["ExpressSyncId"]), + "express_sync_id": fmt.Sprint(object["ExpressSyncId"]), + "express_sync_name": object["Name"], + "mns_topic": object["MnsTopic"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["Name"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("syncs", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_storage_gateway_gateway_block_volumes.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_storage_gateway_gateway_block_volumes.go new file mode 100644 index 00000000000..045e55a2a81 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_storage_gateway_gateway_block_volumes.go @@ -0,0 +1,295 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudCloudStorageGatewayGatewayBlockVolumes() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudCloudStorageGatewayGatewayBlockVolumesRead, + Schema: map[string]*schema.Schema{ + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "gateway_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "status": { + Type: schema.TypeInt, + Optional: true, + ForceNew: true, + ValidateFunc: validation.IntBetween(0, 8), + }, + "volumes": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "address": { + Type: schema.TypeString, + Computed: true, + }, + "cache_mode": { + Type: schema.TypeString, + Computed: true, + }, + "chap_enabled": { + Type: schema.TypeBool, + Computed: true, + }, + "chap_in_user": { + Type: schema.TypeString, + Computed: true, + }, + "chunk_size": { + Type: schema.TypeInt, + Computed: true, + }, + "disk_id": { + Type: schema.TypeString, + Computed: true, + }, + "disk_type": { + Type: schema.TypeString, + Computed: true, + }, + "enabled": { + Type: schema.TypeBool, + Computed: true, + }, + "gateway_block_volume_name": { + Type: schema.TypeString, + Computed: true, + }, + "gateway_id": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "index_id": { + Type: schema.TypeString, + Computed: true, + }, + "local_path": { + Type: schema.TypeString, + Computed: true, + }, + "lun_id": { + Type: schema.TypeInt, + Computed: true, + }, + "oss_bucket_name": { + Type: schema.TypeString, + Computed: true, + }, + "oss_bucket_ssl": { + Type: schema.TypeBool, + Computed: true, + }, + "oss_endpoint": { + Type: schema.TypeString, + Computed: true, + }, + "port": { + Type: schema.TypeInt, + Computed: true, + }, + "protocol": { + Type: schema.TypeString, + Computed: true, + }, + "size": { + Type: schema.TypeInt, + Computed: true, + }, + "state": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeInt, + Computed: true, + }, + "target": { + Type: schema.TypeString, + Computed: true, + }, + "total_download": { + Type: schema.TypeInt, + Computed: true, + }, + "total_upload": { + Type: schema.TypeInt, + Computed: true, + }, + "volume_state": { + Type: schema.TypeInt, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudCloudStorageGatewayGatewayBlockVolumesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeGatewayBlockVolumes" + request := make(map[string]interface{}) + request["GatewayId"] = d.Get("gateway_id") + var objects []map[string]interface{} + var gatewayBlockVolumeNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + gatewayBlockVolumeNameRegex = r + } + + status, statusOk := d.GetOk("status") + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewHcsSgwClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-05-11"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_cloud_storage_gateway_gateway_block_volumes", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + resp, err := jsonpath.Get("$.BlockVolumes.BlockVolume", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.BlockVolumes.BlockVolume", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if gatewayBlockVolumeNameRegex != nil && !gatewayBlockVolumeNameRegex.MatchString(fmt.Sprint(item["Name"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(request["GatewayId"], ":", item["IndexId"])]; !ok { + continue + } + } + if statusOk && status.(int) != item["VolumeState"] { + continue + } + objects = append(objects, item) + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "address": object["Address"], + "cache_mode": object["CacheMode"], + "chap_enabled": object["ChapEnabled"], + "chap_in_user": fmt.Sprint(object["ChapInUser"]), + "chunk_size": formatInt(object["ChunkSize"]), + "disk_id": object["DiskId"], + "disk_type": object["DiskType"], + "enabled": object["Enabled"], + "gateway_block_volume_name": object["Name"], + "gateway_id": request["GatewayId"], + "id": fmt.Sprint(request["GatewayId"], ":", object["IndexId"]), + "index_id": fmt.Sprint(object["IndexId"]), + "local_path": object["LocalPath"], + "lun_id": formatInt(object["LunId"]), + "oss_bucket_name": object["OssBucketName"], + "oss_bucket_ssl": object["OssBucketSsl"], + "oss_endpoint": object["OssEndpoint"], + "port": formatInt(object["Port"]), + "protocol": object["Protocol"], + "size": formatInt(object["Size"]), + "state": object["State"], + "status": formatInt(object["Status"]), + "target": object["Target"], + "total_download": formatInt(object["TotalDownload"]), + "total_upload": formatInt(object["TotalUpload"]), + "volume_state": formatInt(object["VolumeState"]), + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["Name"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("volumes", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_storage_gateway_gateway_cache_disks.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_storage_gateway_gateway_cache_disks.go new file mode 100644 index 00000000000..373092ac9c8 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_storage_gateway_gateway_cache_disks.go @@ -0,0 +1,192 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudCloudStorageGatewayGatewayCacheDisks() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudCloudStorageGatewayGatewayCacheDisksRead, + Schema: map[string]*schema.Schema{ + "gateway_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "status": { + Type: schema.TypeInt, + Optional: true, + ForceNew: true, + ValidateFunc: validation.IntInSlice([]int{0, 1, 2}), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "disks": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "cache_disk_category": { + Type: schema.TypeString, + Computed: true, + }, + "cache_disk_size_in_gb": { + Type: schema.TypeInt, + Computed: true, + }, + "cache_id": { + Type: schema.TypeString, + Computed: true, + }, + "expired_time": { + Type: schema.TypeInt, + Computed: true, + }, + "gateway_id": { + Type: schema.TypeString, + Computed: true, + }, + "iops": { + Type: schema.TypeInt, + Computed: true, + }, + "is_used": { + Type: schema.TypeBool, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "local_file_path": { + Type: schema.TypeString, + Computed: true, + }, + "renew_url": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeInt, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudCloudStorageGatewayGatewayCacheDisksRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeGatewayCaches" + request := make(map[string]interface{}) + request["GatewayId"] = d.Get("gateway_id") + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewHcsSgwClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-05-11"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_cloud_storage_gateway_gateway_cache_disks", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + resp, err := jsonpath.Get("$.Caches.Cache", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Caches.Cache", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(request["GatewayId"], ":", item["CacheId"], ":", item["LocalFilePath"])]; !ok { + continue + } + } + if statusOk && fmt.Sprint(status) != fmt.Sprint(item["ExpireStatus"]) { + continue + } + objects = append(objects, item) + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "cache_disk_category": object["CacheType"], + "cache_disk_size_in_gb": formatInt(object["SizeInGB"]), + "cache_id": object["CacheId"], + "expired_time": formatInt(object["ExpiredTime"]), + "gateway_id": request["GatewayId"], + "iops": formatInt(object["Iops"]), + "is_used": object["IsUsed"], + "id": fmt.Sprint(request["GatewayId"], ":", object["CacheId"], ":", object["LocalFilePath"]), + "local_file_path": fmt.Sprint(object["LocalFilePath"]), + "renew_url": object["RenewURL"], + "status": formatInt(object["ExpireStatus"]), + } + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("disks", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_storage_gateway_gateway_file_shares.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_storage_gateway_gateway_file_shares.go new file mode 100644 index 00000000000..cd68dba61d7 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_storage_gateway_gateway_file_shares.go @@ -0,0 +1,478 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudCloudStorageGatewayGatewayFileShares() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudCloudStorageGatewayGatewayFileSharesRead, + Schema: map[string]*schema.Schema{ + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "gateway_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "shares": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "access_based_enumeration": { + Type: schema.TypeBool, + Computed: true, + }, + "address": { + Type: schema.TypeString, + Computed: true, + }, + "backend_limit": { + Type: schema.TypeInt, + Computed: true, + }, + "browsable": { + Type: schema.TypeBool, + Computed: true, + }, + "bucket_infos": { + Type: schema.TypeString, + Computed: true, + }, + "buckets_stub": { + Type: schema.TypeBool, + Computed: true, + }, + "cache_mode": { + Type: schema.TypeString, + Computed: true, + }, + "client_side_cmk": { + Type: schema.TypeString, + Computed: true, + }, + "client_side_encryption": { + Type: schema.TypeBool, + Computed: true, + }, + "direct_io": { + Type: schema.TypeBool, + Computed: true, + }, + "disk_id": { + Type: schema.TypeString, + Computed: true, + }, + "disk_type": { + Type: schema.TypeString, + Computed: true, + }, + "download_limit": { + Type: schema.TypeInt, + Computed: true, + }, + "enabled": { + Type: schema.TypeBool, + Computed: true, + }, + "express_sync_id": { + Type: schema.TypeString, + Computed: true, + }, + "fast_reclaim": { + Type: schema.TypeBool, + Computed: true, + }, + "fe_limit": { + Type: schema.TypeInt, + Computed: true, + }, + "file_num_limit": { + Type: schema.TypeString, + Computed: true, + }, + "fs_size_limit": { + Type: schema.TypeString, + Computed: true, + }, + "gateway_file_share_name": { + Type: schema.TypeString, + Computed: true, + }, + "gateway_id": { + Type: schema.TypeString, + Computed: true, + }, + "ignore_delete": { + Type: schema.TypeBool, + Computed: true, + }, + "in_place": { + Type: schema.TypeBool, + Computed: true, + }, + "in_rate": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "index_id": { + Type: schema.TypeString, + Computed: true, + }, + "kms_rotate_period": { + Type: schema.TypeInt, + Computed: true, + }, + "lag_period": { + Type: schema.TypeString, + Computed: true, + }, + "local_path": { + Type: schema.TypeString, + Computed: true, + }, + "mns_health": { + Type: schema.TypeString, + Computed: true, + }, + "nfs_v4_optimization": { + Type: schema.TypeBool, + Computed: true, + }, + "obsolete_buckets": { + Type: schema.TypeString, + Computed: true, + }, + "oss_bucket_name": { + Type: schema.TypeString, + Computed: true, + }, + "oss_bucket_ssl": { + Type: schema.TypeBool, + Computed: true, + }, + "oss_endpoint": { + Type: schema.TypeString, + Computed: true, + }, + "oss_health": { + Type: schema.TypeString, + Computed: true, + }, + "oss_used": { + Type: schema.TypeString, + Computed: true, + }, + "out_rate": { + Type: schema.TypeString, + Computed: true, + }, + "partial_sync_paths": { + Type: schema.TypeString, + Computed: true, + }, + "path_prefix": { + Type: schema.TypeString, + Computed: true, + }, + "polling_interval": { + Type: schema.TypeInt, + Computed: true, + }, + "protocol": { + Type: schema.TypeString, + Computed: true, + }, + "remaining_meta_space": { + Type: schema.TypeString, + Computed: true, + }, + "remote_sync": { + Type: schema.TypeBool, + Computed: true, + }, + "remote_sync_download": { + Type: schema.TypeBool, + Computed: true, + }, + "ro_client_list": { + Type: schema.TypeString, + Computed: true, + }, + "ro_user_list": { + Type: schema.TypeString, + Computed: true, + }, + "rw_client_list": { + Type: schema.TypeString, + Computed: true, + }, + "rw_user_list": { + Type: schema.TypeString, + Computed: true, + }, + "server_side_cmk": { + Type: schema.TypeString, + Computed: true, + }, + "server_side_encryption": { + Type: schema.TypeBool, + Computed: true, + }, + "size": { + Type: schema.TypeString, + Computed: true, + }, + "squash": { + Type: schema.TypeString, + Computed: true, + }, + "state": { + Type: schema.TypeString, + Computed: true, + }, + "support_archive": { + Type: schema.TypeBool, + Computed: true, + }, + "sync_progress": { + Type: schema.TypeInt, + Computed: true, + }, + "total_download": { + Type: schema.TypeString, + Computed: true, + }, + "total_upload": { + Type: schema.TypeString, + Computed: true, + }, + "transfer_acceleration": { + Type: schema.TypeBool, + Computed: true, + }, + "used": { + Type: schema.TypeString, + Computed: true, + }, + "windows_acl": { + Type: schema.TypeBool, + Computed: true, + }, + "bypass_cache_read": { + Type: schema.TypeBool, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudCloudStorageGatewayGatewayFileSharesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeGatewayFileShares" + request := make(map[string]interface{}) + request["GatewayId"] = d.Get("gateway_id") + request["Refresh"] = true + var objects []map[string]interface{} + var gatewayFileShareNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + gatewayFileShareNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewHcsSgwClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-05-11"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_cloud_storage_gateway_gateway_file_shares", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + resp, err := jsonpath.Get("$.FileShares.FileShare", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.FileShares.FileShare", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if gatewayFileShareNameRegex != nil && !gatewayFileShareNameRegex.MatchString(fmt.Sprint(item["Name"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(request["GatewayId"], ":", item["IndexId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "access_based_enumeration": object["AccessBasedEnumeration"], + "address": object["Address"], + "backend_limit": formatInt(object["BeLimit"]), + "browsable": object["Browsable"], + "bucket_infos": object["BucketInfos"], + "buckets_stub": object["BucketsStub"], + "cache_mode": object["CacheMode"], + "client_side_cmk": object["ClientSideCmk"], + "client_side_encryption": object["ClientSideEncryption"], + "direct_io": object["DirectIO"], + "disk_id": object["DiskId"], + "disk_type": object["DiskType"], + "download_limit": formatInt(object["DownloadLimit"]), + "enabled": object["Enabled"], + "fast_reclaim": object["FastReclaim"], + "fe_limit": formatInt(object["FeLimit"]), + "file_num_limit": fmt.Sprint(object["FileNumLimit"]), + "fs_size_limit": fmt.Sprint(object["FsSizeLimit"]), + "gateway_file_share_name": object["Name"], + "gateway_id": request["GatewayId"], + "ignore_delete": object["IgnoreDelete"], + "in_place": object["InPlace"], + "in_rate": fmt.Sprint(object["InRate"]), + "id": fmt.Sprint(request["GatewayId"], ":", object["IndexId"]), + "index_id": fmt.Sprint(object["IndexId"]), + "kms_rotate_period": formatInt(object["KmsRotatePeriod"]), + "lag_period": fmt.Sprint(object["LagPeriod"]), + "local_path": object["LocalPath"], + "mns_health": object["MnsHealth"], + "nfs_v4_optimization": object["NfsV4Optimization"], + "obsolete_buckets": object["ObsoleteBuckets"], + "oss_bucket_name": object["OssBucketName"], + "oss_bucket_ssl": object["OssBucketSsl"], + "oss_endpoint": object["OssEndpoint"], + "oss_health": object["OssHealth"], + "oss_used": fmt.Sprint(object["OssUsed"]), + "out_rate": fmt.Sprint(object["OutRate"]), + "partial_sync_paths": object["PartialSyncPaths"], + "path_prefix": object["PathPrefix"], + "polling_interval": formatInt(object["PollingInterval"]), + "protocol": object["Protocol"], + "remaining_meta_space": fmt.Sprint(object["RemainingMetaSpace"]), + "remote_sync": object["RemoteSync"], + "remote_sync_download": object["RemoteSyncDownload"], + "server_side_encryption": object["ServerSideEncryption"], + "size": fmt.Sprint(object["Size"]), + "squash": object["Squash"], + "state": object["State"], + "support_archive": object["SupportArchive"], + "sync_progress": formatInt(object["SyncProgress"]), + "total_download": fmt.Sprint(object["TotalDownload"]), + "total_upload": fmt.Sprint(object["TotalUpload"]), + "transfer_acceleration": object["TransferAcceleration"], + "used": fmt.Sprint(object["Used"]), + "windows_acl": object["WindowsAcl"], + "bypass_cache_read": object["BypassCacheRead"], + } + if v, ok := object["ExpressSyncId"]; ok { + mapping["express_sync_id"] = v + } + if v, ok := object["RoUserList"]; ok { + mapping["ro_user_list"] = v + } + if v, ok := object["RoClientList"]; ok { + mapping["ro_client_list"] = v + } + if v, ok := object["ServerSideCmk"]; ok { + mapping["server_side_cmk"] = v + } + if v, ok := object["RwUserList"]; ok { + mapping["rw_user_list"] = v + } + if v, ok := object["RwClientList"]; ok { + mapping["rw_client_list"] = v + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["Name"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("shares", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_storage_gateway_gateway_smb_users.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_storage_gateway_gateway_smb_users.go new file mode 100644 index 00000000000..2d760e36d2f --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_storage_gateway_gateway_smb_users.go @@ -0,0 +1,168 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudCloudStorageGatewayGatewaySmbUsers() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudCloudStorageGatewayGatewaySmbUsersRead, + Schema: map[string]*schema.Schema{ + "gateway_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "users": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "gateway_id": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "username": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudCloudStorageGatewayGatewaySmbUsersRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeGatewaySMBUsers" + request := make(map[string]interface{}) + request["GatewayId"] = d.Get("gateway_id") + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + var nameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + nameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewHcsSgwClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-05-11"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_cloud_storage_gateway_gateway_smb_users", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + resp, err := jsonpath.Get("$.Users.User", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Users.User", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if nameRegex != nil && !nameRegex.MatchString(fmt.Sprint(item["Username"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(request["GatewayId"], ":", item["Username"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "gateway_id": request["GatewayId"], + "id": fmt.Sprint(request["GatewayId"], ":", object["Username"]), + "username": fmt.Sprint(object["Username"]), + } + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("users", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_storage_gateway_gateways.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_storage_gateway_gateways.go index f77465ebdf5..13998e69ff4 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_storage_gateway_gateways.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_storage_gateway_gateways.go @@ -50,6 +50,15 @@ func dataSourceAlicloudCloudStorageGatewayGateways() *schema.Resource { Type: schema.TypeString, Optional: true, }, + "page_number": { + Type: schema.TypeInt, + Optional: true, + }, + "page_size": { + Type: schema.TypeInt, + Optional: true, + Default: 50, + }, "gateways": { Type: schema.TypeList, Computed: true, @@ -162,6 +171,10 @@ func dataSourceAlicloudCloudStorageGatewayGateways() *schema.Resource { }, }, }, + "total_count": { + Type: schema.TypeInt, + Computed: true, + }, }, } } @@ -171,9 +184,8 @@ func dataSourceAlicloudCloudStorageGatewayGatewaysRead(d *schema.ResourceData, m action := "DescribeGateways" request := make(map[string]interface{}) request["StorageBundleId"] = d.Get("storage_bundle_id") - request["PageSize"] = PageSizeLarge - request["PageNumber"] = 1 - var objects []map[string]interface{} + setPagingRequest(d, request, PageSizeLarge) + var objects []interface{} var nameRegex *regexp.Regexp if v, ok := d.GetOk("name_regex"); ok { r, err := regexp.Compile(v.(string)) @@ -225,6 +237,10 @@ func dataSourceAlicloudCloudStorageGatewayGatewaysRead(d *schema.ResourceData, m return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Gateways.Gateway", response) } result, _ := resp.([]interface{}) + if isPagingRequest(d) { + objects = result + break + } for _, v := range result { item := v.(map[string]interface{}) if nameRegex != nil && !nameRegex.MatchString(fmt.Sprint(item["Name"])) { @@ -240,7 +256,7 @@ func dataSourceAlicloudCloudStorageGatewayGatewaysRead(d *schema.ResourceData, m } objects = append(objects, item) } - if len(result) < PageSizeLarge { + if len(result) < request["PageSize"].(int) { break } request["PageNumber"] = request["PageNumber"].(int) + 1 @@ -248,7 +264,8 @@ func dataSourceAlicloudCloudStorageGatewayGatewaysRead(d *schema.ResourceData, m ids := make([]string, 0) names := make([]interface{}, 0) s := make([]map[string]interface{}, 0) - for _, object := range objects { + for _, v := range objects { + object := v.(map[string]interface{}) mapping := map[string]interface{}{ "activated_time": fmt.Sprint(object["ActivatedTime"]), "buy_url": object["BuyURL"], @@ -294,6 +311,11 @@ func dataSourceAlicloudCloudStorageGatewayGatewaysRead(d *schema.ResourceData, m if err := d.Set("gateways", s); err != nil { return WrapError(err) } + + if err := d.Set("total_count", formatInt(response["TotalCount"])); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { writeToFile(output.(string), s) } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_storage_gateway_stocks.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_storage_gateway_stocks.go new file mode 100644 index 00000000000..0e0e48ee9e2 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_storage_gateway_stocks.go @@ -0,0 +1,123 @@ +package alicloud + +import ( + "fmt" + "strconv" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudCloudStorageGatewayStocks() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudCloudStorageGatewayStocksRead, + Schema: map[string]*schema.Schema{ + "gateway_class": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Basic", "Standard", "Enhanced", "Advanced"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "stocks": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "zone_id": { + Type: schema.TypeString, + Computed: true, + }, + "available_gateway_classes": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudCloudStorageGatewayStocksRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DescribeGatewayStock" + request := make(map[string]interface{}) + request["GatewayRegionId"] = client.RegionId + gatewayClass, gatewayClassOk := d.GetOk("gateway_class") + var objects []map[string]interface{} + var response map[string]interface{} + conn, err := client.NewHcsSgwClient() + if err != nil { + return WrapError(err) + } + + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-05-11"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_cloud_storage_gateway_stocks", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + resp, err := jsonpath.Get("$.Stocks.Stock", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Stocks.Stock", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + stockInfo, _ := convertJsonStringToMap(item["StockInfo"].(string)) + if gatewayClassOk && gatewayClass.(string) != "" && !stockInfo[gatewayClass.(string)].(bool) { + continue + } + + stockInfoKeys := make([]string, 0) + for k, v := range stockInfo { + if v.(bool) { + stockInfoKeys = append(stockInfoKeys, k) + } + } + + if len(stockInfoKeys) > 0 { + object := map[string]interface{}{ + "zone_id": fmt.Sprint(item["ZoneId"]), + "available_gateway_classes": stockInfoKeys, + } + + objects = append(objects, object) + } + } + + d.SetId(strconv.FormatInt(time.Now().Unix(), 16)) + if err := d.Set("stocks", objects); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), objects) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_storage_gateway_storage_bundles.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_storage_gateway_storage_bundles.go index 5d577ba2a2d..7dd0a9626b5 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_storage_gateway_storage_bundles.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloud_storage_gateway_storage_bundles.go @@ -42,6 +42,15 @@ func dataSourceAlicloudCloudStorageGatewayStorageBundles() *schema.Resource { Type: schema.TypeString, Optional: true, }, + "page_number": { + Type: schema.TypeInt, + Optional: true, + }, + "page_size": { + Type: schema.TypeInt, + Optional: true, + Default: 50, + }, "bundles": { Type: schema.TypeList, Computed: true, @@ -67,9 +76,17 @@ func dataSourceAlicloudCloudStorageGatewayStorageBundles() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, }, }, }, + "total_count": { + Type: schema.TypeInt, + Computed: true, + }, }, } } @@ -80,9 +97,8 @@ func dataSourceAlicloudCloudStorageGatewayStorageBundlesRead(d *schema.ResourceD action := "DescribeStorageBundles" request := make(map[string]interface{}) request["BackendBucketRegionId"] = d.Get("backend_bucket_region_id") - request["PageSize"] = PageSizeLarge - request["PageNumber"] = 1 - var objects []map[string]interface{} + setPagingRequest(d, request, PageSizeLarge) + var objects []interface{} var storageBundleNameRegex *regexp.Regexp if v, ok := d.GetOk("name_regex"); ok { r, err := regexp.Compile(v.(string)) @@ -120,6 +136,10 @@ func dataSourceAlicloudCloudStorageGatewayStorageBundlesRead(d *schema.ResourceD return WrapErrorf(err, FailedGetAttributeMsg, action, "$.StorageBundles.StorageBundle", response) } result, _ := resp.([]interface{}) + if isPagingRequest(d) { + objects = result + break + } for _, v := range result { item := v.(map[string]interface{}) if storageBundleNameRegex != nil { @@ -134,7 +154,7 @@ func dataSourceAlicloudCloudStorageGatewayStorageBundlesRead(d *schema.ResourceD } objects = append(objects, item) } - if len(result) < PageSizeLarge { + if len(result) < request["PageSize"].(int) { break } request["PageNumber"] = request["PageNumber"].(int) + 1 @@ -142,13 +162,15 @@ func dataSourceAlicloudCloudStorageGatewayStorageBundlesRead(d *schema.ResourceD ids := make([]string, 0) names := make([]interface{}, 0) s := make([]map[string]interface{}, 0) - for _, object := range objects { + for _, v := range objects { + object := v.(map[string]interface{}) mapping := map[string]interface{}{ "description": object["Description"], "location": object["Location"], "id": fmt.Sprint(object["StorageBundleId"]), "storage_bundle_id": fmt.Sprint(object["StorageBundleId"]), "storage_bundle_name": object["Name"], + "create_time": object["CreatedTime"], } ids = append(ids, fmt.Sprint(object["StorageBundleId"])) names = append(names, object["Name"]) @@ -167,6 +189,11 @@ func dataSourceAlicloudCloudStorageGatewayStorageBundlesRead(d *schema.ResourceD if err := d.Set("bundles", s); err != nil { return WrapError(err) } + + if err := d.Set("total_count", formatInt(response["TotalCount"])); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { writeToFile(output.(string), s) } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloudauth_face_configs.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloudauth_face_configs.go new file mode 100644 index 00000000000..c9007e34c63 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cloudauth_face_configs.go @@ -0,0 +1,162 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudCloudauthFaceConfigs() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudCloudauthFaceConfigsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "configs": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "biz_name": { + Type: schema.TypeString, + Computed: true, + }, + "biz_type": { + Type: schema.TypeString, + Computed: true, + }, + "gmt_updated": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudCloudauthFaceConfigsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeFaceConfig" + request := make(map[string]interface{}) + var objects []map[string]interface{} + + var configNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + configNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewCloudauthClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-03-07"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_cloudauth_face_configs", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Items", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Items", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + + if configNameRegex != nil && !configNameRegex.MatchString(fmt.Sprint(item["BizName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["BizType"])]; !ok { + continue + } + } + objects = append(objects, item) + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "biz_name": object["BizName"], + "biz_type": object["BizType"], + "gmt_updated": object["GmtUpdated"], + } + ids = append(ids, fmt.Sprint(object["BizType"])) + names = append(names, fmt.Sprint(mapping["BizName"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + if err := d.Set("configs", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cms_dynamic_tag_groups.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cms_dynamic_tag_groups.go new file mode 100644 index 00000000000..a51e9c8e8f9 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cms_dynamic_tag_groups.go @@ -0,0 +1,202 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudCmsDynamicTagGroups() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudCmsDynamicTagGroupsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"FINISH", "RUNNING"}, false), + }, + "tag_key": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "groups": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, + "match_express": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "tag_value": { + Type: schema.TypeString, + Computed: true, + }, + "tag_value_match_function": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "dynamic_tag_rule_id": { + Type: schema.TypeString, + Computed: true, + }, + "match_express_filter_relation": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "tag_key": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudCmsDynamicTagGroupsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeDynamicTagRuleList" + request := make(map[string]interface{}) + + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("tag_key"); ok { + request["TagKey"] = v.(string) + } + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewCmsClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-01-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_cms_dynamic_tag_groups", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + resp, err := jsonpath.Get("$.TagGroupList.TagGroup", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.TagGroupList.TagGroup", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["DynamicTagRuleId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["Status"].(string) { + continue + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "id": fmt.Sprint(object["DynamicTagRuleId"]), + "dynamic_tag_rule_id": fmt.Sprint(object["DynamicTagRuleId"]), + "match_express_filter_relation": object["MatchExpressFilterRelation"], + "status": object["Status"], + "tag_key": object["TagKey"], + } + + if matchExpressMap, ok := object["MatchExpress"]; ok && matchExpressMap != nil { + resourceData := make([]map[string]interface{}, 0) + for _, matchExpressListItem := range matchExpressMap.(map[string]interface{}) { + for _, val := range matchExpressListItem.([]interface{}) { + matchExpressObject := make(map[string]interface{}, 0) + matchExpressObject["tag_value"] = val.(map[string]interface{})["TagValue"] + matchExpressObject["tag_value_match_function"] = val.(map[string]interface{})["TagValueMatchFunction"] + resourceData = append(resourceData, matchExpressObject) + } + } + mapping["match_express"] = resourceData + } + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("groups", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cms_metric_rule_templates.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cms_metric_rule_templates.go new file mode 100644 index 00000000000..80bab830a19 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cms_metric_rule_templates.go @@ -0,0 +1,356 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudCmsMetricRuleTemplates() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudCmsMetricRuleTemplatesRead, + Schema: map[string]*schema.Schema{ + "keyword": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "template_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "metric_rule_template_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "templates": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "alert_templates": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "category": { + Type: schema.TypeString, + Computed: true, + }, + "escalations": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "critical": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "comparison_operator": { + Type: schema.TypeString, + Computed: true, + }, + "statistics": { + Type: schema.TypeString, + Computed: true, + }, + "threshold": { + Type: schema.TypeString, + Computed: true, + }, + "times": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "info": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "comparison_operator": { + Type: schema.TypeString, + Computed: true, + }, + "statistics": { + Type: schema.TypeString, + Computed: true, + }, + "threshold": { + Type: schema.TypeString, + Computed: true, + }, + "times": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "warn": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "comparison_operator": { + Type: schema.TypeString, + Computed: true, + }, + "statistics": { + Type: schema.TypeString, + Computed: true, + }, + "threshold": { + Type: schema.TypeString, + Computed: true, + }, + "times": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + }, + }, + "metric_name": { + Type: schema.TypeString, + Computed: true, + }, + "namespace": { + Type: schema.TypeString, + Computed: true, + }, + "rule_name": { + Type: schema.TypeString, + Computed: true, + }, + "selector": { + Type: schema.TypeString, + Computed: true, + }, + "webhook": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "group_id": { + Type: schema.TypeString, + Computed: true, + }, + "metric_rule_template_name": { + Type: schema.TypeString, + Computed: true, + }, + "rest_version": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "template_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudCmsMetricRuleTemplatesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeMetricRuleTemplateList" + request := make(map[string]interface{}) + if v, ok := d.GetOk("keyword"); ok { + request["Keyword"] = v + } + if v, ok := d.GetOk("template_id"); ok { + request["TemplateId"] = v + } + if v, ok := d.GetOk("metric_rule_template_name"); ok { + request["Name"] = v + } + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + var metricRuleTemplateNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + metricRuleTemplateNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewCmsClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-01-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_cms_metric_rule_templates", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + resp, err := jsonpath.Get("$.Templates.Template", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Templates.Template", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if metricRuleTemplateNameRegex != nil && !metricRuleTemplateNameRegex.MatchString(fmt.Sprint(item["Name"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["TemplateId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "description": object["Description"], + "metric_rule_template_name": object["Name"], + "rest_version": fmt.Sprint(object["RestVersion"]), + "id": fmt.Sprint(object["TemplateId"]), + "template_id": fmt.Sprint(object["TemplateId"]), + } + + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["Name"]) + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + s = append(s, mapping) + continue + } + id := fmt.Sprint(object["TemplateId"]) + cmsService := CmsService{client} + getResp, err := cmsService.DescribeCmsMetricRuleTemplate(id) + if err != nil { + return WrapError(err) + } + + alertTemplate := make([]map[string]interface{}, 0) + if alertTemplateList, ok := getResp["AlertTemplates"].(map[string]interface{})["AlertTemplate"].([]interface{}); ok { + for _, v := range alertTemplateList { + if m1, ok := v.(map[string]interface{}); ok { + temp1 := map[string]interface{}{ + "category": m1["Category"], + "metric_name": m1["MetricName"], + "namespace": m1["Namespace"], + "rule_name": m1["RuleName"], + "selector": m1["Selector"], + "webhook": m1["Webhook"], + } + alertTemplate = append(alertTemplate, temp1) + } + } + } + mapping["alert_templates"] = alertTemplate + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("templates", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cms_monitor_groups.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cms_monitor_groups.go index a69cab9d884..5a0df8f4b11 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cms_monitor_groups.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cms_monitor_groups.go @@ -81,7 +81,9 @@ func dataSourceAlicloudCmsMonitorGroups() *schema.Resource { "contact_groups": { Type: schema.TypeList, Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, }, "dynamic_tag_rule_id": { Type: schema.TypeString, @@ -246,6 +248,7 @@ func dataSourceAlicloudCmsMonitorGroupsRead(d *schema.ResourceData, meta interfa contactGroups = append(contactGroups, contactGroup.(map[string]interface{})["Name"]) } } + mapping["contact_groups"] = contactGroups } tags := make(map[string]interface{}) diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_config_aggregate_config_rules.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_config_aggregate_config_rules.go index 1ea389f3af6..eccb106f03d 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_config_aggregate_config_rules.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_config_aggregate_config_rules.go @@ -70,6 +70,10 @@ func dataSourceAlicloudConfigAggregateConfigRules() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "aggregator_id": { + Type: schema.TypeString, + Computed: true, + }, "aggregate_config_rule_name": { Type: schema.TypeString, Computed: true, @@ -284,6 +288,11 @@ func dataSourceAlicloudConfigAggregateConfigRulesRead(d *schema.ResourceData, me "source_owner": object["SourceOwner"], "status": object["ConfigRuleState"], } + mapping["compliance"] = []map[string]interface{}{{ + "compliance_type": object["Compliance"].(map[string]interface{})["ComplianceType"], + "count": object["Compliance"].(map[string]interface{})["Count"], + }} + mapping["aggregator_id"] = object["CreateBy"].(map[string]interface{})["AggregatorId"] if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { ids = append(ids, fmt.Sprint(mapping["id"])) names = append(names, object["ConfigRuleName"]) diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_config_rules.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_config_rules.go index bcbab5e6987..217d9aa13e4 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_config_rules.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_config_rules.go @@ -41,6 +41,7 @@ func dataSourceAlicloudConfigRules() *schema.Resource { Type: schema.TypeInt, Optional: true, ForceNew: true, + Removed: "Field 'member_id' has been removed from provider version 1.146.0. Please Use the Resource alicloud_config_aggregate_config_rule", }, "message_type": { Type: schema.TypeString, @@ -54,6 +55,7 @@ func dataSourceAlicloudConfigRules() *schema.Resource { Optional: true, ForceNew: true, Default: false, + Removed: "Field 'multi_account' has been removed from provider version 1.146.0. Please Use the Resource alicloud_config_aggregate_config_rule", }, "risk_level": { Type: schema.TypeInt, @@ -225,12 +227,6 @@ func dataSourceAlicloudConfigRulesRead(d *schema.ResourceData, meta interface{}) action := "ListConfigRules" request := make(map[string]interface{}) - if v, ok := d.GetOk("member_id"); ok { - request["MemberId"] = v - } - if v, ok := d.GetOkExists("multi_account"); ok { - request["MultiAccount"] = v - } if v, ok := d.GetOk("risk_level"); ok { request["RiskLevel"] = v } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cr_chart_namespaces.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cr_chart_namespaces.go new file mode 100644 index 00000000000..cdcedc637b7 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cr_chart_namespaces.go @@ -0,0 +1,190 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudCrChartNamespaces() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudCrChartNamespacesRead, + Schema: map[string]*schema.Schema{ + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + }, + "names": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "namespaces": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "auto_create_repo": { + Type: schema.TypeBool, + Computed: true, + }, + "chart_namespace_id": { + Type: schema.TypeString, + Computed: true, + }, + "default_repo_type": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "namespace_name": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudCrChartNamespacesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListChartNamespace" + request := make(map[string]interface{}) + request["RegionId"] = client.RegionId + request["InstanceId"] = d.Get("instance_id") + + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var nameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + nameRegex = regexp.MustCompile(v.(string)) + } + + var response map[string]interface{} + conn, err := client.NewAcrClient() + if err != nil { + return WrapError(err) + } + + pageNo, pageSize := 1, PageSizeLarge + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-12-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_cr_chart_namespaces", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Namespaces", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Namespaces", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if nameRegex != nil && !nameRegex.MatchString(fmt.Sprint(item["NamespaceName"])) { + continue + } + + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["InstanceId"], ":", item["NamespaceName"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < pageSize { + break + } + pageNo++ + } + + ids := make([]string, 0) + names := make([]interface{}, 0) + + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "auto_create_repo": object["AutoCreateRepo"], + "chart_namespace_id": object["NamespaceId"], + "default_repo_type": object["DefaultRepoType"], + "id": fmt.Sprint(request["InstanceId"], ":", request["NamespaceName"]), + "instance_id": fmt.Sprint(object["InstanceId"]), + "namespace_name": object["NamespaceName"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, mapping["namespace_name"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + if err := d.Set("namespaces", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cr_chart_repositories.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cr_chart_repositories.go new file mode 100644 index 00000000000..92682667ad2 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cr_chart_repositories.go @@ -0,0 +1,198 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudCrChartRepositories() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudCrChartRepositoriesRead, + Schema: map[string]*schema.Schema{ + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + }, + "names": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "repositories": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "chart_repository_id": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "repo_name": { + Type: schema.TypeString, + Computed: true, + }, + "repo_namespace_name": { + Type: schema.TypeString, + Computed: true, + }, + "repo_type": { + Type: schema.TypeString, + Computed: true, + }, + "summary": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudCrChartRepositoriesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListChartRepository" + request := make(map[string]interface{}) + request["InstanceId"] = d.Get("instance_id") + request["RegionId"] = client.RegionId + + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var nameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + nameRegex = regexp.MustCompile(v.(string)) + } + + var response map[string]interface{} + conn, err := client.NewAcrClient() + if err != nil { + return WrapError(err) + } + pageNo, pageSize := 1, PageSizeLarge + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-12-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_cr_chart_repositories", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Repositories", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Repositories", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if nameRegex != nil && !nameRegex.MatchString(fmt.Sprint(item["RepoName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["InstanceId"], ":", item["RepoNamespaceName"], ":", item["RepoName"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < pageSize { + break + } + pageNo++ + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + + for _, object := range objects { + mapping := map[string]interface{}{ + "chart_repository_id": object["RepoId"], + "create_time": fmt.Sprint(object["CreateTime"]), + "instance_id": object["InstanceId"], + "id": fmt.Sprint(object["InstanceId"], ":", object["RepoNamespaceName"], ":", object["RepoName"]), + "repo_name": fmt.Sprint(object["RepoName"]), + "repo_namespace_name": object["RepoNamespaceName"], + "repo_type": object["RepoType"], + "summary": object["Summary"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, mapping["repo_name"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("repositories", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cr_endpoint_acl_policies.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cr_endpoint_acl_policies.go new file mode 100644 index 00000000000..ef68dfa2d66 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cr_endpoint_acl_policies.go @@ -0,0 +1,158 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudCrEndpointAclPolicies() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudCrEndpointAclPoliciesRead, + Schema: map[string]*schema.Schema{ + "endpoint_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"internet"}, false), + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "policies": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "description": { + Type: schema.TypeString, + Computed: true, + }, + "endpoint_type": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "entry": { + Type: schema.TypeString, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudCrEndpointAclPoliciesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "GetInstanceEndpoint" + request := make(map[string]interface{}) + request["EndpointType"] = d.Get("endpoint_type") + request["InstanceId"] = d.Get("instance_id") + if v, ok := d.GetOk("module_name"); ok { + request["ModuleName"] = v + } + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewAcrClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-12-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_cr_instance_endpoint_acl_policies", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.AclEntries", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.AclEntries", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(request["InstanceId"], ":", request["EndpointType"], ":", item["Entry"])]; !ok { + continue + } + } + objects = append(objects, item) + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "description": object["Comment"], + "endpoint_type": request["EndpointType"], + "id": fmt.Sprint(request["InstanceId"], ":", request["EndpointType"], ":", object["Entry"]), + "entry": fmt.Sprint(object["Entry"]), + "instance_id": request["InstanceId"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("policies", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cr_endpoint_acl_service.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cr_endpoint_acl_service.go new file mode 100644 index 00000000000..dc0c47674c9 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cr_endpoint_acl_service.go @@ -0,0 +1,98 @@ +package alicloud + +import ( + "fmt" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudCrEndpointAclService() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudCrEndpointAclServiceRead, + Schema: map[string]*schema.Schema{ + "enable": { + Type: schema.TypeBool, + Required: true, + }, + "endpoint_type": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"internet"}, false), + }, + "instance_id": { + Type: schema.TypeString, + Required: true, + }, + "module_name": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"Registry", "Chart"}, false), + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func dataSourceAlicloudCrEndpointAclServiceRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "UpdateInstanceEndpointStatus" + request := make(map[string]interface{}) + request["Enable"] = d.Get("enable") + request["EndpointType"] = d.Get("endpoint_type") + request["InstanceId"] = d.Get("instance_id") + if v, ok := d.GetOk("module_name"); ok { + request["ModuleName"] = v + } + + var response map[string]interface{} + conn, err := client.NewAcrClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-12-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_cr_instance_endpoint_acl_service", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["InstanceId"], ":", request["EndpointType"])) + d.Set("endpoint_type", request["EndpointType"]) + d.Set("instance_id", request["InstanceId"]) + d.Set("enable", request["Enable"]) + + if v, ok := d.GetOk("enable"); !ok || !v.(bool) { + d.Set("status", "") + return nil + } + + crService := CrService{client} + stateConf := BuildStateConf([]string{}, []string{"RUNNING"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, crService.CrEndpointAclServiceStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + d.Set("status", "RUNNING") + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cs_kubernetes_addons.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cs_kubernetes_addons.go new file mode 100644 index 00000000000..1b29dbf5597 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_cs_kubernetes_addons.go @@ -0,0 +1,150 @@ +package alicloud + +import ( + "fmt" + "regexp" + + "github.com/hashicorp/terraform-plugin-sdk/helper/hashcode" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + "github.com/alibabacloud-go/tea/tea" + + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudCSKubernetesAddons() *schema.Resource { + return &schema.Resource{ + Read: dataAlicloudCSKubernetesAddonsRead, + + Schema: map[string]*schema.Schema{ + "cluster_id": { + Type: schema.TypeString, + Required: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + }, + "names": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "addons": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Computed: true, + }, + "current_version": { + Type: schema.TypeString, + Computed: true, + }, + "next_version": { + Type: schema.TypeString, + Computed: true, + }, + "required": { + Type: schema.TypeBool, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataAlicloudCSKubernetesAddonsRead(d *schema.ResourceData, meta interface{}) error { + filterAddons := make(map[string]*Component) + var ids, names []string + + clusterId := d.Get("cluster_id").(string) + + addons, err := describeAvailableAddons(d, meta) + for _, addon := range addons { + if nameRegex, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(nameRegex.(string)) + if err != nil { + return WrapError(err) + } + if !r.MatchString(addon.ComponentName) { + continue + } + } + if ids, ok := d.GetOk("ids"); ok { + findId := func(id string, ids []string) (ret bool) { + for _, i := range ids { + if id == i { + ret = true + } + } + return + } + if !findId(fmt.Sprintf("%s%s%s", clusterId, COLON_SEPARATED, addon.ComponentName), expandStringList(ids.([]interface{}))) { + continue + } + } + filterAddons[addon.ComponentName] = addon + ids = append(ids, fmt.Sprintf("%s%s%s", clusterId, COLON_SEPARATED, addon.ComponentName)) + names = append(names, addon.ComponentName) + } + + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, ResourceAlicloudCSKubernetesAddon, "describeAddonsMeta", err) + } + result := fetchAddonsMetadata(filterAddons) + + d.Set("cluster_id", clusterId) + d.Set("ids", ids) + d.Set("names", names) + d.Set("addons", result) + + d.SetId(tea.ToString(hashcode.String(clusterId))) + return nil +} + +func describeAvailableAddons(d *schema.ResourceData, meta interface{}) (map[string]*Component, error) { + clusterId := d.Get("cluster_id").(string) + + client, err := meta.(*connectivity.AliyunClient).NewRoaCsClient() + if err != nil { + return nil, err + } + csClient := CsClient{client} + + availableAddons, err := csClient.DescribeCsKubernetesAllAvailableAddons(clusterId) + if err != nil { + return nil, WrapErrorf(err, DefaultErrorMsg, ResourceAlicloudCSKubernetesAddon, "DescribeCsKubernetesAllAvailableAddons", err) + } + + return availableAddons, nil +} + +func fetchAddonsMetadata(addonsMap map[string]*Component) []map[string]interface{} { + result := []map[string]interface{}{} + for name, addon := range addonsMap { + state := map[string]interface{}{} + state["name"] = name + state["current_version"] = addon.Version + state["next_version"] = addon.NextVersion + state["required"] = addon.Required + result = append(result, state) + } + return result +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_dataworks_service.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_data_works_service.go similarity index 100% rename from vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_dataworks_service.go rename to vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_data_works_service.go diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_database_gateway_gateways.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_database_gateway_gateways.go new file mode 100644 index 00000000000..6c912406646 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_database_gateway_gateways.go @@ -0,0 +1,305 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudDatabaseGatewayGateways() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudDatabaseGatewayGatewaysRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "search_key": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"EXCEPTION", "NEW", "RUNNING", "STOPPED"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "gateways": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "gateway_desc": { + Type: schema.TypeString, + Computed: true, + }, + "gateway_instances": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "connect_endpoint_type": { + Type: schema.TypeString, + Computed: true, + }, + "current_daemon_version": { + Type: schema.TypeString, + Computed: true, + }, + "current_version": { + Type: schema.TypeString, + Computed: true, + }, + "end_point": { + Type: schema.TypeString, + Computed: true, + }, + "gateway_instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "gateway_instance_status": { + Type: schema.TypeString, + Computed: true, + }, + "last_update_time": { + Type: schema.TypeString, + Computed: true, + }, + "local_ip": { + Type: schema.TypeString, + Computed: true, + }, + "message": { + Type: schema.TypeString, + Computed: true, + }, + "output_ip": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "gateway_name": { + Type: schema.TypeString, + Computed: true, + }, + "hosts": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "modified_time": { + Type: schema.TypeString, + Computed: true, + }, + "parent_id": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "user_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudDatabaseGatewayGatewaysRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "GetUserGateways" + request := make(map[string]interface{}) + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("search_key"); ok { + request["SearchKey"] = v + } + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + var gatewayNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + gatewayNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewDgClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-03-27"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_database_gateway_gateways", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + resp, err := jsonpath.Get("$.Data", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Data", response) + } + result, _ := convertJsonStringToList(resp.(string)) + for _, v := range result { + item := v.(map[string]interface{}) + if gatewayNameRegex != nil && !gatewayNameRegex.MatchString(fmt.Sprint(item["gatewayName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["gatewayId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["status"].(string) { + continue + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "create_time": object["gmtCreateString"], + "gateway_desc": object["gatewayDesc"], + "gateway_name": object["gatewayName"], + "hosts": object["hosts"], + "id": object["gatewayId"], + "modified_time": object["gmtModifiedString"], + "parent_id": object["parentId"], + "status": object["status"], + "user_id": object["userId"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["gatewayName"]) + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + s = append(s, mapping) + continue + } + + id := fmt.Sprint(object["gatewayId"]) + dgService := DgService{client} + getResp, err := dgService.GetUserGatewayInstances(id) + if err != nil { + return WrapError(err) + } + + gatewayInstances := make([]map[string]interface{}, 0) + for _, v := range getResp { + if m, ok := v.(map[string]interface{}); ok { + temp := map[string]interface{}{ + "connect_endpoint_type": m["connectEndpointType"], + "current_daemon_version": m["currentDaemonVersion"], + "current_version": m["currentVersion"], + "end_point": m["endPoint"], + "gateway_instance_id": m["gatewayInstanceId"], + "gateway_instance_status": m["gatewayInstanceStatus"], + "last_update_time": m["lastUpdateTime"], + "local_ip": m["localIP"], + "message": m["message"], + "output_ip": m["outputIP"], + } + gatewayInstances = append(gatewayInstances, temp) + } + } + mapping["gateway_instances"] = gatewayInstances + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("gateways", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_db_instance_classes.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_db_instance_classes.go index 216531aecb2..f8af1817f06 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_db_instance_classes.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_db_instance_classes.go @@ -2,17 +2,13 @@ package alicloud import ( "fmt" - "sort" - "strconv" "strings" "time" - "github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - - "github.com/aliyun/alibaba-cloud-sdk-go/services/rds" + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" ) @@ -28,9 +24,10 @@ func dataSourceAlicloudDBInstanceClasses() *schema.Resource { ForceNew: true, }, "engine": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"MySQL", "SQLServer", "PostgreSQL", "PPAS", "MariaDB"}, false), }, "engine_version": { Type: schema.TypeString, @@ -55,13 +52,19 @@ func dataSourceAlicloudDBInstanceClasses() *schema.Resource { Optional: true, }, "category": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"Basic", "HighAvailability", "AlwaysOn", "Finance"}, false), }, "storage_type": { Type: schema.TypeString, Optional: true, - ValidateFunc: validation.StringInSlice([]string{"cloud_ssd", "local_ssd"}, false), + ValidateFunc: validation.StringInSlice([]string{"cloud_ssd", "local_ssd", "cloud_essd", "cloud_essd2", "cloud_essd3"}, false), + }, + "db_instance_storage_type": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"cloud_ssd", "local_ssd", "cloud_essd", "cloud_essd2", "cloud_essd3"}, false), }, "multi_zone": { Type: schema.TypeBool, @@ -137,196 +140,280 @@ func dataSourceAlicloudDBInstanceClasses() *schema.Resource { func dataSourceAlicloudDBInstanceClassesRead(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) - - request := rds.CreateDescribeAvailableResourceRequest() - request.RegionId = client.RegionId - request.ZoneId = d.Get("zone_id").(string) instanceChargeType := d.Get("instance_charge_type").(string) - multiZone := d.Get("multi_zone").(bool) if instanceChargeType == string(PostPaid) { instanceChargeType = string(Postpaid) } else { instanceChargeType = string(Prepaid) } - request.InstanceChargeType = instanceChargeType - var response = &rds.DescribeAvailableResourceResponse{} - err := resource.Retry(5*time.Minute, func() *resource.RetryError { - raw, err := client.WithRdsClient(func(rdsClient *rds.Client) (interface{}, error) { - return rdsClient.DescribeAvailableResource(request) - }) - if err != nil { - if IsExpectedErrors(err, []string{Throttling}) { - time.Sleep(time.Duration(5) * time.Second) - return resource.RetryableError(err) - } - return resource.NonRetryableError(err) - } - addDebug(request.GetActionName(), raw, request.RpcRequest, request) - response = raw.(*rds.DescribeAvailableResourceResponse) - return nil - }) - - if err != nil { - return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_db_instance_classes", request.GetActionName(), AlibabaCloudSdkGoERROR) + zoneId, zoneIdOk := d.GetOk("zone_id") + engine, engineOk := d.GetOk("engine") + engineVersion, engineVersionOk := d.GetOk("engine_version") + dbInstanceClass, dbInstanceClassOk := d.GetOk("db_instance_class") + dbInstanceStorageType, dbInstanceStorageTypeOk := d.GetOk("db_instance_storage_type") + if !dbInstanceStorageTypeOk || dbInstanceStorageType.(string) == "" { + dbInstanceStorageType, dbInstanceStorageTypeOk = d.GetOk("storage_type") } + category, categoryOk := d.GetOk("category") - type ClassInfosItem struct { - Index int - StorageRange map[string]string - ZoneIds []map[string]interface{} - Price float64 - } + availableZones := make([]map[string]interface{}, 0) + s := make([]map[string]interface{}, 0) + ids := make([]string, 0) + // if all filters can be got, there is no need to invoking DescribeAvailableZones to get them + if zoneIdOk && zoneId.(string) != "" && + engineOk && engine.(string) != "" && + engineVersionOk && engineVersion.(string) != "" && + dbInstanceStorageTypeOk && dbInstanceStorageType.(string) != "" && + categoryOk && category.(string) != "" { - classInfos := make(map[string]ClassInfosItem) - indexMap := make(map[string]int) - ids := []string{} - - engine, engineGot := d.GetOk("engine") - engineVersion, engineVersionGot := d.GetOk("engine_version") - dbInstanceClass, dbInstanceClassGot := d.GetOk("db_instance_class") - storageType, storageTypeGot := d.GetOk("storage_type") - category, categoryGot := d.GetOk("category") - - for _, AvailableZone := range response.AvailableZones.AvailableZone { - id_item := []string{} - if multiZone { - if !strings.Contains(AvailableZone.ZoneId, "MAZ") { + action := "DescribeAvailableClasses" + request := map[string]interface{}{ + "RegionId": client.RegionId, + "SourceIp": client.SourceIp, + "ZoneId": zoneId, + "InstanceChargeType": instanceChargeType, + "Engine": engine, + "EngineVersion": engineVersion, + "DBInstanceStorageType": dbInstanceStorageType, + "Category": category, + } + var response map[string]interface{} + conn, err := client.NewRdsClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_db_instance_classes", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.DBInstanceClasses", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.DBInstanceClasses", response) + } + zoneIds := make([]map[string]interface{}, 0) + zoneIds = append(zoneIds, map[string]interface{}{ + "id": zoneId, + "sub_zone_ids": splitMultiZoneId(zoneId.(string)), + }) + for _, r := range resp.([]interface{}) { + instanceClassItem := r.(map[string]interface{}) + if dbInstanceClassOk && dbInstanceClass != "" && dbInstanceClass != fmt.Sprint(instanceClassItem["DBInstanceClass"]) { continue } - for _, v := range splitMultiZoneId(AvailableZone.ZoneId) { - id_item = append(id_item, v) + mapping := map[string]interface{}{ + "instance_class": fmt.Sprint(instanceClassItem["DBInstanceClass"]), + "zone_ids": zoneIds, + "storage_range": map[string]interface{}{ + "min": fmt.Sprint(instanceClassItem["DBInstanceStorageRange"].(map[string]interface{})["MinValue"]), + "max": fmt.Sprint(instanceClassItem["DBInstanceStorageRange"].(map[string]interface{})["MaxValue"]), + "step": fmt.Sprint(instanceClassItem["DBInstanceStorageRange"].(map[string]interface{})["Step"]), + }, } + s = append(s, mapping) + ids = append(ids, fmt.Sprint(instanceClassItem["DBInstanceClass"])) + } + } else { + // 1. Invkoing DescribeAvailableZones to get available zones and other filters + engines := make([]string, 0) + if v, ok := d.GetOk("engine"); ok && v.(string) != "" { + engines = append(engines, v.(string)) } else { - if strings.Contains(AvailableZone.ZoneId, "MAZ") { - continue - } - id_item = []string{AvailableZone.ZoneId} + engines = []string{"MySQL", "SQLServer", "PostgreSQL", "PPAS", "MariaDB"} } - zoneId := map[string]interface{}{ - "id": AvailableZone.ZoneId, - "sub_zone_ids": id_item, + action := "DescribeAvailableZones" + request := map[string]interface{}{ + "RegionId": client.RegionId, + "SourceIp": client.SourceIp, } - - ids = append(ids, AvailableZone.ZoneId) - for _, SupportedEngine := range AvailableZone.SupportedEngines.SupportedEngine { - if engineGot && engine.(string) != SupportedEngine.Engine { - continue + if v, ok := d.GetOk("engine_version"); ok && v.(string) != "" { + request["EngineVersion"] = v.(string) + } + if v, ok := d.GetOk("zone_id"); ok && v.(string) != "" { + request["ZoneId"] = v.(string) + } + if instanceChargeType == string(PostPaid) { + request["CommodityCode"] = "bards" + } else { + request["CommodityCode"] = "rds" + } + multiZone := false + if v, ok := d.GetOk("multi_zone"); ok { + multiZone = v.(bool) + } + var targetCategory, targetStorageType string + if v, ok := d.GetOk("category"); ok && v.(string) != "" { + targetCategory = v.(string) + } + if v, ok := d.GetOk("db_instance_storage_type"); ok && v.(string) != "" { + targetStorageType = v.(string) + } + var response map[string]interface{} + conn, err := client.NewRdsClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + for _, engine := range engines { + request["Engine"] = engine + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_db_zones", action, AlibabaCloudSdkGoERROR) } - ids = append(ids, SupportedEngine.Engine) - for _, SupportedEngineVersion := range SupportedEngine.SupportedEngineVersions.SupportedEngineVersion { - if engineVersionGot && engineVersion != SupportedEngineVersion.Version { + resp, err := jsonpath.Get("$.AvailableZones", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.AvailableZones", response) + } + + for _, r := range resp.([]interface{}) { + availableZoneItem := r.(map[string]interface{}) + + zoneId := fmt.Sprint(availableZoneItem["ZoneId"]) + if (multiZone && !strings.Contains(zoneId, MULTI_IZ_SYMBOL)) || (!multiZone && strings.Contains(zoneId, MULTI_IZ_SYMBOL)) { continue } - ids = append(ids, SupportedEngineVersion.Version) - for _, SupportedCategory := range SupportedEngineVersion.SupportedCategorys.SupportedCategory { - if categoryGot && category.(string) != SupportedCategory.Category { - continue - } - for _, SupportedStorageType := range SupportedCategory.SupportedStorageTypes.SupportedStorageType { - if storageTypeGot && storageType.(string) != SupportedStorageType.StorageType { - continue - } - for _, AvailableResource := range SupportedStorageType.AvailableResources.AvailableResource { - if dbInstanceClassGot && dbInstanceClass.(string) != AvailableResource.DBInstanceClass { + + if targetCategory == "" && targetStorageType == "" { + availableZones = append(availableZones, availableZoneItem) + continue + } + for _, r := range availableZoneItem["SupportedEngines"].([]interface{}) { + supportedEngineItem := r.(map[string]interface{}) + for _, r := range supportedEngineItem["SupportedEngineVersions"].([]interface{}) { + supportedEngineVersionItem := r.(map[string]interface{}) + for _, r := range supportedEngineVersionItem["SupportedCategorys"].([]interface{}) { + supportedCategoryItem := r.(map[string]interface{}) + if targetCategory != "" && targetCategory != fmt.Sprint(supportedCategoryItem["Category"]) { continue } - zoneIds := []map[string]interface{}{} - if _, ok := classInfos[AvailableResource.DBInstanceClass]; ok { - zoneIds = append(classInfos[AvailableResource.DBInstanceClass].ZoneIds, zoneId) - } else { - zoneIds = []map[string]interface{}{zoneId} - indexMap[AvailableResource.DBInstanceClass] = len(classInfos) + if targetStorageType == "" { + availableZones = append(availableZones, availableZoneItem) + goto NEXT } - classInfos[AvailableResource.DBInstanceClass] = ClassInfosItem{ - Index: indexMap[AvailableResource.DBInstanceClass], - StorageRange: map[string]string{ - "min": strconv.Itoa(AvailableResource.DBInstanceStorageRange.Min), - "max": strconv.Itoa(AvailableResource.DBInstanceStorageRange.Max), - "step": strconv.Itoa(AvailableResource.DBInstanceStorageRange.Step), - }, - ZoneIds: zoneIds, + for _, r := range supportedCategoryItem["SupportedStorageTypes"].([]interface{}) { + supportedStorageTypeItem := r.(map[string]interface{}) + if targetStorageType != fmt.Sprint(supportedStorageTypeItem["StorageType"]) { + continue + } + availableZones = append(availableZones, availableZoneItem) + goto NEXT } } } } + NEXT: + continue } } - } - - infos := make([]map[string]interface{}, len(classInfos)) - var classIds []string - for k, v := range classInfos { - infos[v.Index] = map[string]interface{}{ - "zone_ids": v.ZoneIds, - "storage_range": v.StorageRange, - "instance_class": k, - } - classIds = append(classIds, k) - } - // The price will be query and assigned when the engine_version be specified and the sorted_by is "Price", Instead, it is assigned a null character. - sortedBy := d.Get("sorted_by").(string) - if engineVersionGot && len(infos) > 0 && sortedBy == "Price" { - bssopenapiService := BssopenapiService{client} - priceList, err := getDBInstanceClassPrice(bssopenapiService, instanceChargeType, - infos, engineVersion.(string)) - if err != nil { - return WrapError(err) - } - for i, info := range infos { - info["price"] = fmt.Sprintf("%.4f", priceList[i]) + // 2. Iterating the availableZones and invoking DescribeAvailableClasses to get available classes + for _, availableZone := range availableZones { + action := "DescribeAvailableClasses" + request := map[string]interface{}{ + "RegionId": client.RegionId, + "SourceIp": client.SourceIp, + "ZoneId": fmt.Sprint(availableZone["ZoneId"]), + "InstanceChargeType": instanceChargeType, + } + zoneIds := make([]map[string]interface{}, 0) + zoneIds = append(zoneIds, map[string]interface{}{ + "id": fmt.Sprint(availableZone["ZoneId"]), + "sub_zone_ids": splitMultiZoneId(fmt.Sprint(availableZone["ZoneId"])), + }) + for _, r := range availableZone["SupportedEngines"].([]interface{}) { + supportedEngineItem := r.(map[string]interface{}) + request["Engine"] = fmt.Sprint(supportedEngineItem["Engine"]) + for _, r := range supportedEngineItem["SupportedEngineVersions"].([]interface{}) { + supportedEngineVersionItem := r.(map[string]interface{}) + request["EngineVersion"] = fmt.Sprint(supportedEngineVersionItem["Version"]) + for _, r := range supportedEngineVersionItem["SupportedCategorys"].([]interface{}) { + supportedCategoryItem := r.(map[string]interface{}) + request["Category"] = fmt.Sprint(supportedCategoryItem["Category"]) + for _, r := range supportedCategoryItem["SupportedStorageTypes"].([]interface{}) { + storageTypeItem := r.(map[string]interface{}) + request["DBInstanceStorageType"] = fmt.Sprint(storageTypeItem["StorageType"]) + var response map[string]interface{} + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_db_instance_classes", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.DBInstanceClasses", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.DBInstanceClasses", response) + } + for _, r := range resp.([]interface{}) { + instanceClassItem := r.(map[string]interface{}) + if dbInstanceClassOk && dbInstanceClass != "" && dbInstanceClass != fmt.Sprint(instanceClassItem["DBInstanceClass"]) { + continue + } + mapping := map[string]interface{}{ + "instance_class": fmt.Sprint(instanceClassItem["DBInstanceClass"]), + "zone_ids": zoneIds, + "storage_range": map[string]interface{}{ + "min": fmt.Sprint(instanceClassItem["DBInstanceStorageRange"].(map[string]interface{})["MinValue"]), + "max": fmt.Sprint(instanceClassItem["DBInstanceStorageRange"].(map[string]interface{})["MaxValue"]), + "step": fmt.Sprint(instanceClassItem["DBInstanceStorageRange"].(map[string]interface{})["Step"]), + }, + } + s = append(s, mapping) + ids = append(ids, fmt.Sprint(instanceClassItem["DBInstanceClass"])) + } + } + } + } + } } - sort.SliceStable(infos, func(i, j int) bool { - iPrice, _ := strconv.ParseFloat(infos[i]["price"].(string), 64) - jPrice, _ := strconv.ParseFloat(infos[j]["price"].(string), 64) - return iPrice < jPrice - }) } d.SetId(dataResourceIdHash(ids)) - err = d.Set("instance_classes", infos) + err := d.Set("instance_classes", s) if err != nil { return WrapError(err) } - d.Set("ids", classIds) + d.Set("ids", ids) if output, ok := d.GetOk("output_file"); ok { - err = writeToFile(output.(string), infos) + err = writeToFile(output.(string), s) if err != nil { return WrapError(err) } } return nil } - -func getDBInstanceClassPrice(bssopenapiService BssopenapiService, instanceChargeType string, infos []map[string]interface{}, version string) ([]float64, error) { - client := bssopenapiService.client - var modules interface{} - var productType string - moduleCode := "DBInstanceClass" - var payAsYouGo []bssopenapi.GetPayAsYouGoPriceModuleList - var subsciption []bssopenapi.GetSubscriptionPriceModuleList - for _, info := range infos { - config := fmt.Sprintf("DBInstanceClass:%s,EngineVersion:%s,Region:%s", info["instance_class"], version, client.Region) - if instanceChargeType == string(Postpaid) { - payAsYouGo = append(payAsYouGo, bssopenapi.GetPayAsYouGoPriceModuleList{ - ModuleCode: moduleCode, - Config: config, - PriceType: "Hour", - }) - } else { - subsciption = append(subsciption, bssopenapi.GetSubscriptionPriceModuleList{ - ModuleCode: moduleCode, - Config: config, - }) - } - } - - if len(payAsYouGo) != 0 { - modules = payAsYouGo - productType = "bards" - } else { - modules = subsciption - } - - return bssopenapiService.GetInstanceTypePrice("rds", productType, modules) -} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_db_instance_engines.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_db_instance_engines.go index 4799f62ce68..5ae94866cd1 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_db_instance_engines.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_db_instance_engines.go @@ -1,10 +1,13 @@ package alicloud import ( + "fmt" "strings" "time" - "github.com/aliyun/alibaba-cloud-sdk-go/services/rds" + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" @@ -29,13 +32,24 @@ func dataSourceAlicloudDBInstanceEngines() *schema.Resource { ValidateFunc: validation.StringInSlice([]string{string(PostPaid), string(PrePaid)}, false), }, "engine": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"MySQL", "SQLServer", "PostgreSQL", "PPAS", "MariaDB"}, false), }, "engine_version": { Type: schema.TypeString, Optional: true, }, + "category": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"Basic", "HighAvailability", "AlwaysOn", "Finance"}, false), + }, + "db_instance_storage_type": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"cloud_ssd", "local_ssd", "cloud_essd", "cloud_essd2", "cloud_essd3"}, false), + }, "multi_zone": { Type: schema.TypeBool, Default: false, @@ -45,6 +59,11 @@ func dataSourceAlicloudDBInstanceEngines() *schema.Resource { Type: schema.TypeString, Optional: true, }, + "ids": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, // Computed values. "instance_engines": { Type: schema.TypeList, @@ -90,120 +109,133 @@ func dataSourceAlicloudDBInstanceEngines() *schema.Resource { func dataSourceAlicloudDBInstanceEnginesRead(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) - request := rds.CreateDescribeAvailableResourceRequest() - request.RegionId = client.RegionId - request.ZoneId = d.Get("zone_id").(string) + engines := make([]string, 0) + if v, ok := d.GetOk("engine"); ok && v.(string) != "" { + engines = append(engines, v.(string)) + } else { + engines = []string{"MySQL", "SQLServer", "PostgreSQL", "PPAS", "MariaDB"} + } + + action := "DescribeAvailableZones" + request := map[string]interface{}{ + "RegionId": client.RegionId, + "SourceIp": client.SourceIp, + } + if v, ok := d.GetOk("engine_version"); ok && v.(string) != "" { + request["EngineVersion"] = v.(string) + } + if v, ok := d.GetOk("zone_id"); ok && v.(string) != "" { + request["ZoneId"] = v.(string) + } instanceChargeType := d.Get("instance_charge_type").(string) - multiZone := d.Get("multi_zone").(bool) if instanceChargeType == string(PostPaid) { - instanceChargeType = string(Postpaid) + request["CommodityCode"] = "bards" } else { - instanceChargeType = string(Prepaid) + request["CommodityCode"] = "rds" } - request.InstanceChargeType = instanceChargeType - var response = &rds.DescribeAvailableResourceResponse{} - err := resource.Retry(5*time.Minute, func() *resource.RetryError { - raw, err := client.WithRdsClient(func(rdsClient *rds.Client) (interface{}, error) { - return rdsClient.DescribeAvailableResource(request) - }) - if err != nil { - if IsExpectedErrors(err, []string{Throttling}) { - time.Sleep(time.Duration(5) * time.Second) - return resource.RetryableError(err) - } - return resource.NonRetryableError(err) - } - addDebug(request.GetActionName(), raw, request.RpcRequest, request) - response = raw.(*rds.DescribeAvailableResourceResponse) - return nil - }) - - if err != nil { - return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_db_instance_engines", request.GetActionName(), AlibabaCloudSdkGoERROR) + multiZone := false + if v, ok := d.GetOk("multi_zone"); ok { + multiZone = v.(bool) } - - type engineInfosItem struct { - Index int - Engine string - EngineVersion string - ZoneIds []map[string]interface{} + var targetCategory, targetStorageType string + if v, ok := d.GetOk("category"); ok && v.(string) != "" { + targetCategory = v.(string) } - - engineInfos := make(map[string]engineInfosItem) - indexMap := make(map[string]int) - ids := []string{} - - engine, engineGot := d.GetOk("engine") - engineVersion, engineVersionGot := d.GetOk("engine_version") - - for _, AvailableZone := range response.AvailableZones.AvailableZone { - id_item := []string{} - if multiZone { - if !strings.Contains(AvailableZone.ZoneId, "MAZ") { - continue - } - for _, v := range splitMultiZoneId(AvailableZone.ZoneId) { - id_item = append(id_item, v) - } - } else { - if strings.Contains(AvailableZone.ZoneId, "MAZ") { - continue + if v, ok := d.GetOk("db_instance_storage_type"); ok && v.(string) != "" { + targetStorageType = v.(string) + } + var ids []string + var s []map[string]interface{} + var response map[string]interface{} + conn, err := client.NewRdsClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + for _, engine := range engines { + request["Engine"] = engine + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) } - id_item = []string{AvailableZone.ZoneId} + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_db_instance_engines", action, AlibabaCloudSdkGoERROR) } - - zoneId := map[string]interface{}{ - "id": AvailableZone.ZoneId, - "sub_zone_ids": id_item, + resp, err := jsonpath.Get("$.AvailableZones", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.AvailableZones", response) } - ids = append(ids, AvailableZone.ZoneId) - for _, SupportedEngine := range AvailableZone.SupportedEngines.SupportedEngine { - if engineGot && engine != SupportedEngine.Engine { + for _, r := range resp.([]interface{}) { + availableZoneItem := r.(map[string]interface{}) + + zoneId := fmt.Sprint(availableZoneItem["ZoneId"]) + if (multiZone && !strings.Contains(zoneId, MULTI_IZ_SYMBOL)) || (!multiZone && strings.Contains(zoneId, MULTI_IZ_SYMBOL)) { continue } - ids = append(ids, SupportedEngine.Engine) - for _, SupportedEngineVersion := range SupportedEngine.SupportedEngineVersions.SupportedEngineVersion { - if engineVersionGot && engineVersion != SupportedEngineVersion.Version { - continue - } - ids = append(ids, SupportedEngineVersion.Version) + zoneIds := make([]map[string]interface{}, 0) + zoneIds = append(zoneIds, map[string]interface{}{ + "id": zoneId, + "sub_zone_ids": splitMultiZoneId(zoneId), + }) - for _, SupportedCategory := range SupportedEngineVersion.SupportedCategorys.SupportedCategory { - zoneIds := []map[string]interface{}{} - if _, ok := engineInfos[SupportedCategory.Category]; ok { - zoneIds = append(engineInfos[SupportedCategory.Category].ZoneIds, zoneId) - } else { - zoneIds = []map[string]interface{}{zoneId} - indexMap[SupportedCategory.Category] = len(engineInfos) - } - engineInfos[SupportedCategory.Category] = engineInfosItem{ - Index: indexMap[SupportedCategory.Category], - Engine: SupportedEngine.Engine, - EngineVersion: SupportedEngineVersion.Version, - ZoneIds: zoneIds, + for _, r := range availableZoneItem["SupportedEngines"].([]interface{}) { + supportedEngineItem := r.(map[string]interface{}) + for _, r := range supportedEngineItem["SupportedEngineVersions"].([]interface{}) { + supportedEngineVersionItem := r.(map[string]interface{}) + for _, r := range supportedEngineVersionItem["SupportedCategorys"].([]interface{}) { + supportedCategoryItem := r.(map[string]interface{}) + if targetCategory != "" && targetCategory != fmt.Sprint(supportedCategoryItem["Category"]) { + continue + } + if targetStorageType != "" { + find := false + for _, r := range supportedCategoryItem["SupportedStorageTypes"].([]interface{}) { + supportedStorageTypeItem := r.(map[string]interface{}) + if targetStorageType != fmt.Sprint(supportedStorageTypeItem["StorageType"]) { + continue + } + find = true + break + } + if !find { + continue + } + } + mapping := map[string]interface{}{ + "zone_ids": zoneIds, + "engine": fmt.Sprint(supportedEngineItem["Engine"]), + "engine_version": fmt.Sprint(supportedEngineVersionItem["Version"]), + "category": fmt.Sprint(supportedCategoryItem["Category"]), + } + s = append(s, mapping) + ids = append(ids, fmt.Sprint(supportedEngineItem["Engine"])) + break } } } } } - infos := make([]map[string]interface{}, len(engineInfos)) - for k, v := range engineInfos { - infos[v.Index] = map[string]interface{}{ - "zone_ids": v.ZoneIds, - "engine": v.Engine, - "engine_version": v.EngineVersion, - "category": k, - } - } - d.SetId(dataResourceIdHash(ids)) - err = d.Set("instance_engines", infos) + err = d.Set("instance_engines", s) if err != nil { return WrapError(err) } + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { - err = writeToFile(output.(string), infos) + err = writeToFile(output.(string), s) if err != nil { return WrapError(err) } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_db_instances.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_db_instances.go index cca12715044..3103c5f8054 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_db_instances.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_db_instances.go @@ -2,11 +2,14 @@ package alicloud import ( "encoding/json" + "fmt" "regexp" + "time" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/services/rds" + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" ) @@ -61,6 +64,11 @@ func dataSourceAlicloudDBInstances() *schema.Resource { Type: schema.TypeString, Optional: true, }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, "connection_mode": { Type: schema.TypeString, Optional: true, @@ -86,6 +94,38 @@ func dataSourceAlicloudDBInstances() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ + "parameters": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "force_modify": { + Type: schema.TypeString, + Computed: true, + }, + "checking_code": { + Type: schema.TypeString, + Computed: true, + }, + "parameter_value": { + Type: schema.TypeString, + Computed: true, + }, + "force_restart": { + Type: schema.TypeString, + Computed: true, + }, + "parameter_name": { + Type: schema.TypeString, + Computed: true, + }, + "parameter_description": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, "id": { Type: schema.TypeString, Computed: true, @@ -305,28 +345,47 @@ func dataSourceAlicloudDBInstances() *schema.Resource { func dataSourceAlicloudDBInstancesRead(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) - - request := rds.CreateDescribeDBInstancesRequest() - - request.RegionId = client.RegionId - request.Engine = d.Get("engine").(string) - request.DBInstanceStatus = d.Get("status").(string) - request.DBInstanceType = d.Get("db_type").(string) - request.VpcId = d.Get("vpc_id").(string) - request.VSwitchId = d.Get("vswitch_id").(string) - request.ConnectionMode = d.Get("connection_mode").(string) + action := "DescribeDBInstances" + request := map[string]interface{}{ + "RegionId": client.RegionId, + "SourceIp": client.SourceIp, + "PageSize": PageSizeLarge, + "PageNumber": 1, + } + if v, ok := d.GetOk("engine"); ok && v.(string) != "" { + request["Engine"] = v.(string) + } + if v, ok := d.GetOk("status"); ok && v.(string) != "" { + request["DBInstanceStatus"] = v.(string) + } + if v, ok := d.GetOk("db_type"); ok && v.(string) != "" { + request["DBInstanceType"] = v.(string) + } + if v, ok := d.GetOk("vpc_id"); ok && v.(string) != "" { + request["VpcId"] = v.(string) + } + if v, ok := d.GetOk("vswitch_id"); ok && v.(string) != "" { + request["VSwitchId"] = v.(string) + } + if v, ok := d.GetOk("connection_mode"); ok && v.(string) != "" { + request["ConnectionMode"] = v.(string) + } if v, ok := d.GetOk("tags"); ok { tagsMap := v.(map[string]interface{}) bs, err := json.Marshal(tagsMap) if err != nil { return WrapError(err) } - request.Tags = string(bs) + request["Tags"] = string(bs) + } + + var response map[string]interface{} + conn, err := client.NewRdsClient() + if err != nil { + return WrapError(err) } - request.PageSize = requests.NewInteger(PageSizeLarge) - request.PageNumber = requests.NewInteger(1) - var dbi []rds.DBInstance + var objects []map[string]interface{} var nameRegex *regexp.Regexp if v, ok := d.GetOk("name_regex"); ok { @@ -349,48 +408,52 @@ func dataSourceAlicloudDBInstancesRead(d *schema.ResourceData, meta interface{}) } for { - raw, err := client.WithRdsClient(func(rdsClient *rds.Client) (interface{}, error) { - return rdsClient.DescribeDBInstances(request) + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil }) + addDebug(action, response, request) if err != nil { - return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_db_instances", request.GetActionName(), AlibabaCloudSdkGoERROR) + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_db_instances", action, AlibabaCloudSdkGoERROR) } - addDebug(request.GetActionName(), raw, request.RpcRequest, request) - response, _ := raw.(*rds.DescribeDBInstancesResponse) - if len(response.Items.DBInstance) < 1 { - break + resp, err := jsonpath.Get("$.Items.DBInstance", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Items.DBInstance", response) } - - for _, item := range response.Items.DBInstance { + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) if nameRegex != nil { - if !nameRegex.MatchString(item.DBInstanceDescription) { + if !nameRegex.MatchString(fmt.Sprint(item["DBInstanceDescription"])) { continue } } - if len(idsMap) > 0 { - if _, ok := idsMap[item.DBInstanceId]; !ok { + if _, ok := idsMap[fmt.Sprint(item["DBInstanceId"])]; !ok { continue } } - - dbi = append(dbi, item) + objects = append(objects, item) } - - if len(response.Items.DBInstance) < PageSizeLarge { + if len(result) < PageSizeLarge { break } - - page, err := getNextpageNumber(request.PageNumber) - if err != nil { - return WrapError(err) - } - request.PageNumber = page + request["PageNumber"] = request["PageNumber"].(int) + 1 } - return rdsInstancesDescription(d, meta, dbi) + return rdsInstancesDescription(d, meta, objects) } -func rdsInstancesDescription(d *schema.ResourceData, meta interface{}, dbi []rds.DBInstance) error { +func rdsInstancesDescription(d *schema.ResourceData, meta interface{}, objects []map[string]interface{}) error { client := meta.(*connectivity.AliyunClient) rdsService := RdsService{client} @@ -398,44 +461,44 @@ func rdsInstancesDescription(d *schema.ResourceData, meta interface{}, dbi []rds var names []string var s []map[string]interface{} - for _, item := range dbi { + for _, item := range objects { readOnlyInstanceIDs := []string{} - for _, id := range item.ReadOnlyDBInstanceIds.ReadOnlyDBInstanceId { - readOnlyInstanceIDs = append(readOnlyInstanceIDs, id.DBInstanceId) + for _, id := range item["ReadOnlyDBInstanceIds"].(map[string]interface{})["ReadOnlyDBInstanceId"].([]interface{}) { + readOnlyInstanceIDs = append(readOnlyInstanceIDs, fmt.Sprint(id.(map[string]interface{})["DBInstanceId"])) } - instance, err := rdsService.DescribeDBInstance(item.DBInstanceId) + instance, err := rdsService.DescribeDBInstance(fmt.Sprint(item["DBInstanceId"])) if err != nil { return WrapError(err) } mapping := map[string]interface{}{ - "id": item.DBInstanceId, - "name": item.DBInstanceDescription, - "charge_type": item.PayType, - "db_type": item.DBInstanceType, - "region_id": item.RegionId, - "create_time": item.CreateTime, - "expire_time": item.ExpireTime, - "status": item.DBInstanceStatus, - "engine": item.Engine, - "engine_version": item.EngineVersion, - "net_type": item.DBInstanceNetType, - "connection_mode": item.ConnectionMode, - "instance_type": item.DBInstanceClass, - "availability_zone": item.ZoneId, - "master_instance_id": item.MasterInstanceId, - "guard_instance_id": item.GuardDBInstanceId, - "temp_instance_id": item.TempDBInstanceId, + "id": fmt.Sprint(item["DBInstanceId"]), + "name": fmt.Sprint(item["DBInstanceDescription"]), + "charge_type": fmt.Sprint(item["PayType"]), + "db_type": fmt.Sprint(item["DBInstanceType"]), + "region_id": fmt.Sprint(item["RegionId"]), + "create_time": fmt.Sprint(item["CreateTime"]), + "expire_time": fmt.Sprint(item["ExpireTime"]), + "status": fmt.Sprint(item["DBInstanceStatus"]), + "engine": fmt.Sprint(item["Engine"]), + "engine_version": fmt.Sprint(item["EngineVersion"]), + "net_type": fmt.Sprint(item["DBInstanceNetType"]), + "connection_mode": fmt.Sprint(item["ConnectionMode"]), + "instance_type": fmt.Sprint(item["DBInstanceClass"]), + "availability_zone": fmt.Sprint(item["ZoneId"]), + "master_instance_id": fmt.Sprint(item["MasterInstanceId"]), + "guard_instance_id": fmt.Sprint(item["GuardDBInstanceId"]), + "temp_instance_id": fmt.Sprint(item["TempDBInstanceId"]), "readonly_instance_ids": readOnlyInstanceIDs, - "vpc_id": item.VpcId, - "vswitch_id": item.VSwitchId, + "vpc_id": fmt.Sprint(item["VpcId"]), + "vswitch_id": fmt.Sprint(item["VSwitchId"]), "connection_string": instance["ConnectionString"], "port": instance["Port"], "db_instance_storage_type": instance["DBInstanceStorageType"], "instance_storage": instance["DBInstanceStorage"], "master_zone": instance["MasterZone"], } - sslResponse, sslErr := rdsService.DescribeDBInstanceSSL(item.DBInstanceId) + sslResponse, sslErr := rdsService.DescribeDBInstanceSSL(fmt.Sprint(item["DBInstanceId"])) if sslErr == nil { if v, ok := sslResponse["SSLExpireTime"]; ok && v != "" { mapping["ssl_expire_time"] = sslResponse["SSLExpireTime"] @@ -491,7 +554,7 @@ func rdsInstancesDescription(d *schema.ResourceData, meta interface{}, dbi []rds } - encResponse, encError := rdsService.DescribeDBInstanceEncryptionKey(item.DBInstanceId) + encResponse, encError := rdsService.DescribeDBInstanceEncryptionKey(fmt.Sprint(item["DBInstanceId"])) if encError == nil { if v, ok := encResponse["Creator"]; ok && v != "" { mapping["creator"] = encResponse["Creator"] @@ -527,8 +590,26 @@ func rdsInstancesDescription(d *schema.ResourceData, meta interface{}, dbi []rds mapping["zone_id_slave_a"] = slaveZones[0].(map[string]interface{})["ZoneId"] } - ids = append(ids, item.DBInstanceId) - names = append(names, item.DBInstanceDescription) + if d.Get("enable_details").(bool) { + paramResponse, paramError := rdsService.DescribeParameterTemplates(item["DBInstanceId"].(string), item["Engine"].(string), item["EngineVersion"].(string)) + if paramError == nil { + parameterDetail := make([]map[string]interface{}, 0) + for _, val := range paramResponse { + item := val.(map[string]interface{}) + parameterDetail = append(parameterDetail, map[string]interface{}{ + "force_modify": item["ForceModify"], + "checking_code": item["CheckingCode"], + "parameter_value": item["ParameterValue"], + "force_restart": item["ForceRestart"], + "parameter_name": item["ParameterName"], + "parameter_description": item["ParameterDescription"], + }) + } + mapping["parameters"] = parameterDetail + } + } + ids = append(ids, fmt.Sprint(item["DBInstanceId"])) + names = append(names, fmt.Sprint(item["DBInstanceDescription"])) s = append(s, mapping) } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_db_zones.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_db_zones.go index 78291c47fdc..acf44e8e44c 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_db_zones.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_db_zones.go @@ -6,7 +6,9 @@ import ( "strings" "time" - "github.com/aliyun/alibaba-cloud-sdk-go/services/rds" + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" @@ -23,6 +25,11 @@ func dataSourceAlicloudDBZones() *schema.Resource { Optional: true, Default: false, }, + "multi_zone": { + Type: schema.TypeBool, + Default: false, + Optional: true, + }, "instance_charge_type": { Type: schema.TypeString, Optional: true, @@ -30,6 +37,31 @@ func dataSourceAlicloudDBZones() *schema.Resource { Default: PostPaid, ValidateFunc: validation.StringInSlice([]string{"PrePaid", "PostPaid"}, false), }, + "engine": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"MySQL", "SQLServer", "PostgreSQL", "PPAS", "MariaDB"}, false), + }, + "engine_version": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "db_instance_class": { + Type: schema.TypeString, + Optional: true, + }, + "category": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"Basic", "HighAvailability", "AlwaysOn", "Finance"}, false), + }, + "db_instance_storage_type": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"cloud_ssd", "local_ssd", "cloud_essd", "cloud_essd2", "cloud_essd3"}, false), + }, "output_file": { Type: schema.TypeString, Optional: true, @@ -62,74 +94,131 @@ func dataSourceAlicloudDBZones() *schema.Resource { func dataSourceAlicloudDBZonesRead(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) + engines := make([]string, 0) + if v, ok := d.GetOk("engine"); ok && v.(string) != "" { + engines = append(engines, v.(string)) + } else { + engines = []string{"MySQL", "SQLServer", "PostgreSQL", "PPAS", "MariaDB"} + } - multi := d.Get("multi").(bool) - var zoneIds []string + action := "DescribeAvailableZones" + request := map[string]interface{}{ + "RegionId": client.RegionId, + "SourceIp": client.SourceIp, + } + if v, ok := d.GetOk("engine_version"); ok && v.(string) != "" { + request["EngineVersion"] = v.(string) + } + if v, ok := d.GetOk("zone_id"); ok && v.(string) != "" { + request["ZoneId"] = v.(string) + } instanceChargeType := d.Get("instance_charge_type").(string) - - request := rds.CreateDescribeAvailableResourceRequest() - request.RegionId = client.RegionId if instanceChargeType == string(PostPaid) { - request.InstanceChargeType = string(Postpaid) + request["CommodityCode"] = "bards" } else { - request.InstanceChargeType = string(Prepaid) + request["CommodityCode"] = "rds" + } + multiZone := false + if v, ok := d.GetOkExists("multi_zone"); ok { + multiZone = v.(bool) + } else if v, ok := d.GetOkExists("multi"); ok { + multiZone = v.(bool) + } + var targetCategory, targetStorageType string + if v, ok := d.GetOk("category"); ok && v.(string) != "" { + targetCategory = v.(string) + } + if v, ok := d.GetOk("db_instance_storage_type"); ok && v.(string) != "" { + targetStorageType = v.(string) } - var response = &rds.DescribeAvailableResourceResponse{} - err := resource.Retry(5*time.Minute, func() *resource.RetryError { - raw, err := client.WithRdsClient(func(rdsClient *rds.Client) (i interface{}, err error) { - return rdsClient.DescribeAvailableResource(request) + var ids []string + var s []map[string]interface{} + var response map[string]interface{} + conn, err := client.NewRdsClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + for _, engine := range engines { + request["Engine"] = engine + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil }) + addDebug(action, response, request) if err != nil { - if IsExpectedErrors(err, []string{Throttling}) { - time.Sleep(time.Duration(3) * time.Second) - return resource.RetryableError(err) - } - return resource.NonRetryableError(err) + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_db_zones", action, AlibabaCloudSdkGoERROR) } - addDebug(request.GetActionName(), raw, request.RpcRequest, request) - response = raw.(*rds.DescribeAvailableResourceResponse) - return nil - }) - if err != nil { - return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_db_zones", request.GetActionName(), AlibabaCloudSdkGoERROR) - } - if len(response.AvailableZones.AvailableZone) <= 0 { - return WrapError(fmt.Errorf("[ERROR] There is no available zone for RDS.")) - } - for _, r := range response.AvailableZones.AvailableZone { - if multi && strings.Contains(r.ZoneId, MULTI_IZ_SYMBOL) && r.RegionId == string(client.Region) { - zoneIds = append(zoneIds, r.ZoneId) - continue + resp, err := jsonpath.Get("$.AvailableZones", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.AvailableZones", response) } - if !multi && !strings.Contains(r.ZoneId, MULTI_IZ_SYMBOL) && r.RegionId == string(client.Region) { - zoneIds = append(zoneIds, r.ZoneId) + + for _, r := range resp.([]interface{}) { + availableZoneItem := r.(map[string]interface{}) + + zoneId := fmt.Sprint(availableZoneItem["ZoneId"]) + if (multiZone && !strings.Contains(zoneId, MULTI_IZ_SYMBOL)) || (!multiZone && strings.Contains(zoneId, MULTI_IZ_SYMBOL)) { + continue + } + + if targetCategory == "" && targetStorageType == "" { + ids = append(ids, zoneId) + continue + } + for _, r := range availableZoneItem["SupportedEngines"].([]interface{}) { + supportedEngineItem := r.(map[string]interface{}) + for _, r := range supportedEngineItem["SupportedEngineVersions"].([]interface{}) { + supportedEngineVersionItem := r.(map[string]interface{}) + for _, r := range supportedEngineVersionItem["SupportedCategorys"].([]interface{}) { + supportedCategoryItem := r.(map[string]interface{}) + if targetCategory != "" && targetCategory != fmt.Sprint(supportedCategoryItem["Category"]) { + continue + } + if targetStorageType == "" { + ids = append(ids, zoneId) + goto NEXT + } + for _, r := range supportedCategoryItem["SupportedStorageTypes"].([]interface{}) { + supportedStorageTypeItem := r.(map[string]interface{}) + if targetStorageType != fmt.Sprint(supportedStorageTypeItem["StorageType"]) { + continue + } + ids = append(ids, zoneId) + goto NEXT + } + } + } + } + NEXT: continue } } - if len(zoneIds) > 0 { - sort.Strings(zoneIds) + if len(ids) > 0 { + sort.Strings(ids) } - var s []map[string]interface{} - if !multi { - for _, zoneId := range zoneIds { - mapping := map[string]interface{}{"id": zoneId} - s = append(s, mapping) - } - } else { - for _, zoneId := range zoneIds { - mapping := map[string]interface{}{ - "id": zoneId, - "multi_zone_ids": splitMultiZoneId(zoneId), - } - s = append(s, mapping) + for _, zoneId := range ids { + mapping := map[string]interface{}{ + "id": zoneId, + "multi_zone_ids": splitMultiZoneId(zoneId), } + s = append(s, mapping) } - d.SetId(dataResourceIdHash(zoneIds)) + d.SetId(dataResourceIdHash(ids)) if err := d.Set("zones", s); err != nil { return WrapError(err) } - if err := d.Set("ids", zoneIds); err != nil { + if err := d.Set("ids", ids); err != nil { return WrapError(err) } if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_dbfs_instances.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_dbfs_instances.go new file mode 100644 index 00000000000..4e760cffabd --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_dbfs_instances.go @@ -0,0 +1,269 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudDbfsInstances() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudDbfsInstancesRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"attached", "unattached", "attaching", "creating", "deleted", "deleting", "detaching", "resizing", "snapshotting", "upgrading"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "instances": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "attach_node_number": { + Type: schema.TypeInt, + Computed: true, + }, + "category": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "dbfs_cluster_id": { + Type: schema.TypeString, + Computed: true, + }, + "ecs_list": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "ecs_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "enable_raid": { + Type: schema.TypeBool, + Computed: true, + }, + "encryption": { + Type: schema.TypeBool, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "instance_name": { + Type: schema.TypeString, + Computed: true, + }, + "kms_key_id": { + Type: schema.TypeString, + Computed: true, + }, + "payment_type": { + Type: schema.TypeString, + Computed: true, + }, + "performance_level": { + Type: schema.TypeString, + Computed: true, + }, + "raid_stripe_unit_number": { + Type: schema.TypeString, + Computed: true, + }, + "size": { + Type: schema.TypeInt, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "zone_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudDbfsInstancesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListDbfs" + request := make(map[string]interface{}) + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + var instanceNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + instanceNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewDbfsClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-04-18"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_dbfs_instances", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.DBFSInfo", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.DBFSInfo", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if instanceNameRegex != nil && !instanceNameRegex.MatchString(fmt.Sprint(item["FsName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["FsId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["Status"].(string) { + continue + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "attach_node_number": formatInt(object["AttachNodeNumber"]), + "category": object["Category"], + "create_time": object["CreatedTime"], + "dbfs_cluster_id": object["DBFSClusterId"], + "enable_raid": object["EnableRaid"], + "encryption": object["Encryption"], + "id": fmt.Sprint(object["FsId"]), + "instance_id": fmt.Sprint(object["FsId"]), + "instance_name": object["FsName"], + "kms_key_id": object["KMSKeyId"], + "payment_type": convertDbfsInstancePaymentTypeResponse(fmt.Sprint(object["PayType"])), + "performance_level": object["PerformanceLevel"], + "raid_stripe_unit_number": fmt.Sprint(object["RaidStrip"]), + "size": formatInt(object["SizeG"]), + "status": object["Status"], + "zone_id": object["ZoneId"], + } + + ecsList := make([]map[string]interface{}, 0) + if ecsListList, ok := object["EcsList"].([]interface{}); ok { + for _, v := range ecsListList { + if m1, ok := v.(map[string]interface{}); ok { + temp1 := map[string]interface{}{ + "ecs_id": m1["EcsId"], + } + ecsList = append(ecsList, temp1) + } + } + } + mapping["ecs_list"] = ecsList + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["FsName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("instances", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ddoscoo_instances.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ddoscoo_instances.go index 056d86bac16..8f2ac5630c9 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ddoscoo_instances.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ddoscoo_instances.go @@ -69,6 +69,42 @@ func dataSourceAlicloudDdoscooInstances() *schema.Resource { Type: schema.TypeInt, Computed: true, }, + "remark": { + Type: schema.TypeString, + Computed: true, + }, + "ip_mode": { + Type: schema.TypeString, + Computed: true, + }, + "debt_status": { + Type: schema.TypeInt, + Computed: true, + }, + "edition": { + Type: schema.TypeInt, + Computed: true, + }, + "ip_version": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeInt, + Computed: true, + }, + "enabled": { + Type: schema.TypeInt, + Computed: true, + }, + "expire_time": { + Type: schema.TypeInt, + Computed: true, + }, + "create_time": { + Type: schema.TypeInt, + Computed: true, + }, }, }, }, @@ -144,7 +180,7 @@ func dataSourceAlicloudDdoscooInstancesRead(d *schema.ResourceData, meta interfa } if len(instanceIds) < 1 { - return WrapError(extractDdoscooInstance(d, nameMap, []ddoscoo.InstanceSpec{})) + return WrapError(extractDdoscooInstance(d, nameMap, []ddoscoo.InstanceSpec{}, instances)) } specReq := ddoscoo.CreateDescribeInstanceSpecsRequest() @@ -161,15 +197,15 @@ func dataSourceAlicloudDdoscooInstancesRead(d *schema.ResourceData, meta interfa addDebug(specReq.GetActionName(), raw, specReq.RpcRequest, specReq) response, _ := raw.(*ddoscoo.DescribeInstanceSpecsResponse) - return WrapError(extractDdoscooInstance(d, nameMap, response.InstanceSpecs)) + return WrapError(extractDdoscooInstance(d, nameMap, response.InstanceSpecs, instances)) } -func extractDdoscooInstance(d *schema.ResourceData, nameMap map[string]string, instanceSpecs []ddoscoo.InstanceSpec) error { +func extractDdoscooInstance(d *schema.ResourceData, nameMap map[string]string, instanceSpecs []ddoscoo.InstanceSpec, instance []ddoscoo.Instance) error { var instanceIds []string var names []string var s []map[string]interface{} - for _, item := range instanceSpecs { + for i, item := range instanceSpecs { mapping := map[string]interface{}{ "id": item.InstanceId, "name": nameMap[item.InstanceId], @@ -178,6 +214,15 @@ func extractDdoscooInstance(d *schema.ResourceData, nameMap map[string]string, i "service_bandwidth": item.BandwidthMbps, "port_count": item.PortLimit, "domain_count": item.DomainLimit, + "remark": instance[i].Remark, + "ip_mode": instance[i].IpMode, + "debt_status": instance[i].DebtStatus, + "edition": instance[i].Edition, + "ip_version": instance[i].IpVersion, + "status": instance[i].Status, + "enabled": instance[i].Enabled, + "expire_time": instance[i].ExpireTime, + "create_time": instance[i].CreateTime, } instanceIds = append(instanceIds, item.InstanceId) names = append(names, nameMap[item.InstanceId]) diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_dfs_access_groups.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_dfs_access_groups.go new file mode 100644 index 00000000000..8bc41072309 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_dfs_access_groups.go @@ -0,0 +1,221 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudDfsAccessGroups() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudDfsAccessGroupsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "limit": { + Type: schema.TypeInt, + Optional: true, + ForceNew: true, + }, + "order_by": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"CreateTime", "AccessGroupName"}, false), + }, + "order_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"ASC", "DESC"}, false), + }, + "start_offset": { + Type: schema.TypeInt, + Optional: true, + ForceNew: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "groups": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, + "access_group_id": { + Type: schema.TypeString, + Computed: true, + }, + "access_group_name": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "mount_point_count": { + Type: schema.TypeInt, + Computed: true, + }, + "network_type": { + Type: schema.TypeString, + Computed: true, + }, + "rule_count": { + Type: schema.TypeInt, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudDfsAccessGroupsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListAccessGroups" + request := make(map[string]interface{}) + if v, ok := d.GetOk("limit"); ok { + request["Limit"] = v + } + if v, ok := d.GetOk("order_by"); ok { + request["OrderBy"] = v + } + if v, ok := d.GetOk("order_type"); ok { + request["OrderType"] = v + } + request["InputRegionId"] = client.RegionId + if v, ok := d.GetOk("start_offset"); ok { + request["StartOffset"] = v + } + var objects []map[string]interface{} + var accessGroupNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + accessGroupNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewAlidfsClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-06-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_dfs_access_groups", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.AccessGroups", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.AccessGroups", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if accessGroupNameRegex != nil && !accessGroupNameRegex.MatchString(fmt.Sprint(item["AccessGroupName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["AccessGroupId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "id": fmt.Sprint(object["AccessGroupId"]), + "access_group_id": fmt.Sprint(object["AccessGroupId"]), + "access_group_name": object["AccessGroupName"], + "create_time": object["CreateTime"], + "description": object["Description"], + "mount_point_count": formatInt(object["MountPointCount"]), + "network_type": object["NetworkType"], + "rule_count": formatInt(object["RuleCount"]), + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["AccessGroupName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("groups", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_dfs_access_rules.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_dfs_access_rules.go new file mode 100644 index 00000000000..76a315bdc76 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_dfs_access_rules.go @@ -0,0 +1,163 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudDfsAccessRules() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudDfsAccessRulesRead, + Schema: map[string]*schema.Schema{ + "access_group_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "rules": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "access_group_id": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "access_rule_id": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "network_segment": { + Type: schema.TypeString, + Computed: true, + }, + "priority": { + Type: schema.TypeInt, + Computed: true, + }, + "rw_access_type": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudDfsAccessRulesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListAccessRules" + request := make(map[string]interface{}) + request["AccessGroupId"] = d.Get("access_group_id") + request["InputRegionId"] = client.RegionId + + var objects []map[string]interface{} + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewAlidfsClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-06-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_dfs_access_rules", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.AccessRules", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.AccessRules", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["AccessGroupId"], ":", item["AccessRuleId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "access_group_id": object["AccessGroupId"], + "id": fmt.Sprint(object["AccessGroupId"], ":", object["AccessRuleId"]), + "access_rule_id": fmt.Sprint(object["AccessRuleId"]), + "create_time": object["CreateTime"], + "description": object["Description"], + "network_segment": object["NetworkSegment"], + "priority": formatInt(object["Priority"]), + "rw_access_type": object["RWAccessType"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("rules", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_dfs_file_systems.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_dfs_file_systems.go new file mode 100644 index 00000000000..8afa28c1c4d --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_dfs_file_systems.go @@ -0,0 +1,227 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudDfsFileSystems() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudDfsFileSystemsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "systems": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "file_system_id": { + Type: schema.TypeString, + Computed: true, + }, + "file_system_name": { + Type: schema.TypeString, + Computed: true, + }, + "mount_point_count": { + Type: schema.TypeInt, + Computed: true, + }, + "number_of_directories": { + Type: schema.TypeInt, + Computed: true, + }, + "number_of_files": { + Type: schema.TypeInt, + Computed: true, + }, + "protocol_type": { + Type: schema.TypeString, + Computed: true, + }, + "provisioned_throughput_in_mi_bps": { + Type: schema.TypeInt, + Computed: true, + }, + "space_capacity": { + Type: schema.TypeInt, + Computed: true, + }, + "storage_package_id": { + Type: schema.TypeString, + Computed: true, + }, + "storage_type": { + Type: schema.TypeString, + Computed: true, + }, + "throughput_mode": { + Type: schema.TypeString, + Computed: true, + }, + "used_space_size": { + Type: schema.TypeFloat, + Computed: true, + }, + "zone_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudDfsFileSystemsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListFileSystems" + request := make(map[string]interface{}) + request["InputRegionId"] = client.RegionId + var objects []map[string]interface{} + var fileSystemNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + fileSystemNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewAlidfsClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-06-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_dfs_file_systems", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.FileSystems", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.FileSystems", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if fileSystemNameRegex != nil && !fileSystemNameRegex.MatchString(fmt.Sprint(item["FileSystemName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["FileSystemId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "create_time": object["CreateTime"], + "description": object["Description"], + "id": fmt.Sprint(object["FileSystemId"]), + "file_system_id": fmt.Sprint(object["FileSystemId"]), + "file_system_name": object["FileSystemName"], + "mount_point_count": object["MountPointCount"], + "number_of_directories": object["NumberOfDirectories"], + "number_of_files": object["NumberOfFiles"], + "protocol_type": object["ProtocolType"], + "provisioned_throughput_in_mi_bps": object["ProvisionedThroughputInMiBps"], + "space_capacity": object["SpaceCapacity"], + "storage_package_id": object["StoragePackageId"], + "storage_type": object["StorageType"], + "throughput_mode": object["ThroughputMode"], + "used_space_size": object["UsedSpaceSize"], + "zone_id": object["ZoneId"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["FileSystemName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("systems", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_dfs_mount_points.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_dfs_mount_points.go new file mode 100644 index 00000000000..587e5c3ab01 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_dfs_mount_points.go @@ -0,0 +1,189 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudDfsMountPoints() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudDfsMountPointsRead, + Schema: map[string]*schema.Schema{ + "file_system_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Active", "Inactive"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "points": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "access_group_id": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "file_system_id": { + Type: schema.TypeString, + Computed: true, + }, + "mount_point_domain": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "mount_point_id": { + Type: schema.TypeString, + Computed: true, + }, + "network_type": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "vswitch_id": { + Type: schema.TypeString, + Computed: true, + }, + "vpc_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudDfsMountPointsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListMountPoints" + request := make(map[string]interface{}) + request["FileSystemId"] = d.Get("file_system_id") + request["InputRegionId"] = client.RegionId + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewAlidfsClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-06-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_dfs_mount_points", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.MountPoints", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.MountPoints", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["FileSystemId"], ":", item["MountPointId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["Status"].(string) { + continue + } + objects = append(objects, item) + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "access_group_id": object["AccessGroupId"], + "create_time": object["CreateTime"], + "description": object["Description"], + "file_system_id": object["FileSystemId"], + "mount_point_domain": object["MountPointDomain"], + "id": fmt.Sprint(object["FileSystemId"], ":", object["MountPointId"]), + "mount_point_id": fmt.Sprint(object["MountPointId"]), + "network_type": object["NetworkType"], + "status": object["Status"], + "vswitch_id": object["VSwitchId"], + "vpc_id": object["VpcId"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("points", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_dfs_zones.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_dfs_zones.go new file mode 100644 index 00000000000..6a1d2e303fe --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_dfs_zones.go @@ -0,0 +1,120 @@ +package alicloud + +import ( + "fmt" + "strconv" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudDfsZones() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudDfsZonesRead, + Schema: map[string]*schema.Schema{ + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "zones": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "zone_id": { + Type: schema.TypeString, + Computed: true, + }, + "options": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "storage_type": { + Type: schema.TypeString, + Computed: true, + }, + "protocol_type": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudDfsZonesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "GetRegion" + request := make(map[string]interface{}) + request["InputRegionId"] = client.RegionId + + var response map[string]interface{} + conn, err := client.NewAlidfsClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-06-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_dfs_zones", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.AvailableZones", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.AvailableZones", response) + } + + s := make([]map[string]interface{}, 0) + for _, object := range resp.([]interface{}) { + if zoneMap, ok := object.(map[string]interface{}); ok { + + mapping := map[string]interface{}{ + "zone_id": fmt.Sprint(zoneMap["ZoneId"]), + } + + options := make([]interface{}, 0) + for _, optionArg := range zoneMap["Options"].([]interface{}) { + optionMap := optionArg.(map[string]interface{}) + singleObj := make(map[string]interface{}, 0) + singleObj["storage_type"] = fmt.Sprint(optionMap["StorageType"]) + singleObj["protocol_type"] = fmt.Sprint(optionMap["ProtocolType"]) + options = append(options, singleObj) + } + mapping["options"] = options + + s = append(s, mapping) + } + } + + d.SetId(strconv.FormatInt(time.Now().Unix(), 16)) + if err := d.Set("zones", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_direct_mail_domains.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_direct_mail_domains.go new file mode 100644 index 00000000000..d0be7467896 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_direct_mail_domains.go @@ -0,0 +1,288 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudDirectMailDomains() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudDirectMailDomainsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "key_word": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(4, 50), + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"0", "1", "2", "3", "4"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "domains": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "cname_auth_status": { + Type: schema.TypeString, + Computed: true, + }, + "cname_confirm_status": { + Type: schema.TypeString, + Computed: true, + }, + "cname_record": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "default_domain": { + Type: schema.TypeString, + Computed: true, + }, + "dns_mx": { + Type: schema.TypeString, + Computed: true, + }, + "dns_spf": { + Type: schema.TypeString, + Computed: true, + }, + "dns_txt": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "domain_id": { + Type: schema.TypeString, + Computed: true, + }, + "domain_name": { + Type: schema.TypeString, + Computed: true, + }, + "domain_type": { + Type: schema.TypeString, + Computed: true, + }, + "icp_status": { + Type: schema.TypeString, + Computed: true, + }, + "mx_auth_status": { + Type: schema.TypeString, + Computed: true, + }, + "mx_record": { + Type: schema.TypeString, + Computed: true, + }, + "spf_auth_status": { + Type: schema.TypeString, + Computed: true, + }, + "spf_record": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "tl_domain_name": { + Type: schema.TypeString, + Computed: true, + }, + "tracef_record": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudDirectMailDomainsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "QueryDomainByParam" + request := make(map[string]interface{}) + request["PageSize"] = PageSizeLarge + request["PageNo"] = 1 + if v, ok := d.GetOk("key_word"); ok { + request["KeyWord"] = v + } + if v, ok := d.GetOk("status"); ok { + request["Status"] = v + } + var objects []map[string]interface{} + var domainNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + domainNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewDmClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-11-23"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_direct_mail_domains", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.data.domain", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.data.domain", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if domainNameRegex != nil && !domainNameRegex.MatchString(fmt.Sprint(item["DomainName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["DomainId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNo"] = request["PageNo"].(int) + 1 + } + + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "cname_auth_status": object["CnameAuthStatus"], + "create_time": object["CreateTime"], + "id": fmt.Sprint(object["DomainId"]), + "domain_id": fmt.Sprint(object["DomainId"]), + "domain_name": object["DomainName"], + "icp_status": object["IcpStatus"], + "mx_auth_status": object["MxAuthStatus"], + "spf_auth_status": object["SpfAuthStatus"], + "status": object["DomainStatus"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["DomainName"]) + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + s = append(s, mapping) + continue + } + id := fmt.Sprint(object["DomainId"]) + dmService := DmService{client} + getResp, err := dmService.DescribeDirectMailDomain(id) + if err != nil { + return WrapError(err) + } + mapping["cname_confirm_status"] = getResp["CnameConfirmStatus"] + mapping["cname_record"] = getResp["CnameRecord"] + mapping["default_domain"] = getResp["DefaultDomain"] + mapping["dns_mx"] = getResp["DnsMx"] + mapping["dns_spf"] = getResp["DnsSpf"] + mapping["dns_txt"] = getResp["DnsTxt"] + mapping["domain_type"] = getResp["DomainType"] + mapping["mx_record"] = getResp["MxRecord"] + mapping["spf_record"] = getResp["SpfRecord"] + mapping["tl_domain_name"] = getResp["TlDomainName"] + mapping["tracef_record"] = getResp["TracefRecord"] + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("domains", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_direct_mail_mail_addresses.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_direct_mail_mail_addresses.go new file mode 100644 index 00000000000..eb52ee1a6ff --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_direct_mail_mail_addresses.go @@ -0,0 +1,210 @@ +package alicloud + +import ( + "encoding/json" + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudDirectMailMailAddresses() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudDirectMailMailAddressesRead, + Schema: map[string]*schema.Schema{ + "key_word": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "sendtype": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"batch", "trigger"}, false), + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"0", "1"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "addresses": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "account_name": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "daily_count": { + Type: schema.TypeString, + Computed: true, + }, + "daily_req_count": { + Type: schema.TypeString, + Computed: true, + }, + "domain_status": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "mail_address_id": { + Type: schema.TypeString, + Computed: true, + }, + "month_count": { + Type: schema.TypeString, + Computed: true, + }, + "month_req_count": { + Type: schema.TypeString, + Computed: true, + }, + "reply_address": { + Type: schema.TypeString, + Computed: true, + }, + "reply_status": { + Type: schema.TypeString, + Computed: true, + }, + "sendtype": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudDirectMailMailAddressesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "QueryMailAddressByParam" + request := make(map[string]interface{}) + if v, ok := d.GetOk("key_word"); ok { + request["KeyWord"] = v + } + if v, ok := d.GetOk("sendtype"); ok { + request["Sendtype"] = v + } + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewDmClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-11-23"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_direct_mail_mail_addresses", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.data.mailAddress", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.data.mailAddress", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["MailAddressId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != string(item["AccountStatus"].(json.Number)) { + continue + } + objects = append(objects, item) + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "account_name": object["AccountName"], + "create_time": object["CreateTime"], + "daily_count": object["DailyCount"], + "daily_req_count": object["DailyReqCount"], + "domain_status": object["DomainStatus"], + "id": fmt.Sprint(object["MailAddressId"]), + "mail_address_id": fmt.Sprint(object["MailAddressId"]), + "month_count": object["MonthCount"], + "month_req_count": object["MonthReqCount"], + "reply_address": object["ReplyAddress"], + "reply_status": object["ReplyStatus"], + "sendtype": object["Sendtype"], + "status": object["AccountStatus"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("addresses", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_direct_mail_tags.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_direct_mail_tags.go new file mode 100644 index 00000000000..eb54242b75c --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_direct_mail_tags.go @@ -0,0 +1,169 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudDirectMailTags() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudDirectMailTagsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "tags": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, + "tag_id": { + Type: schema.TypeString, + Computed: true, + }, + "tag_name": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudDirectMailTagsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "QueryTagByParam" + request := make(map[string]interface{}) + request["PageSize"] = PageSizeLarge + request["PageNo"] = 1 + var objects []map[string]interface{} + var tagNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + tagNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewDmClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-11-23"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_direct_mail_tags", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.data.tag", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.data.tag", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if tagNameRegex != nil && !tagNameRegex.MatchString(fmt.Sprint(item["TagName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["TagId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNo"] = request["PageNo"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "id": fmt.Sprint(object["TagId"]), + "tag_id": fmt.Sprint(object["TagId"]), + "tag_name": object["TagName"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["TagName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("tags", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_dts_consumer_channels.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_dts_consumer_channels.go new file mode 100644 index 00000000000..88767749376 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_dts_consumer_channels.go @@ -0,0 +1,169 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudDtsConsumerChannels() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudDtsConsumerChannelsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "dts_instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "channels": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, + "consumer_group_id": { + Type: schema.TypeString, + Computed: true, + }, + "consumer_group_name": { + Type: schema.TypeString, + Computed: true, + }, + "consumer_group_user_name": { + Type: schema.TypeString, + Computed: true, + }, + "consumption_checkpoint": { + Type: schema.TypeString, + Computed: true, + }, + "message_delay": { + Type: schema.TypeInt, + Computed: true, + }, + "unconsumed_data": { + Type: schema.TypeInt, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudDtsConsumerChannelsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeConsumerChannel" + request := make(map[string]interface{}) + request["DtsInstanceId"] = d.Get("dts_instance_id") + request["RegionId"] = client.RegionId + request["PageSize"] = PageSizeMedium + request["PageNumber"] = 1 + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewDtsClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + + if NeedRetry(err) { + + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_dts_consumer_channels", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.ConsumerChannels", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.ConsumerChannels", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(request["DtsInstanceId"], ":", item["ConsumerGroupId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "id": fmt.Sprint(request["DtsInstanceId"], ":", object["ConsumerGroupId"]), + "consumer_group_id": fmt.Sprint(object["ConsumerGroupId"]), + "consumer_group_name": object["ConsumerGroupName"], + "consumer_group_user_name": object["ConsumerGroupUserName"], + "consumption_checkpoint": fmt.Sprint(object["ConsumptionCheckpoint"]), + "message_delay": formatInt(object["MessageDelay"]), + "unconsumed_data": formatInt(object["UnconsumedData"]), + } + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("channels", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_dts_subscription_jobs.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_dts_subscription_jobs.go new file mode 100644 index 00000000000..c92396dd197 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_dts_subscription_jobs.go @@ -0,0 +1,378 @@ +package alicloud + +import ( + "encoding/json" + "fmt" + "regexp" + "strings" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudDtsSubscriptionJobs() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudDtsSubscriptionJobsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Abnormal", "Downgrade", "Locked", "Normal", "NotConfigured", "NotStarted", "PreCheckPass", "PrecheckFailed", "Prechecking", "Retrying", "Starting", "Upgrade"}, false), + }, + "tags": tagsSchema(), + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "jobs": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "checkpoint": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "db_list": { + Type: schema.TypeString, + Computed: true, + }, + "dts_instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "dts_job_id": { + Type: schema.TypeString, + Computed: true, + }, + "dts_job_name": { + Type: schema.TypeString, + Computed: true, + }, + "expire_time": { + Type: schema.TypeString, + Computed: true, + }, + "payment_type": { + Type: schema.TypeString, + Computed: true, + }, + "source_endpoint_database_name": { + Type: schema.TypeString, + Computed: true, + }, + "source_endpoint_engine_name": { + Type: schema.TypeString, + Computed: true, + }, + "source_endpoint_ip": { + Type: schema.TypeString, + Computed: true, + }, + "source_endpoint_instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "source_endpoint_instance_type": { + Type: schema.TypeString, + Computed: true, + }, + "source_endpoint_oracle_sid": { + Type: schema.TypeString, + Computed: true, + }, + "source_endpoint_owner_id": { + Type: schema.TypeString, + Computed: true, + }, + "source_endpoint_port": { + Type: schema.TypeString, + Computed: true, + }, + "source_endpoint_region": { + Type: schema.TypeString, + Computed: true, + }, + "source_endpoint_role": { + Type: schema.TypeString, + Computed: true, + }, + "source_endpoint_user_name": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "subscription_data_type_ddl": { + Type: schema.TypeBool, + Computed: true, + }, + "subscription_data_type_dml": { + Type: schema.TypeBool, + Computed: true, + }, + "subscription_host": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "private_host": { + Type: schema.TypeString, + Computed: true, + }, + "public_host": { + Type: schema.TypeString, + Computed: true, + }, + "vpc_host": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "subscription_instance_network_type": { + Type: schema.TypeString, + Computed: true, + }, + "subscription_instance_vpc_id": { + Type: schema.TypeString, + Computed: true, + }, + "subscription_instance_vswitch_id": { + Type: schema.TypeString, + Computed: true, + }, + "tags": { + Type: schema.TypeMap, + Computed: true, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudDtsSubscriptionJobsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeDtsJobs" + request := make(map[string]interface{}) + request["JobType"] = "SUBSCRIBE" + request["RegionId"] = client.RegionId + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + var jobNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + jobNameRegex = r + } + + idsMap := make(map[string]string) + names := make([]interface{}, 0) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + tagsMap := make(map[string]interface{}) + if v, ok := d.GetOk("tags"); ok && len(v.(map[string]interface{})) > 0 { + tagsMap = v.(map[string]interface{}) + } + var response map[string]interface{} + conn, err := client.NewDtsClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_dts_subscription_jobs", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.DtsJobList", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.DtsJobList", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if item["Status"] == "Starting" { + item["Status"] = "Normal" + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["DtsJobId"])]; !ok { + continue + } + } + if len(tagsMap) > 0 { + if len(item["Tags"].(map[string]interface{})["Tag"].([]interface{})) != len(tagsMap) { + continue + } + match := true + for _, tag := range item["Tags"].([]interface{}) { + if v, ok := tagsMap[tag.(map[string]interface{})["TagKey"].(string)]; !ok || v.(string) != tag.(map[string]interface{})["TagValue"].(string) { + match = false + break + } + } + if !match { + continue + } + } + if jobNameRegex != nil && !jobNameRegex.MatchString(fmt.Sprint(item["DtsJobName"])) { + continue + } + if statusOk && status.(string) != "" && status.(string) != item["Status"].(string) { + continue + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "checkpoint": object["Checkpoint"], + "create_time": object["CreateTime"], + "db_list": object["DbObject"], + "dts_instance_id": object["DtsInstanceID"], + "id": fmt.Sprint(object["DtsJobId"]), + "dts_job_id": fmt.Sprint(object["DtsJobId"]), + "dts_job_name": object["DtsJobName"], + "expire_time": object["ExpireTime"], + "payment_type": convertDtsPaymentTypeResponse(object["PayType"]), + "source_endpoint_database_name": object["SourceEndpoint"].(map[string]interface{})["DatabaseName"], + "source_endpoint_engine_name": object["SourceEndpoint"].(map[string]interface{})["EngineName"], + "source_endpoint_ip": object["SourceEndpoint"].(map[string]interface{})["Ip"], + "source_endpoint_instance_id": object["SourceEndpoint"].(map[string]interface{})["InstanceID"], + "source_endpoint_instance_type": object["SourceEndpoint"].(map[string]interface{})["InstanceType"], + "source_endpoint_oracle_sid": object["SourceEndpoint"].(map[string]interface{})["OracleSID"], + "source_endpoint_port": object["SourceEndpoint"].(map[string]interface{})["Port"], + "source_endpoint_region": object["SourceEndpoint"].(map[string]interface{})["Region"], + "source_endpoint_user_name": object["SourceEndpoint"].(map[string]interface{})["UserName"], + "status": object["Status"], + } + + var jsonData map[string]interface{} + json.Unmarshal([]byte(object["Reserved"].(string)), &jsonData) + if v, ok := jsonData["netType"].(string); ok { + mapping["subscription_instance_network_type"] = strings.ToLower(v) + } + mapping["subscription_instance_vpc_id"] = jsonData["vpcId"] + mapping["subscription_instance_vswitch_id"] = jsonData["vswitchId"] + + tags := make(map[string]interface{}) + t, _ := jsonpath.Get("$.TagList", object) + if t != nil { + for _, t := range t.([]interface{}) { + key := t.(map[string]interface{})["TagKey"].(string) + value := t.(map[string]interface{})["TagValue"].(string) + if !ignoredTags(key, value) { + tags[key] = value + } + } + } + mapping["tags"] = tags + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["Name"]) + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + s = append(s, mapping) + continue + } + id := fmt.Sprint(object["DtsJobId"]) + dtsService := DtsService{client} + getResp, err := dtsService.DescribeDtsSubscriptionJob(id) + if err != nil { + return WrapError(err) + } + mapping["source_endpoint_owner_id"] = getResp["SourceEndpoint"].(map[string]interface{})["AliyunUid"] + mapping["source_endpoint_role"] = getResp["SourceEndpoint"].(map[string]interface{})["RoleName"] + mapping["subscription_data_type_ddl"] = getResp["SubscriptionDataType"].(map[string]interface{})["Ddl"] + mapping["subscription_data_type_dml"] = getResp["SubscriptionDataType"].(map[string]interface{})["Dml"] + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("jobs", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_dts_synchronization_jobs.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_dts_synchronization_jobs.go new file mode 100644 index 00000000000..eb660edec85 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_dts_synchronization_jobs.go @@ -0,0 +1,349 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudDtsSynchronizationJobs() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudDtsSynchronizationJobsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Downgrade", "Failed", "Finished", "InitializeFailed", "Initializing", "Locked", "Modifying", "NotConfigured", "NotStarted", "PreCheckPass", "PrecheckFailed", "Prechecking", "Retrying", "Suspending", "Synchronizing", "Upgrade"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "jobs": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "checkpoint": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "data_initialization": { + Type: schema.TypeBool, + Computed: true, + }, + "data_synchronization": { + Type: schema.TypeBool, + Computed: true, + }, + "db_list": { + Type: schema.TypeString, + Computed: true, + }, + "destination_endpoint_data_base_name": { + Type: schema.TypeString, + Computed: true, + }, + "destination_endpoint_engine_name": { + Type: schema.TypeString, + Computed: true, + }, + "destination_endpoint_ip": { + Type: schema.TypeString, + Computed: true, + }, + "destination_endpoint_instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "destination_endpoint_instance_type": { + Type: schema.TypeString, + Computed: true, + }, + "destination_endpoint_oracle_sid": { + Type: schema.TypeString, + Computed: true, + }, + "destination_endpoint_port": { + Type: schema.TypeString, + Computed: true, + }, + "destination_endpoint_region": { + Type: schema.TypeString, + Computed: true, + }, + "destination_endpoint_user_name": { + Type: schema.TypeString, + Computed: true, + }, + "dts_instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "dts_job_id": { + Type: schema.TypeString, + Computed: true, + }, + "dts_job_name": { + Type: schema.TypeString, + Computed: true, + }, + "expire_time": { + Type: schema.TypeString, + Computed: true, + }, + "source_endpoint_database_name": { + Type: schema.TypeString, + Computed: true, + }, + "source_endpoint_engine_name": { + Type: schema.TypeString, + Computed: true, + }, + "source_endpoint_ip": { + Type: schema.TypeString, + Computed: true, + }, + "source_endpoint_instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "source_endpoint_instance_type": { + Type: schema.TypeString, + Computed: true, + }, + "source_endpoint_oracle_sid": { + Type: schema.TypeString, + Computed: true, + }, + "source_endpoint_owner_id": { + Type: schema.TypeString, + Computed: true, + }, + "source_endpoint_port": { + Type: schema.TypeString, + Computed: true, + }, + "source_endpoint_region": { + Type: schema.TypeString, + Computed: true, + }, + "source_endpoint_role": { + Type: schema.TypeString, + Computed: true, + }, + "source_endpoint_user_name": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "structure_initialization": { + Type: schema.TypeBool, + Computed: true, + }, + "synchronization_direction": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudDtsSynchronizationJobsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeDtsJobs" + request := make(map[string]interface{}) + request["JobType"] = "SYNC" + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("status"); ok { + request["Status"] = v + } + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + var jobNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + jobNameRegex = r + } + status, statusOk := d.GetOk("status") + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewDtsClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_dts_synchronization_jobs", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.DtsJobList", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.DtsJobList", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + // see comment on function DescribeDtsSynchronizationJob + if item["Status"] == "synchronizing" || item["Status"] == "Initializing" { + item["Status"] = "Synchronizing" + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["DtsJobId"])]; !ok { + continue + } + } + if jobNameRegex != nil && !jobNameRegex.MatchString(fmt.Sprint(item["DtsJobName"])) { + continue + } + if statusOk && status.(string) != "" && status.(string) != item["Status"].(string) { + continue + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + migrationModeObj := object["MigrationMode"].(map[string]interface{}) + destinationEndpointObj := object["DestinationEndpoint"].(map[string]interface{}) + sourceEndpointObj := object["SourceEndpoint"].(map[string]interface{}) + mapping := map[string]interface{}{ + "checkpoint": object["Checkpoint"], + "create_time": object["CreateTime"], + "data_initialization": migrationModeObj["DataInitialization"], + "data_synchronization": migrationModeObj["DataSynchronization"], + "structure_initialization": migrationModeObj["StructureInitialization"], + "db_list": object["DbObject"], + "destination_endpoint_data_base_name": destinationEndpointObj["DatabaseName"], + "destination_endpoint_engine_name": destinationEndpointObj["EngineName"], + "destination_endpoint_ip": destinationEndpointObj["Ip"], + "destination_endpoint_instance_id": destinationEndpointObj["InstanceID"], + "destination_endpoint_instance_type": destinationEndpointObj["InstanceType"], + "destination_endpoint_oracle_sid": destinationEndpointObj["OracleSID"], + "destination_endpoint_port": destinationEndpointObj["Port"], + "destination_endpoint_region": destinationEndpointObj["Region"], + "destination_endpoint_user_name": destinationEndpointObj["UserName"], + "dts_instance_id": object["DtsInstanceID"], + "id": fmt.Sprint(object["DtsJobId"]), + "dts_job_id": fmt.Sprint(object["DtsJobId"]), + "dts_job_name": object["DtsJobName"], + "expire_time": object["ExpireTime"], + "source_endpoint_database_name": object["ReverseJob"].(map[string]interface{})["SourceEndpoint"].(map[string]interface{})["DatabaseName"], + "source_endpoint_engine_name": sourceEndpointObj["EngineName"], + "source_endpoint_ip": sourceEndpointObj["Ip"], + "source_endpoint_instance_id": sourceEndpointObj["InstanceID"], + "source_endpoint_instance_type": sourceEndpointObj["InstanceType"], + "source_endpoint_oracle_sid": sourceEndpointObj["OracleSID"], + "source_endpoint_port": sourceEndpointObj["Port"], + "source_endpoint_region": sourceEndpointObj["Region"], + "source_endpoint_user_name": sourceEndpointObj["UserName"], + "status": object["Status"], + "synchronization_direction": object["DtsJobDirection"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + s = append(s, mapping) + continue + } + id := fmt.Sprint(object["DtsJobId"]) + dtsService := DtsService{client} + getResp, err := dtsService.DescribeDtsSynchronizationJob(id) + if err != nil { + return WrapError(err) + } + mapping["source_endpoint_owner_id"] = getResp["SourceEndpoint"].(map[string]interface{})["AliyunUid"] + mapping["source_endpoint_role"] = getResp["SourceEndpoint"].(map[string]interface{})["RoleName"] + if err != nil { + return WrapError(err) + } + + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("jobs", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_eais_instances.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_eais_instances.go new file mode 100644 index 00000000000..038327f05d8 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_eais_instances.go @@ -0,0 +1,218 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudEaisInstances() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudEaisInstancesRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "instance_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"eais.ei-a6.4xlarge", "eais.ei-a6.2xlarge", "eais.ei-a6.xlarge", "eais.ei-a6.large", "eais.ei-a6.medium"}, false), + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Attaching", "Available", "Detaching", "InUse", "Starting", "Unavailable"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "instances": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "client_instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "client_instance_name": { + Type: schema.TypeString, + Computed: true, + }, + "client_instance_type": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "instance_name": { + Type: schema.TypeString, + Computed: true, + }, + "instance_type": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "zone_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudEaisInstancesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeEais" + request := make(map[string]interface{}) + if v, ok := d.GetOk("instance_type"); ok { + request["InstanceType"] = v + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("status"); ok { + request["Status"] = v + } + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + var instanceNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + instanceNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewEaisClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-24"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_eais_instances", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Instances.Instance", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Instances.Instance", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if instanceNameRegex != nil && !instanceNameRegex.MatchString(fmt.Sprint(item["InstanceName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["ElasticAcceleratedInstanceId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "client_instance_id": object["ClientInstanceId"], + "client_instance_name": object["ClientInstanceName"], + "client_instance_type": object["ClientInstanceType"], + "id": fmt.Sprint(object["ElasticAcceleratedInstanceId"]), + "instance_id": fmt.Sprint(object["ElasticAcceleratedInstanceId"]), + "instance_name": object["InstanceName"], + "instance_type": object["InstanceType"], + "status": object["Status"], + "zone_id": object["ZoneId"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["InstanceName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("instances", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecd_bundles.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecd_bundles.go new file mode 100644 index 00000000000..c200f7c1ce2 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecd_bundles.go @@ -0,0 +1,281 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudEcdBundles() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudEcdBundlesRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "bundle_id": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "bundle_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"SYSTEM", "CUSTOM"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "bundles": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, + "bundle_id": { + Type: schema.TypeString, + Computed: true, + }, + "bundle_name": { + Type: schema.TypeString, + Computed: true, + }, + "bundle_type": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "desktop_type": { + Type: schema.TypeString, + Computed: true, + }, + "desktop_type_attribute": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "cpu_count": { + Type: schema.TypeInt, + Computed: true, + }, + "gpu_count": { + Type: schema.TypeString, + Computed: true, + }, + "gpu_spec": { + Type: schema.TypeString, + Computed: true, + }, + "memory_size": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "disks": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "disk_size": { + Type: schema.TypeString, + Computed: true, + }, + "disk_type": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "image_id": { + Type: schema.TypeString, + Computed: true, + }, + "os_type": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudEcdBundlesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeBundles" + request := make(map[string]interface{}) + if v, ok := d.GetOk("bundle_id"); ok { + request["BundleId"] = v + } + if v, ok := d.GetOk("bundle_type"); ok { + request["BundleType"] = v + } + + request["RegionId"] = client.RegionId + request["MaxResults"] = PageSizeLarge + var objects []map[string]interface{} + var bundleNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + bundleNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewGwsecdClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_ecd_bundles", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Bundles", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Bundles", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if bundleNameRegex != nil && !bundleNameRegex.MatchString(fmt.Sprint(item["BundleName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["BundleId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "id": fmt.Sprint(object["BundleId"]), + "bundle_id": fmt.Sprint(object["BundleId"]), + "bundle_name": object["BundleName"], + "bundle_type": object["BundleType"], + "description": object["Description"], + "desktop_type": object["DesktopType"], + "image_id": object["ImageId"], + "os_type": object["OsType"], + } + + disks := make([]map[string]interface{}, 0) + if disksList, ok := object["Disks"].([]interface{}); ok { + for _, v := range disksList { + if m1, ok := v.(map[string]interface{}); ok { + temp1 := map[string]interface{}{ + "disk_size": m1["DiskSize"], + "disk_type": m1["DiskType"], + } + disks = append(disks, temp1) + } + } + } + mapping["disks"] = disks + + desktopTypeAttributeSli := make([]map[string]interface{}, 0) + if len(object["DesktopTypeAttribute"].(map[string]interface{})) > 0 { + desktopTypeAttribute := object["DesktopTypeAttribute"] + desktopTypeAttributeMap := make(map[string]interface{}) + desktopTypeAttributeMap["cpu_count"] = desktopTypeAttribute.(map[string]interface{})["CpuCount"] + desktopTypeAttributeMap["gpu_count"] = desktopTypeAttribute.(map[string]interface{})["GpuCount"] + desktopTypeAttributeMap["gpu_spec"] = desktopTypeAttribute.(map[string]interface{})["GpuSpec"] + desktopTypeAttributeMap["memory_size"] = desktopTypeAttribute.(map[string]interface{})["MemorySize"] + desktopTypeAttributeSli = append(desktopTypeAttributeSli, desktopTypeAttributeMap) + } + mapping["desktop_type_attribute"] = desktopTypeAttributeSli + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["BundleName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("bundles", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecd_commands.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecd_commands.go new file mode 100644 index 00000000000..3e152518263 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecd_commands.go @@ -0,0 +1,270 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudEcdCommands() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudEcdCommandsRead, + Schema: map[string]*schema.Schema{ + "command_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"RunBatScript", "RunPowerShellScript"}, false), + }, + "content_encoding": { + Type: schema.TypeString, + Optional: true, + Default: "PlainText", + ValidateFunc: validation.StringInSlice([]string{"Base64", "PlainText"}, false), + }, + "desktop_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Pending", "Failed", "PartialFailed", "Running", "Stopped", "Stopping", "Finished", "Success"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "commands": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "command_content": { + Type: schema.TypeString, + Computed: true, + }, + "command_type": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "invoke_desktops": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "desktop_id": { + Type: schema.TypeString, + Computed: true, + }, + "dropped": { + Type: schema.TypeInt, + Computed: true, + }, + "error_code": { + Type: schema.TypeString, + Computed: true, + }, + "error_info": { + Type: schema.TypeString, + Computed: true, + }, + "exit_code": { + Type: schema.TypeString, + Computed: true, + }, + "finish_time": { + Type: schema.TypeString, + Computed: true, + }, + "invocation_status": { + Type: schema.TypeString, + Computed: true, + }, + "output": { + Type: schema.TypeString, + Computed: true, + }, + "repeats": { + Type: schema.TypeInt, + Computed: true, + }, + "start_time": { + Type: schema.TypeString, + Computed: true, + }, + "stop_time": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "invoke_id": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudEcdCommandsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeInvocations" + request := make(map[string]interface{}) + if v, ok := d.GetOk("command_type"); ok { + request["CommandType"] = v + } + if v, ok := d.GetOk("content_encoding"); ok { + request["ContentEncoding"] = v + } + + if v, ok := d.GetOk("desktop_id"); ok { + request["DesktopId"] = v + } + + request["IncludeOutput"] = "true" + + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("status"); ok { + request["InvokeStatus"] = v + } + request["MaxResults"] = PageSizeLarge + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewGwsecdClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_ecd_commands", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Invocations", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Invocations", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["InvokeId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "command_content": object["CommandContent"], + "command_type": object["CommandType"], + "create_time": object["CreationTime"], + "id": fmt.Sprint(object["InvokeId"]), + "invoke_id": fmt.Sprint(object["InvokeId"]), + "status": object["InvocationStatus"], + } + + invokeDesktops := make([]map[string]interface{}, 0) + if invokeDesktopsList, ok := object["InvokeDesktops"].([]interface{}); ok { + for _, v := range invokeDesktopsList { + if m1, ok := v.(map[string]interface{}); ok { + temp1 := map[string]interface{}{ + "desktop_id": m1["DesktopId"], + "dropped": formatInt(m1["Dropped"]), + "error_code": m1["ErrorCode"], + "error_info": m1["ErrorInfo"], + "exit_code": m1["ExitCode"], + "finish_time": m1["FinishTime"], + "invocation_status": m1["InvocationStatus"], + "output": m1["Output"], + "repeats": formatInt(m1["Repeats"]), + "start_time": m1["StartTime"], + "stop_time": m1["StopTime"], + } + invokeDesktops = append(invokeDesktops, temp1) + } + } + } + mapping["invoke_desktops"] = invokeDesktops + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("commands", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecd_desktops.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecd_desktops.go new file mode 100644 index 00000000000..6354d1e8804 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecd_desktops.go @@ -0,0 +1,283 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudEcdDesktops() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudEcdDesktopsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "desktop_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "office_site_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "policy_group_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "end_user_ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Deleted", "Expired", "Pending", "Running", "Starting", "Stopped", "Stopping"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "desktops": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "cpu": { + Type: schema.TypeInt, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "desktop_id": { + Type: schema.TypeString, + Computed: true, + }, + "desktop_name": { + Type: schema.TypeString, + Computed: true, + }, + "desktop_type": { + Type: schema.TypeString, + Computed: true, + }, + "directory_id": { + Type: schema.TypeString, + Computed: true, + }, + "end_user_ids": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "expired_time": { + Type: schema.TypeString, + Computed: true, + }, + "image_id": { + Type: schema.TypeString, + Computed: true, + }, + "memory": { + Type: schema.TypeString, + Computed: true, + }, + "network_interface_id": { + Type: schema.TypeString, + Computed: true, + }, + "payment_type": { + Type: schema.TypeString, + Computed: true, + }, + "policy_group_id": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "system_disk_size": { + Type: schema.TypeInt, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudEcdDesktopsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeDesktops" + request := make(map[string]interface{}) + if v, ok := d.GetOk("desktop_name"); ok { + request["DesktopName"] = v + } + if v, ok := d.GetOk("office_site_id"); ok { + request["OfficeSiteId"] = v + } + + if v, ok := d.GetOk("policy_group_id"); ok { + request["PolicyGroupId"] = v + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("status"); ok { + request["DesktopStatus"] = v + } + if m, ok := d.GetOk("end_user_ids"); ok { + for k, v := range m.([]interface{}) { + request[fmt.Sprintf("EndUserId.%d", k+1)] = v.(string) + } + } + request["MaxResults"] = PageSizeLarge + var objects []map[string]interface{} + var desktopNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + desktopNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewGwsecdClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_ecd_desktops", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Desktops", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Desktops", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if desktopNameRegex != nil && !desktopNameRegex.MatchString(fmt.Sprint(item["DesktopName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["DesktopId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "cpu": formatInt(object["Cpu"]), + "create_time": object["CreationTime"], + "id": fmt.Sprint(object["DesktopId"]), + "desktop_id": fmt.Sprint(object["DesktopId"]), + "desktop_name": object["DesktopName"], + "desktop_type": object["DesktopType"], + "directory_id": object["DirectoryId"], + "expired_time": object["ExpiredTime"], + "end_user_ids": object["EndUserIds"], + "image_id": object["ImageId"], + "memory": fmt.Sprint(object["Memory"]), + "network_interface_id": object["NetworkInterfaceId"], + "payment_type": convertEcdDesktopPaymentTypeResponse(object["ChargeType"]), + "policy_group_id": object["PolicyGroupId"], + "status": object["DesktopStatus"], + "system_disk_size": formatInt(object["SystemDiskSize"]), + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["DesktopName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("desktops", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecd_images.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecd_images.go new file mode 100644 index 00000000000..6e23d6ed5fe --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecd_images.go @@ -0,0 +1,234 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudEcdImages() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudEcdImagesRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "image_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"CUSTOM", "SYSTEM"}, false), + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Available", "CreateFailed", "Creating"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "images": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "data_disk_size": { + Type: schema.TypeInt, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "gpu_category": { + Type: schema.TypeBool, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "image_id": { + Type: schema.TypeString, + Computed: true, + }, + "image_name": { + Type: schema.TypeString, + Computed: true, + }, + "image_type": { + Type: schema.TypeString, + Computed: true, + }, + "os_type": { + Type: schema.TypeString, + Computed: true, + }, + "progress": { + Type: schema.TypeString, + Computed: true, + }, + "size": { + Type: schema.TypeInt, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudEcdImagesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeImages" + request := make(map[string]interface{}) + + if v, ok := d.GetOk("image_type"); ok { + request["ImageType"] = v + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("status"); ok { + request["ImageStatus"] = v + } + request["MaxResults"] = PageSizeLarge + var objects []map[string]interface{} + var imageNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + imageNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewGwsecdClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_ecd_images", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Images", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Images", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if imageNameRegex != nil && !imageNameRegex.MatchString(fmt.Sprint(item["Name"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["ImageId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "create_time": object["CreationTime"], + "data_disk_size": formatInt(object["DataDiskSize"]), + "description": object["Description"], + "gpu_category": object["GpuCategory"], + "id": fmt.Sprint(object["ImageId"]), + "image_id": fmt.Sprint(object["ImageId"]), + "image_name": object["Name"], + "image_type": object["ImageType"], + "os_type": object["OsType"], + "progress": object["Progress"], + "size": formatInt(object["Size"]), + "status": object["Status"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["Name"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("images", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecd_nas_file_systems.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecd_nas_file_systems.go new file mode 100644 index 00000000000..0adb46b8ee8 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecd_nas_file_systems.go @@ -0,0 +1,253 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudEcdNasFileSystems() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudEcdNasFileSystemsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "office_site_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Deleted", "Deleting", "Invalid", "Pending", "Running", "Stopped"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "systems": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "capacity": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "file_system_id": { + Type: schema.TypeString, + Computed: true, + }, + "file_system_type": { + Type: schema.TypeString, + Computed: true, + }, + "metered_size": { + Type: schema.TypeString, + Computed: true, + }, + "mount_target_domain": { + Type: schema.TypeString, + Computed: true, + }, + "mount_target_status": { + Type: schema.TypeString, + Computed: true, + }, + "nas_file_system_name": { + Type: schema.TypeString, + Computed: true, + }, + "office_site_id": { + Type: schema.TypeString, + Computed: true, + }, + "office_site_name": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "storage_type": { + Type: schema.TypeString, + Computed: true, + }, + "support_acl": { + Type: schema.TypeBool, + Computed: true, + }, + "zone_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudEcdNasFileSystemsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeNASFileSystems" + request := make(map[string]interface{}) + if v, ok := d.GetOk("office_site_id"); ok { + request["OfficeSiteId"] = v + } + request["RegionId"] = client.RegionId + request["MaxResults"] = PageSizeLarge + var objects []map[string]interface{} + var nasFileSystemNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + nasFileSystemNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewGwsecdClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_ecd_nas_file_systems", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.FileSystems", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.FileSystems", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if nasFileSystemNameRegex != nil && !nasFileSystemNameRegex.MatchString(fmt.Sprint(item["FileSystemName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["FileSystemId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["FileSystemStatus"].(string) { + continue + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "capacity": fmt.Sprint(object["Capacity"]), + "create_time": object["CreateTime"], + "description": object["Description"], + "id": fmt.Sprint(object["FileSystemId"]), + "file_system_id": fmt.Sprint(object["FileSystemId"]), + "file_system_type": object["FileSystemType"], + "metered_size": fmt.Sprint(object["MeteredSize"]), + "mount_target_domain": object["MountTargetDomain"], + "mount_target_status": object["MountTargetStatus"], + "nas_file_system_name": object["FileSystemName"], + "office_site_id": object["OfficeSiteId"], + "office_site_name": object["OfficeSiteName"], + "status": object["FileSystemStatus"], + "storage_type": object["StorageType"], + "support_acl": object["SupportAcl"], + "zone_id": object["ZoneId"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["FileSystemName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("systems", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecd_network_packages.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecd_network_packages.go new file mode 100644 index 00000000000..16489c3bc0d --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecd_network_packages.go @@ -0,0 +1,181 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudEcdNetworkPackages() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudEcdNetworkPackagesRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Creating", "InUse", "Released", "Releasing"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "packages": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "bandwidth": { + Type: schema.TypeInt, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "expired_time": { + Type: schema.TypeString, + Computed: true, + }, + "internet_charge_type": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "network_package_id": { + Type: schema.TypeString, + Computed: true, + }, + "office_site_id": { + Type: schema.TypeString, + Computed: true, + }, + "office_site_name": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudEcdNetworkPackagesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeNetworkPackages" + request := make(map[string]interface{}) + request["RegionId"] = client.RegionId + request["MaxResults"] = PageSizeLarge + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewGwsecdClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_ecd_network_packages", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.NetworkPackages", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.NetworkPackages", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["NetworkPackageId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["NetworkPackageStatus"].(string) { + continue + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "bandwidth": formatInt(object["Bandwidth"]), + "create_time": object["CreateTime"], + "expired_time": object["ExpiredTime"], + "internet_charge_type": object["InternetChargeType"], + "id": fmt.Sprint(object["NetworkPackageId"]), + "network_package_id": fmt.Sprint(object["NetworkPackageId"]), + "office_site_id": object["OfficeSiteId"], + "office_site_name": object["OfficeSiteName"], + "status": object["NetworkPackageStatus"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("packages", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecd_simple_office_sites.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecd_simple_office_sites.go new file mode 100644 index 00000000000..28694b3e333 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecd_simple_office_sites.go @@ -0,0 +1,324 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudEcdSimpleOfficeSites() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudEcdSimpleOfficeSitesRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"REGISTERED", "REGISTERING"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "sites": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "bandwidth": { + Type: schema.TypeInt, + Computed: true, + Deprecated: "Field 'bandwidth' has been deprecated from provider version 1.142.0.", + }, + "cen_id": { + Type: schema.TypeString, + Computed: true, + }, + "cidr_block": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "custom_security_group_id": { + Type: schema.TypeString, + Computed: true, + }, + "desktop_access_type": { + Type: schema.TypeString, + Computed: true, + }, + "desktop_vpc_endpoint": { + Type: schema.TypeString, + Computed: true, + }, + "dns_address": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "dns_user_name": { + Type: schema.TypeString, + Computed: true, + }, + "domain_name": { + Type: schema.TypeString, + Computed: true, + }, + "domain_password": { + Type: schema.TypeString, + Computed: true, + }, + "domain_user_name": { + Type: schema.TypeString, + Computed: true, + }, + "enable_admin_access": { + Type: schema.TypeBool, + Computed: true, + }, + "enable_cross_desktop_access": { + Type: schema.TypeBool, + Computed: true, + }, + "enable_internet_access": { + Type: schema.TypeBool, + Computed: true, + Deprecated: "Field 'enable_internet_access' has been deprecated from provider version 1.142.0.", + }, + "file_system_ids": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "mfa_enabled": { + Type: schema.TypeBool, + Computed: true, + }, + "network_package_id": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "office_site_id": { + Type: schema.TypeString, + Computed: true, + }, + "office_site_type": { + Type: schema.TypeString, + Computed: true, + }, + "simple_office_site_name": { + Type: schema.TypeString, + Computed: true, + }, + "sso_enabled": { + Type: schema.TypeBool, + Computed: true, + }, + "sso_status": { + Type: schema.TypeBool, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "sub_dns_address": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "sub_domain_name": { + Type: schema.TypeString, + Computed: true, + }, + "trust_password": { + Type: schema.TypeString, + Computed: true, + }, + "vswitch_ids": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "vpc_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudEcdSimpleOfficeSitesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeOfficeSites" + request := make(map[string]interface{}) + request["RegionId"] = client.RegionId + request["MaxResults"] = PageSizeLarge + var objects []map[string]interface{} + var simpleOfficeSiteNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + simpleOfficeSiteNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewGwsecdClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_ecd_simple_office_sites", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.OfficeSites", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.OfficeSites", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if simpleOfficeSiteNameRegex != nil && !simpleOfficeSiteNameRegex.MatchString(fmt.Sprint(item["Name"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["OfficeSiteId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["Status"].(string) { + continue + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + // todo: bandwidth depends on network_package resource, you can find it in alicloud_ecd_network_packages + //"bandwidth": formatInt(object["Bandwidth"]), + //"enable_internet_access": object["EnableInternetAccess"], + "cen_id": object["CenId"], + "cidr_block": object["CidrBlock"], + "create_time": object["CreationTime"], + "custom_security_group_id": object["CustomSecurityGroupId"], + "desktop_access_type": convertDesktopAccessType(object["DesktopAccessType"].(string)), + "desktop_vpc_endpoint": object["DesktopVpcEndpoint"], + "dns_address": object["DnsAddress"], + "dns_user_name": object["DnsUserName"], + "domain_name": object["DomainName"], + "domain_password": object["DomainPassword"], + "domain_user_name": object["DomainUserName"], + "enable_admin_access": object["EnableAdminAccess"], + "enable_cross_desktop_access": object["EnableCrossDesktopAccess"], + "enable_internet_access": object["EnableInternetAccess"], + "file_system_ids": object["FileSystemIds"], + "mfa_enabled": object["MfaEnabled"], + "network_package_id": object["NetworkPackageId"], + "id": object["OfficeSiteId"], + "office_site_id": object["OfficeSiteId"], + "office_site_type": object["OfficeSiteType"], + "simple_office_site_name": object["Name"], + "sso_enabled": object["SsoEnabled"], + "sso_status": response["SsoStatus"], + "status": object["Status"], + "sub_dns_address": object["SubDnsAddress"], + "sub_domain_name": object["SubDomainName"], + "trust_password": object["TrustPassword"], + "vswitch_ids": object["VSwitchIds"], + "vpc_id": object["VpcId"], + } + + ids = append(ids, fmt.Sprint(object["OfficeSiteId"])) + names = append(names, object["Name"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("sites", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecd_users.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecd_users.go new file mode 100644 index 00000000000..6ea96f3b910 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecd_users.go @@ -0,0 +1,168 @@ +package alicloud + +import ( + "fmt" + "strconv" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudEcdUsers() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudEcdUsersRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Unlocked", "Locked"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "users": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "email": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "end_user_id": { + Type: schema.TypeString, + Computed: true, + }, + "phone": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudEcdUsersRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeUsers" + request := make(map[string]interface{}) + request["MaxResults"] = PageSizeLarge + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + if statusOk { + status = convertEcdUserStatusRequest(status.(string)) + } + var response map[string]interface{} + conn, err := client.NewEdsuserClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-03-08"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + if IsExpectedErrors(err, []string{"Forbidden"}) { + conn.Endpoint = String(connectivity.EcdOpenAPIEndpointUser) + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_ecd_users", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Users", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Users", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["EndUserId"])]; !ok { + continue + } + } + if statusOk && status != "" && status != strconv.Itoa(formatInt(item["Status"])) { + continue + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "email": object["Email"], + "id": fmt.Sprint(object["Id"]), + "end_user_id": fmt.Sprint(object["EndUserId"]), + "phone": object["Phone"], + "status": convertEcdUserStatusResponse(strconv.Itoa(formatInt(object["Status"]))), + } + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("users", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_eci_virtual_nodes.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_eci_virtual_nodes.go new file mode 100644 index 00000000000..a4367ce0077 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_eci_virtual_nodes.go @@ -0,0 +1,355 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudEciVirtualNodes() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudEciVirtualNodesRead, + Schema: map[string]*schema.Schema{ + "resource_group_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "security_group_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Cleaned", "Failed", "Pending", "Ready"}, false), + }, + "tags": tagsSchema(), + "vswitch_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "virtual_node_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "nodes": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "cpu": { + Type: schema.TypeInt, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "eni_instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "events": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "count": { + Type: schema.TypeInt, + Computed: true, + }, + "first_timestamp": { + Type: schema.TypeString, + Computed: true, + }, + "last_timestamp": { + Type: schema.TypeString, + Computed: true, + }, + "message": { + Type: schema.TypeString, + Computed: true, + }, + "name": { + Type: schema.TypeString, + Computed: true, + }, + "reason": { + Type: schema.TypeString, + Computed: true, + }, + "type": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "internet_ip": { + Type: schema.TypeString, + Computed: true, + }, + "intranet_ip": { + Type: schema.TypeString, + Computed: true, + }, + "memory": { + Type: schema.TypeInt, + Computed: true, + }, + "ram_role_name": { + Type: schema.TypeString, + Computed: true, + }, + "resource_group_id": { + Type: schema.TypeString, + Computed: true, + }, + "security_group_id": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "tags": { + Type: schema.TypeMap, + Computed: true, + }, + "vswitch_id": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "virtual_node_id": { + Type: schema.TypeString, + Computed: true, + }, + "virtual_node_name": { + Type: schema.TypeString, + Computed: true, + }, + "vpc_id": { + Type: schema.TypeString, + Computed: true, + }, + "zone_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudEciVirtualNodesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeVirtualNodes" + request := make(map[string]interface{}) + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("resource_group_id"); ok { + request["ResourceGroupId"] = v + } + if v, ok := d.GetOk("security_group_id"); ok { + request["SecurityGroupId"] = v + } + if v, ok := d.GetOk("vswitch_id"); ok { + request["VSwitchId"] = v + } + if v, ok := d.GetOk("virtual_node_name"); ok { + request["VirtualNodeName"] = v + } + if v, ok := d.GetOk("status"); ok { + request["Status"] = v + } + var objects []map[string]interface{} + var virtualNodeNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + virtualNodeNameRegex = r + } + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + if v, ok := d.GetOk("tags"); ok { + index := 1 + for key, value := range v.(map[string]interface{}) { + request[fmt.Sprintf("Tag.%d.Key", index)] = key + request[fmt.Sprintf("Tag.%d.Value", index)] = value.(string) + index = index + 1 + } + } + var response map[string]interface{} + conn, err := client.NewEciClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-08-08"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_eci_virtual_nodes", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.VirtualNodes", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.VirtualNodes", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if virtualNodeNameRegex != nil && !virtualNodeNameRegex.MatchString(fmt.Sprint(item["VirtualNodeName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["VirtualNodeId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "cpu": formatInt(object["Cpu"]), + "create_time": object["CreationTime"], + "eni_instance_id": object["EniInstanceId"], + "internet_ip": object["InternetIp"], + "intranet_ip": object["IntranetIp"], + "memory": formatInt(object["Memory"]), + "ram_role_name": object["RamRoleName"], + "resource_group_id": object["ResourceGroupId"], + "security_group_id": object["SecurityGroupId"], + "status": object["Status"], + "vswitch_id": object["VSwitchId"], + "id": fmt.Sprint(object["VirtualNodeId"]), + "virtual_node_id": fmt.Sprint(object["VirtualNodeId"]), + "virtual_node_name": object["VirtualNodeName"], + "vpc_id": object["VpcId"], + "zone_id": object["ZoneId"], + } + + events := make([]map[string]interface{}, 0) + if eventsList, ok := object["Events"].([]interface{}); ok { + for _, v := range eventsList { + if m1, ok := v.(map[string]interface{}); ok { + temp1 := map[string]interface{}{ + "count": formatInt(m1["Count"]), + "first_timestamp": m1["FirstTimestamp"], + "last_timestamp": m1["LastTimestamp"], + "message": m1["Message"], + "name": m1["Name"], + "reason": m1["Reason"], + "type": m1["Type"], + } + events = append(events, temp1) + } + } + } + mapping["events"] = events + + tags := make(map[string]interface{}) + t, _ := jsonpath.Get("$.Tags", object) + if t != nil { + for _, t := range t.([]interface{}) { + key := t.(map[string]interface{})["Key"].(string) + value := t.(map[string]interface{})["Value"].(string) + if !ignoredTags(key, value) { + tags[key] = value + } + } + } + mapping["tags"] = tags + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["VirtualNodeName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("nodes", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_eci_zones.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_eci_zones.go new file mode 100644 index 00000000000..60cf6a034c9 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_eci_zones.go @@ -0,0 +1,94 @@ +package alicloud + +import ( + "sort" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudEciZones() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudEciZonesRead, + Schema: map[string]*schema.Schema{ + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "zones": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "zone_ids": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "region_endpoint": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudEciZonesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DescribeRegions" + request := make(map[string]interface{}) + request["RegionId"] = client.RegionId + var objects []map[string]interface{} + zoneIds := make([]string, 0) + var response map[string]interface{} + conn, err := client.NewEciClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-08-08"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_eci_zones", action, AlibabaCloudSdkGoERROR) + } + addDebug(action, response, request) + + resp, err := jsonpath.Get("$.Regions", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Regions", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + objects = append(objects, item) + } + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "zone_ids": object["RecommendZones"], + "region_endpoint": object["RegionEndpoint"], + } + + if v, ok := mapping["zone_ids"].([]string); ok { + zoneIds = append(zoneIds, v...) + } + s = append(s, mapping) + } + if len(zoneIds) > 0 { + sort.Strings(zoneIds) + } + d.SetId(dataResourceIdHash(zoneIds)) + if err := d.Set("zones", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecs_dedicated_host_clusters.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecs_dedicated_host_clusters.go new file mode 100644 index 00000000000..4dac752d79b --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecs_dedicated_host_clusters.go @@ -0,0 +1,331 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudEcsDedicatedHostClusters() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudEcsDedicatedHostClustersRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "dedicated_host_cluster_ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "dedicated_host_cluster_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "zone_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "tags": tagsSchema(), + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "clusters": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, + "dedicated_host_cluster_id": { + Type: schema.TypeString, + Computed: true, + }, + "dedicated_host_cluster_name": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "resource_group_id": { + Type: schema.TypeString, + Computed: true, + }, + "tags": { + Type: schema.TypeMap, + Computed: true, + }, + "zone_id": { + Type: schema.TypeString, + Computed: true, + }, + "dedicated_host_ids": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "dedicated_host_cluster_capacity": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "total_memory": { + Type: schema.TypeInt, + Computed: true, + }, + "available_memory": { + Type: schema.TypeInt, + Computed: true, + }, + "available_vcpus": { + Type: schema.TypeInt, + Computed: true, + }, + "total_vcpus": { + Type: schema.TypeInt, + Computed: true, + }, + "local_storage_capacities": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "available_disk": { + Type: schema.TypeInt, + Computed: true, + }, + "data_disk_category": { + Type: schema.TypeString, + Computed: true, + }, + "total_disk": { + Type: schema.TypeInt, + Computed: true, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudEcsDedicatedHostClustersRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeDedicatedHostClusters" + request := make(map[string]interface{}) + if v, ok := d.GetOk("dedicated_host_cluster_ids"); ok { + request["DedicatedHostClusterIds"] = convertListToJsonString(v.([]interface{})) + } + if v, ok := d.GetOk("dedicated_host_cluster_name"); ok { + request["DedicatedHostClusterName"] = v + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("zone_id"); ok { + request["ZoneId"] = v + } + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + var dedicatedHostClusterNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + dedicatedHostClusterNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + tagsMap := make(map[string]interface{}) + if v, ok := d.GetOk("tags"); ok && len(v.(map[string]interface{})) > 0 { + tagsMap = v.(map[string]interface{}) + } + var response map[string]interface{} + conn, err := client.NewEcsClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-26"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_ecs_dedicated_host_clusters", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.DedicatedHostClusters.DedicatedHostCluster", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.DedicatedHostClusters.DedicatedHostCluster", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if dedicatedHostClusterNameRegex != nil && !dedicatedHostClusterNameRegex.MatchString(fmt.Sprint(item["DedicatedHostClusterName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["DedicatedHostClusterId"])]; !ok { + continue + } + } + if len(tagsMap) > 0 { + if _, ok := item["Tags"].(map[string]interface{}); !ok { + continue + } + tagsItem := tagsToMap(item["Tags"].(map[string]interface{})["Tag"]) + if len(tagsItem) != len(tagsMap) { + continue + } + match := true + for key, value := range tagsItem { + if v, ok := tagsMap[key]; !ok || v.(string) != value { + match = false + break + } + } + if !match { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "id": fmt.Sprint(object["DedicatedHostClusterId"]), + "dedicated_host_cluster_id": fmt.Sprint(object["DedicatedHostClusterId"]), + "dedicated_host_cluster_name": object["DedicatedHostClusterName"], + "description": object["Description"], + "resource_group_id": object["ResourceGroupId"], + "zone_id": object["ZoneId"], + "dedicated_host_ids": object["DedicatedHostIds"].(map[string]interface{})["DedicatedHostId"], + } + tags := make(map[string]interface{}) + t, _ := jsonpath.Get("$.Tags.Tag", object) + if t != nil { + for _, t := range t.([]interface{}) { + key := t.(map[string]interface{})["TagKey"].(string) + value := t.(map[string]interface{})["TagValue"].(string) + if !ignoredTags(key, value) { + tags[key] = value + } + } + } + mapping["tags"] = tags + + dedicatedHostClusterCapacity := make([]map[string]interface{}, 0) + if dedicatedHostClusterCapacityArr, ok := object["DedicatedHostClusterCapacity"].(map[string]interface{}); ok { + temp1 := map[string]interface{}{ + "total_memory": formatInt(dedicatedHostClusterCapacityArr["TotalMemory"]), + "available_memory": formatInt(dedicatedHostClusterCapacityArr["AvailableMemory"]), + "available_vcpus": formatInt(dedicatedHostClusterCapacityArr["AvailableVcpus"]), + "total_vcpus": formatInt(dedicatedHostClusterCapacityArr["TotalVcpus"]), + } + + localStorageCapacity := make([]map[string]interface{}, 0) + if localStorageCapacitiesArr, ok := dedicatedHostClusterCapacityArr["LocalStorageCapacities"].(map[string]interface{}); ok { + if localStorageCapacityList, ok := localStorageCapacitiesArr["LocalStorageCapacity"].([]interface{}); ok { + for _, v := range localStorageCapacityList { + if m1, ok := v.(map[string]interface{}); ok { + temp1 := map[string]interface{}{ + "available_disk": formatInt(m1["AvailableDisk"]), + "data_disk_category": m1["DataDiskCategory"], + "total_disk": formatInt(m1["TotalDisk"]), + } + localStorageCapacity = append(localStorageCapacity, temp1) + } + } + } + } + temp1["local_storage_capacities"] = localStorageCapacity + + dedicatedHostClusterCapacity = append(dedicatedHostClusterCapacity, temp1) + } + mapping["dedicated_host_cluster_capacity"] = dedicatedHostClusterCapacity + + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["DedicatedHostClusterName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("clusters", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecs_deployment_sets.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecs_deployment_sets.go new file mode 100644 index 00000000000..af9d6921f37 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecs_deployment_sets.go @@ -0,0 +1,225 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudEcsDeploymentSets() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudEcsDeploymentSetsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "deployment_set_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "strategy": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Availability"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "sets": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "deployment_set_id": { + Type: schema.TypeString, + Computed: true, + }, + "deployment_set_name": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "domain": { + Type: schema.TypeString, + Computed: true, + }, + "granularity": { + Type: schema.TypeString, + Computed: true, + }, + "instance_amount": { + Type: schema.TypeInt, + Computed: true, + }, + "instance_ids": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "strategy": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudEcsDeploymentSetsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeDeploymentSets" + request := make(map[string]interface{}) + if v, ok := d.GetOk("deployment_set_name"); ok { + request["DeploymentSetName"] = v + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("strategy"); ok { + request["Strategy"] = v + } + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + var deploymentSetNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + deploymentSetNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewEcsClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-26"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_ecs_deployment_sets", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.DeploymentSets.DeploymentSet", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.DeploymentSets.DeploymentSet", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if deploymentSetNameRegex != nil && !deploymentSetNameRegex.MatchString(fmt.Sprint(item["DeploymentSetName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["DeploymentSetId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + + mapping := map[string]interface{}{ + "create_time": object["CreationTime"], + "deployment_set_id": object["DeploymentSetId"], + "deployment_set_name": object["DeploymentSetName"], + "description": object["DeploymentSetDescription"], + "domain": convertEcsDeploymentSetDomainResponse(object["Domain"]), + "granularity": convertEcsDeploymentSetGranularityResponse(object["Granularity"]), + "instance_amount": formatInt(object["InstanceAmount"]), + "strategy": object["DeploymentStrategy"], + } + if v, ok := object["InstanceIds"].(map[string]interface{}); ok { + mapping["instance_ids"] = v["InstanceId"] + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["DeploymentSetName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("sets", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecs_disks.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecs_disks.go index dd72f82e608..66fe8062230 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecs_disks.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecs_disks.go @@ -156,7 +156,7 @@ func dataSourceAlicloudEcsDisks() *schema.Resource { Type: schema.TypeString, Optional: true, ForceNew: true, - ValidateFunc: validation.StringInSlice([]string{"Attaching", "Available", "Creating", "Detaching", "In_use", "Migrating", "ReIniting", "Transfering"}, false), + ValidateFunc: validation.StringInSlice([]string{"Attaching", "Available", "Creating", "Detaching", "In_use", "Migrating", "ReIniting", "Transferring"}, false), }, "tags": tagsSchema(), "zone_id": { @@ -174,6 +174,14 @@ func dataSourceAlicloudEcsDisks() *schema.Resource { Type: schema.TypeString, Optional: true, }, + "page_number": { + Type: schema.TypeInt, + Optional: true, + }, + "page_size": { + Type: schema.TypeInt, + Optional: true, + }, "disks": { Type: schema.TypeList, Computed: true, @@ -366,6 +374,10 @@ func dataSourceAlicloudEcsDisks() *schema.Resource { }, }, }, + "total_count": { + Type: schema.TypeInt, + Computed: true, + }, }, } } @@ -465,9 +477,18 @@ func dataSourceAlicloudEcsDisksRead(d *schema.ResourceData, meta interface{}) er } else if v, ok := d.GetOk("availability_zone"); ok { request["ZoneId"] = v } - request["PageSize"] = PageSizeLarge - request["PageNumber"] = 1 - var objects []map[string]interface{} + + if v, ok := d.GetOk("page_number"); ok && v.(int) > 0 { + request["PageNumber"] = v.(int) + } else { + request["PageNumber"] = 1 + } + if v, ok := d.GetOk("page_size"); ok && v.(int) > 0 { + request["PageSize"] = v.(int) + } else { + request["PageSize"] = PageSizeLarge + } + var objects []interface{} var diskNameRegex *regexp.Regexp if v, ok := d.GetOk("name_regex"); ok { r, err := regexp.Compile(v.(string)) @@ -515,6 +536,10 @@ func dataSourceAlicloudEcsDisksRead(d *schema.ResourceData, meta interface{}) er return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Disks.Disk", response) } result, _ := resp.([]interface{}) + if isPagingRequest(d) { + objects = result + break + } for _, v := range result { item := v.(map[string]interface{}) if diskNameRegex != nil { @@ -529,7 +554,7 @@ func dataSourceAlicloudEcsDisksRead(d *schema.ResourceData, meta interface{}) er } objects = append(objects, item) } - if len(result) < PageSizeLarge { + if len(result) < request["PageSize"].(int) { break } request["PageNumber"] = request["PageNumber"].(int) + 1 @@ -537,7 +562,8 @@ func dataSourceAlicloudEcsDisksRead(d *schema.ResourceData, meta interface{}) er ids := make([]string, 0) names := make([]interface{}, 0) s := make([]map[string]interface{}, 0) - for _, object := range objects { + for _, v := range objects { + object := v.(map[string]interface{}) mapping := map[string]interface{}{ "attached_time": object["AttachedTime"], "auto_snapshot_policy_id": object["AutoSnapshotPolicyId"], @@ -640,6 +666,10 @@ func dataSourceAlicloudEcsDisksRead(d *schema.ResourceData, meta interface{}) er if err := d.Set("disks", s); err != nil { return WrapError(err) } + + if err := d.Set("total_count", formatInt(response["TotalCount"])); err != nil { + return WrapError(err) + } if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { writeToFile(output.(string), s) } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecs_prefix_lists.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecs_prefix_lists.go new file mode 100644 index 00000000000..44c9f4717a7 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ecs_prefix_lists.go @@ -0,0 +1,252 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudEcsPrefixLists() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudEcsPrefixListsRead, + Schema: map[string]*schema.Schema{ + "address_family": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"IPv4", "IPv6"}, false), + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "lists": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "address_family": { + Type: schema.TypeString, + Computed: true, + }, + "association_count": { + Type: schema.TypeInt, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "entry": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "cidr": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "max_entries": { + Type: schema.TypeInt, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "prefix_list_id": { + Type: schema.TypeString, + Computed: true, + }, + "prefix_list_name": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudEcsPrefixListsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribePrefixLists" + request := make(map[string]interface{}) + if v, ok := d.GetOk("address_family"); ok { + request["AddressFamily"] = v + } + if v, ok := d.GetOk("prefix_list_name"); ok { + request["PrefixListName"] = v + } + request["RegionId"] = client.RegionId + request["MaxResults"] = PageSizeLarge + var objects []map[string]interface{} + var prefixListNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + prefixListNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewEcsClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-26"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_ecs_prefix_lists", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.PrefixLists.PrefixList", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.PrefixLists.PrefixList", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if prefixListNameRegex != nil && !prefixListNameRegex.MatchString(fmt.Sprint(item["PrefixListName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["PrefixListId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "address_family": object["AddressFamily"], + "association_count": formatInt(object["AssociationCount"]), + "create_time": object["CreationTime"], + "max_entries": formatInt(object["MaxEntries"]), + "id": fmt.Sprint(object["PrefixListId"]), + "prefix_list_id": fmt.Sprint(object["PrefixListId"]), + "prefix_list_name": object["PrefixListName"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["PrefixListName"]) + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + s = append(s, mapping) + continue + } + id := fmt.Sprint(object["PrefixListId"]) + ecsService := EcsService{client} + getResp, err := ecsService.DescribeEcsPrefixList(id) + if err != nil { + return WrapError(err) + } + mapping["description"] = getResp["Description"] + + entry := make([]map[string]interface{}, 0) + if entryList, ok := getResp["Entries"].(map[string]interface{})["Entry"].([]interface{}); ok { + for _, v := range entryList { + if m1, ok := v.(map[string]interface{}); ok { + temp1 := map[string]interface{}{ + "cidr": m1["Cidr"], + "description": m1["Description"], + } + entry = append(entry, temp1) + } + } + } + mapping["entry"] = entry + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("lists", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ehpc_job_templates.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ehpc_job_templates.go new file mode 100644 index 00000000000..cec500ebc5f --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ehpc_job_templates.go @@ -0,0 +1,220 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudEhpcJobTemplates() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudEhpcJobTemplatesRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "templates": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "array_request": { + Type: schema.TypeString, + Computed: true, + }, + "clock_time": { + Type: schema.TypeString, + Computed: true, + }, + "command_line": { + Type: schema.TypeString, + Computed: true, + }, + "gpu": { + Type: schema.TypeInt, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "job_template_id": { + Type: schema.TypeString, + Computed: true, + }, + "job_template_name": { + Type: schema.TypeString, + Computed: true, + }, + "mem": { + Type: schema.TypeString, + Computed: true, + }, + "node": { + Type: schema.TypeInt, + Computed: true, + }, + "package_path": { + Type: schema.TypeString, + Computed: true, + }, + "priority": { + Type: schema.TypeInt, + Computed: true, + }, + "queue": { + Type: schema.TypeString, + Computed: true, + }, + "re_runable": { + Type: schema.TypeBool, + Computed: true, + }, + "runas_user": { + Type: schema.TypeString, + Computed: true, + }, + "stderr_redirect_path": { + Type: schema.TypeString, + Computed: true, + }, + "stdout_redirect_path": { + Type: schema.TypeString, + Computed: true, + }, + "task": { + Type: schema.TypeInt, + Computed: true, + }, + "thread": { + Type: schema.TypeInt, + Computed: true, + }, + "variables": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudEhpcJobTemplatesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListJobTemplates" + request := make(map[string]interface{}) + + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewEhpcClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("GET"), StringPointer("2018-04-12"), StringPointer("AK"), request, nil, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_ehpc_job_templates", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Templates.JobTemplates", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Templates.JobTemplates", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["Id"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "array_request": object["ArrayRequest"], + "clock_time": object["ClockTime"], + "command_line": object["CommandLine"], + "gpu": formatInt(object["Gpu"]), + "id": fmt.Sprint(object["Id"]), + "job_template_id": fmt.Sprint(object["Id"]), + "job_template_name": object["Name"], + "mem": object["Mem"], + "node": formatInt(object["Node"]), + "package_path": object["PackagePath"], + "priority": formatInt(object["Priority"]), + "queue": object["Queue"], + "re_runable": object["ReRunable"], + "runas_user": object["RunasUser"], + "stderr_redirect_path": object["StderrRedirectPath"], + "stdout_redirect_path": object["StdoutRedirectPath"], + "task": formatInt(object["Task"]), + "thread": formatInt(object["Thread"]), + "variables": object["Variables"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("templates", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_eip_addresses.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_eip_addresses.go index 0fd981cb77e..2a456fc661d 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_eip_addresses.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_eip_addresses.go @@ -23,7 +23,7 @@ func dataSourceAlicloudEipAddresses() *schema.Resource { Elem: &schema.Schema{Type: schema.TypeString}, ForceNew: true, MinItems: 1, - Deprecated: "Field 'ip_addresses' has been deprecated from provider version 1.126.0 and it will be remove in the future version. Please use the new attribute 'ip_address' instead.", + Deprecated: "Field 'ip_addresses' has been deprecated from provider version 1.126.0 and it will be removed in the future version. Please use the new attribute 'ip_address' instead.", }, "in_use": { Type: schema.TypeBool, @@ -253,7 +253,7 @@ func dataSourceAlicloudEipAddresses() *schema.Resource { "eips": { Type: schema.TypeList, Computed: true, - Deprecated: "Field 'eips' has been deprecated from provider version 1.126.0 and it will be remove in the future version. Please use the new attribute 'addresses' instead.", + Deprecated: "Field 'eips' has been deprecated from provider version 1.126.0 and it will be removed in the future version. Please use the new attribute 'addresses' instead.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "id": { diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_emr_clusters.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_emr_clusters.go new file mode 100644 index 00000000000..75b5e355990 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_emr_clusters.go @@ -0,0 +1,931 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudEmrClusters() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudEmrClustersRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "cluster_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "cluster_type_list": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "create_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"MANUAL", "ON-DEMAND"}, false), + }, + "default_status": { + Type: schema.TypeBool, + Optional: true, + ForceNew: true, + }, + "deposit_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"HALF_MANAGED", "MANAGED"}, false), + }, + "is_desc": { + Type: schema.TypeBool, + Optional: true, + ForceNew: true, + }, + "machine_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Default: "ECS", + ValidateFunc: validation.StringInSlice([]string{"DOCKER", "ECS", "ECS_FROM_ECM_HOSTPOOL", "PYHSICAL_MACHINE"}, false), + }, + "resource_group_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "status_list": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + ValidateFunc: validation.StringInSlice([]string{"ABNORMAL", "CREATE_FAILED", "CREATING", "IDLE", "RELEASED", "RELEASE_FAILED", "RELEASING", "RUNNING", "WAIT_FOR_PAY"}, false), + }, + }, + "vpc_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "page_number": { + Type: schema.TypeInt, + Optional: true, + }, + "page_size": { + Type: schema.TypeInt, + Optional: true, + Default: 50, + }, + "clusters": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "access_info": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "zk_links": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "link": { + Type: schema.TypeString, + Computed: true, + }, + "port": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + }, + }, + "auto_scaling_allowed": { + Type: schema.TypeBool, + Computed: true, + }, + "auto_scaling_by_load_allowed": { + Type: schema.TypeBool, + Computed: true, + }, + "auto_scaling_enable": { + Type: schema.TypeBool, + Computed: true, + }, + "auto_scaling_spot_with_limit_allowed": { + Type: schema.TypeBool, + Computed: true, + }, + "bootstrap_action_list": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "arg": { + Type: schema.TypeString, + Computed: true, + }, + "name": { + Type: schema.TypeString, + Computed: true, + }, + "path": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "bootstrap_failed": { + Type: schema.TypeBool, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "cluster_id": { + Type: schema.TypeString, + Computed: true, + }, + "cluster_name": { + Type: schema.TypeString, + Computed: true, + }, + "create_resource": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "create_type": { + Type: schema.TypeString, + Computed: true, + }, + "deposit_type": { + Type: schema.TypeString, + Computed: true, + }, + "eas_enable": { + Type: schema.TypeBool, + Computed: true, + }, + "expired_time": { + Type: schema.TypeString, + Computed: true, + }, + "type": { + Type: schema.TypeString, + Computed: true, + }, + "has_uncompleted_order": { + Type: schema.TypeBool, + Computed: true, + }, + "extra_info": { + Type: schema.TypeString, + Computed: true, + }, + "high_availability_enable": { + Type: schema.TypeBool, + Computed: true, + }, + "host_group_list": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "band_width": { + Type: schema.TypeString, + Computed: true, + }, + "charge_type": { + Type: schema.TypeString, + Computed: true, + }, + "cpu_core": { + Type: schema.TypeInt, + Computed: true, + }, + "disk_capacity": { + Type: schema.TypeInt, + Computed: true, + }, + "disk_count": { + Type: schema.TypeInt, + Computed: true, + }, + "disk_type": { + Type: schema.TypeString, + Computed: true, + }, + "host_group_change_type": { + Type: schema.TypeString, + Computed: true, + }, + "host_group_id": { + Type: schema.TypeString, + Computed: true, + }, + "host_group_name": { + Type: schema.TypeString, + Computed: true, + }, + "host_group_type": { + Type: schema.TypeString, + Computed: true, + }, + "instance_type": { + Type: schema.TypeString, + Computed: true, + }, + "memory_capacity": { + Type: schema.TypeInt, + Computed: true, + }, + "node_count": { + Type: schema.TypeInt, + Computed: true, + }, + "nodes": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "disk_infos": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "device": { + Type: schema.TypeString, + Computed: true, + }, + "disk_id": { + Type: schema.TypeString, + Computed: true, + }, + "disk_name": { + Type: schema.TypeString, + Computed: true, + }, + "size": { + Type: schema.TypeInt, + Computed: true, + }, + "type": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "emr_expired_time": { + Type: schema.TypeString, + Computed: true, + }, + "expired_time": { + Type: schema.TypeString, + Computed: true, + }, + "inner_ip": { + Type: schema.TypeString, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "pub_ip": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "support_ipv6": { + Type: schema.TypeBool, + Computed: true, + }, + "zone_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "period": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "host_pool_info": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "hp_biz_id": { + Type: schema.TypeString, + Computed: true, + }, + "hp_name": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "image_id": { + Type: schema.TypeString, + Computed: true, + }, + "local_meta_db": { + Type: schema.TypeBool, + Computed: true, + }, + "machine_type": { + Type: schema.TypeString, + Computed: true, + }, + "meta_store_type": { + Type: schema.TypeString, + Computed: true, + }, + "net_type": { + Type: schema.TypeString, + Computed: true, + }, + "payment_type": { + Type: schema.TypeString, + Computed: true, + }, + "period": { + Type: schema.TypeInt, + Computed: true, + }, + "relate_cluster_info": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "cluster_id": { + Type: schema.TypeString, + Computed: true, + }, + "cluster_name": { + Type: schema.TypeString, + Computed: true, + }, + "cluster_type": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "resize_disk_enable": { + Type: schema.TypeBool, + Computed: true, + }, + "running_time": { + Type: schema.TypeInt, + Computed: true, + }, + "security_group_id": { + Type: schema.TypeString, + Computed: true, + }, + "security_group_name": { + Type: schema.TypeString, + Computed: true, + }, + "software_info": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "cluster_type": { + Type: schema.TypeString, + Computed: true, + }, + "emr_ver": { + Type: schema.TypeString, + Computed: true, + }, + "softwares": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "display_name": { + Type: schema.TypeString, + Computed: true, + }, + "name": { + Type: schema.TypeString, + Computed: true, + }, + "only_display": { + Type: schema.TypeBool, + Computed: true, + }, + "start_tpe": { + Type: schema.TypeInt, + Computed: true, + }, + "version": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + }, + }, + "start_time": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "stop_time": { + Type: schema.TypeString, + Computed: true, + }, + "tags": { + Type: schema.TypeMap, + Computed: true, + }, + "user_defined_emr_ecs_role": { + Type: schema.TypeString, + Computed: true, + }, + "user_id": { + Type: schema.TypeString, + Computed: true, + }, + "vswitch_id": { + Type: schema.TypeString, + Computed: true, + }, + "vpc_id": { + Type: schema.TypeString, + Computed: true, + }, + "zone_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "total_count": { + Type: schema.TypeInt, + Computed: true, + }, + }, + } +} + +func dataSourceAlicloudEmrClustersRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListClusters" + request := make(map[string]interface{}) + if v, ok := d.GetOk("cluster_name"); ok { + request["Name"] = v + } + if v, ok := d.GetOk("cluster_type_list"); ok { + request["ClusterTypeList"] = v + } + + if v, ok := d.GetOk("create_type"); ok { + request["CreateType"] = v + } + if v, ok := d.GetOkExists("default_status"); ok { + request["DefaultStatus"] = v + } + if v, ok := d.GetOk("deposit_type"); ok { + request["DepositType"] = v + } + + if v, ok := d.GetOkExists("is_desc"); ok { + request["IsDesc"] = v + } + if v, ok := d.GetOk("machine_type"); ok { + request["MachineType"] = v + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("resource_group_id"); ok { + request["ResourceGroupId"] = v + } + if v, ok := d.GetOk("status_list"); ok { + request["StatusList"] = v + } + + if v, ok := d.GetOk("vpc_id"); ok { + request["VpcId"] = v + } + + if v, ok := d.GetOk("page_number"); ok && v.(int) > 0 { + request["PageNumber"] = v.(int) + } else { + request["PageNumber"] = 1 + } + if v, ok := d.GetOk("page_size"); ok && v.(int) > 0 { + request["PageSize"] = v.(int) + } else { + request["PageSize"] = PageSizeLarge + } + + var clusterNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + clusterNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + + var response map[string]interface{} + conn, err := client.NewEmrClient() + if err != nil { + return WrapError(err) + } + var objects []interface{} + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-08"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_emr_clusters", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Clusters.ClusterInfo", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Clusters.ClusterInfo", response) + } + result, _ := resp.([]interface{}) + if isPagingRequest(d) { + objects = result + break + } + for _, v := range result { + item := v.(map[string]interface{}) + if clusterNameRegex != nil && !clusterNameRegex.MatchString(fmt.Sprint(item["Name"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["Id"])]; !ok { + continue + } + } + + objects = append(objects, item) + } + if len(result) < request["PageSize"].(int) { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, v := range objects { + object := v.(map[string]interface{}) + mapping := map[string]interface{}{ + "id": fmt.Sprint(object["Id"]), + "cluster_id": fmt.Sprint(object["Id"]), + "cluster_name": object["Name"], + "create_resource": object["CreateResource"], + "create_time": fmt.Sprint(object["CreateTime"]), + "deposit_type": object["DepositType"], + "expired_time": fmt.Sprint(object["ExpiredTime"]), + "machine_type": object["MachineType"], + "meta_store_type": object["MetaStoreType"], + "payment_type": object["ChargeType"], + "period": formatInt(object["Period"]), + "running_time": formatInt(object["RunningTime"]), + "status": object["Status"], + "type": object["Type"], + "has_uncompleted_order": object["HasUncompletedOrder"], + } + + tags := make(map[string]interface{}) + t, _ := jsonpath.Get("$.Tags.Tag", object) + if t != nil { + for _, t := range t.([]interface{}) { + key := t.(map[string]interface{})["TagKey"].(string) + value := t.(map[string]interface{})["TagValue"].(string) + if !ignoredTags(key, value) { + tags[key] = value + } + } + } + mapping["tags"] = tags + + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["Name"]) + s = append(s, mapping) + continue + } + + id := fmt.Sprint(object["Id"]) + emrService := EmrService{client} + getResp, err := emrService.DescribeClusterBasicInfo(id) + if err != nil { + return WrapError(err) + } + mapping["auto_scaling_allowed"] = getResp["AutoScalingAllowed"] + mapping["auto_scaling_by_load_allowed"] = getResp["AutoScalingByLoadAllowed"] + mapping["auto_scaling_spot_with_limit_allowed"] = getResp["AutoScalingSpotWithLimitAllowed"] + + bootstrapAction := make([]map[string]interface{}, 0) + if bootstrapActionList, ok := getResp["BootstrapActionList"].(map[string]interface{})["BootstrapAction"].([]interface{}); ok { + for _, v := range bootstrapActionList { + if m1, ok := v.(map[string]interface{}); ok { + temp1 := map[string]interface{}{ + "arg": m1["Arg"], + "name": m1["Name"], + "path": m1["Path"], + } + bootstrapAction = append(bootstrapAction, temp1) + } + } + } + mapping["bootstrap_action_list"] = bootstrapAction + + softwareInfo := make([]map[string]interface{}, 0) + if softwareInfoList, ok := getResp["SoftwareInfo"].(map[string]interface{}); ok { + + temp1 := map[string]interface{}{ + "emr_ver": softwareInfoList["EmrVer"], + "cluster_type": softwareInfoList["ClusterType"], + } + + if softwareInfoList["Softwares"] != nil { + softwareMaps := make([]map[string]interface{}, 0) + for _, softwareValue := range softwareInfoList["Softwares"].(map[string]interface{})["Software"].([]interface{}) { + software := softwareValue.(map[string]interface{}) + softwareMap := map[string]interface{}{ + "start_tpe": software["StartTpe"], + "version": software["Version"], + "display_name": software["DisplayName"], + "only_display": software["OnlyDisplay"], + "name": software["Name"], + } + softwareMaps = append(softwareMaps, softwareMap) + } + temp1["softwares"] = softwareMaps + } + softwareInfo = append(softwareInfo, temp1) + } + mapping["software_info"] = softwareInfo + + hostPoolInfo := make([]map[string]interface{}, 0) + if hostPoolInfoList, ok := getResp["HostPoolInfo"].(map[string]interface{}); ok { + temp1 := map[string]interface{}{ + "hp_biz_id": hostPoolInfoList["HpBizId"], + "hp_name": hostPoolInfoList["HpName"], + } + hostPoolInfo = append(hostPoolInfo, temp1) + } + mapping["host_pool_info"] = hostPoolInfo + + relateClusterInfo := make([]map[string]interface{}, 0) + if relateClusterInfoList, ok := getResp["RelateClusterInfo"].(map[string]interface{}); ok { + temp1 := map[string]interface{}{ + "cluster_id": relateClusterInfoList["ClusterId"], + "cluster_name": relateClusterInfoList["ClusterName"], + "cluster_type": relateClusterInfoList["ClusterType"], + "status": relateClusterInfoList["Status"], + } + relateClusterInfo = append(relateClusterInfo, temp1) + } + mapping["relate_cluster_info"] = relateClusterInfo + + mapping["bootstrap_failed"] = getResp["BootstrapFailed"] + + mapping["create_type"] = getResp["CreateType"] + mapping["eas_enable"] = getResp["EasEnable"] + mapping["extra_info"] = getResp["ExtraInfo"] + mapping["image_id"] = getResp["ImageId"] + mapping["local_meta_db"] = getResp["LocalMetaDb"] + mapping["net_type"] = getResp["NetType"] + mapping["security_group_id"] = getResp["SecurityGroupId"] + mapping["security_group_name"] = getResp["SecurityGroupName"] + mapping["start_time"] = getResp["StartTime"] + mapping["stop_time"] = getResp["StopTime"] + mapping["user_defined_emr_ecs_role"] = getResp["UserDefinedEmrEcsRole"] + mapping["user_id"] = getResp["UserId"] + mapping["vswitch_id"] = getResp["VSwitchId"] + mapping["vpc_id"] = getResp["VpcId"] + mapping["zone_id"] = getResp["ZoneId"] + emrService = EmrService{client} + getResp1, err := emrService.DataSourceDescribeEmrCluster(id) + if err != nil { + return WrapError(err) + } + + mapping["access_info"] = getResp1["AccessInfo"] + accessInfos := make([]map[string]interface{}, 0) + if accessInfosList, ok := getResp1["AccessInfo"].([]interface{}); ok { + for _, v := range accessInfosList { + if m1, ok := v.(map[string]interface{}); ok { + temp1 := map[string]interface{}{} + if m1["ZKLinks"] != nil { + accessInfosMaps := make([]map[string]interface{}, 0) + for _, accessInfosValue := range m1["ZKLinks"].([]interface{}) { + accessInfo := accessInfosValue.(map[string]interface{}) + accessInfosMap := map[string]interface{}{ + "link": accessInfo["Link"], + "port": accessInfo["Port"], + } + accessInfosMaps = append(accessInfosMaps, accessInfosMap) + } + temp1["zk_links"] = accessInfosMaps + } + accessInfos = append(accessInfos, temp1) + } + } + } + mapping["access_info"] = accessInfos + + mapping["auto_scaling_enable"] = getResp1["AutoScalingEnable"] + mapping["high_availability_enable"] = getResp1["HighAvailabilityEnable"] + + hostGroup := make([]map[string]interface{}, 0) + if hostGroupList, ok := getResp1["HostGroupList"].(map[string]interface{})["HostGroup"].([]interface{}); ok { + for _, v := range hostGroupList { + if m1, ok := v.(map[string]interface{}); ok { + temp1 := map[string]interface{}{ + "band_width": m1["BandWidth"], + "charge_type": m1["ChargeType"], + "cpu_core": formatInt(m1["CpuCore"]), + "disk_capacity": formatInt(m1["DiskCapacity"]), + "disk_count": formatInt(m1["DiskCount"]), + "disk_type": m1["DiskType"], + "host_group_change_type": m1["HostGroupChangeType"], + "host_group_id": m1["HostGroupId"], + "host_group_name": m1["HostGroupName"], + "host_group_type": m1["HostGroupType"], + "instance_type": m1["InstanceType"], + "memory_capacity": formatInt(m1["MemoryCapacity"]), + "node_count": formatInt(m1["NodeCount"]), + "period": m1["Period"], + } + if m1["Nodes"] != nil { + nodesMaps := make([]map[string]interface{}, 0) + for _, nodesValue := range m1["Nodes"].(map[string]interface{})["Node"].([]interface{}) { + nodes := nodesValue.(map[string]interface{}) + nodesMap := map[string]interface{}{ + "create_time": nodes["CreateTime"], + "status": nodes["Status"], + "emr_expired_time": nodes["EmrExpiredTime"], + "support_ipv6": nodes["SupportIpV6"], + "zone_id": nodes["ZoneId"], + "inner_ip": nodes["InnerIp"], + "instance_id": nodes["InstanceId"], + "expired_time": nodes["ExpiredTime"], + "pub_ip": nodes["PubIp"], + } + + if nodes["DiskInfos"] != nil { + deskInfoMaps := make([]map[string]interface{}, 0) + for _, diskInfosValue := range nodes["DiskInfos"].(map[string]interface{})["DiskInfo"].([]interface{}) { + disks := diskInfosValue.(map[string]interface{}) + disksMap := map[string]interface{}{ + "device": disks["Device"], + "disk_id": disks["DiskId"], + "disk_name": disks["DiskName"], + "size": disks["Size"], + "type": disks["Type"], + } + deskInfoMaps = append(deskInfoMaps, disksMap) + } + nodesMap["disk_infos"] = deskInfoMaps + } + nodesMaps = append(nodesMaps, nodesMap) + } + temp1["nodes"] = nodesMaps + } + hostGroup = append(hostGroup, temp1) + } + } + } + mapping["host_group_list"] = hostGroup + mapping["resize_disk_enable"] = getResp1["ResizeDiskEnable"] + + emrService = EmrService{client} + getResp2, err := emrService.ListTagResources(id, "cluster") + if err != nil { + return WrapError(err) + } + mapping["tags"] = tagsToMap(getResp2) + + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["Name"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("clusters", s); err != nil { + return WrapError(err) + } + if err := d.Set("total_count", formatInt(response["TotalCount"])); err != nil { + return WrapError(err) + } + + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_emr_main_versions.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_emr_main_versions.go index 077b6ea24f4..f3abe164a99 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_emr_main_versions.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_emr_main_versions.go @@ -2,6 +2,9 @@ package alicloud import ( "strings" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" @@ -112,8 +115,21 @@ func dataSourceAlicloudEmrMainVersionsRead(d *schema.ResourceData, meta interfac continue } versionRequest.EmrVersion = v.EmrVersion - versionRaw, err = client.WithEmrClient(func(emrClient *emr.Client) (interface{}, error) { - return emrClient.DescribeEmrMainVersion(versionRequest) + wait := incrementalWait(1*time.Second, 1*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + versionRaw, err = client.WithEmrClient(func(emrClient *emr.Client) (interface{}, error) { + return emrClient.DescribeEmrMainVersion(versionRequest) + }) + if err != nil { + if IsExpectedErrors(err, []string{"Throttling.User"}) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + addDebug(request.GetActionName(), raw, request.RpcRequest, request) + versionResponse, _ = versionRaw.(*emr.DescribeEmrMainVersionResponse) + return nil }) if err != nil { return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_emr_main_versions", request.GetActionName(), AlibabaCloudSdkGoERROR) diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ens_key_pairs.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ens_key_pairs.go new file mode 100644 index 00000000000..682f76e99b5 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ens_key_pairs.go @@ -0,0 +1,176 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudEnsKeyPairs() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudEnsKeyPairsRead, + Schema: map[string]*schema.Schema{ + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "key_pair_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "version": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "pairs": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "key_pair_finger_print": { + Type: schema.TypeString, + Computed: true, + }, + "key_pair_name": { + Type: schema.TypeString, + Computed: true, + }, + "version": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudEnsKeyPairsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeKeyPairs" + request := make(map[string]interface{}) + if v, ok := d.GetOk("key_pair_name"); ok { + request["KeyPairName"] = v + } + request["Version"] = d.Get("version") + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + var keyPairNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + keyPairNameRegex = r + } + var response map[string]interface{} + conn, err := client.NewEnsClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-11-10"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_ens_key_pairs", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.KeyPairs.KeyPair", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.KeyPairs.KeyPair", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if keyPairNameRegex != nil && !keyPairNameRegex.MatchString(fmt.Sprint(item["KeyPairName"])) { + continue + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "id": fmt.Sprint(object["KeyPairName"], ":", request["Version"]), + "create_time": object["CreationTime"], + "key_pair_finger_print": object["KeyPairFingerPrint"], + "key_pair_name": object["KeyPairName"], + "version": request["Version"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["KeyPairName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("pairs", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ess_scalingconfigurations.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ess_scalingconfigurations.go index 70e3c16b5e4..5a2dd9d31f9 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ess_scalingconfigurations.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ess_scalingconfigurations.go @@ -139,6 +139,34 @@ func dataSourceAlicloudEssScalingConfigurations() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "instance_name": { + Type: schema.TypeString, + Computed: true, + }, + "host_name": { + Type: schema.TypeString, + Computed: true, + }, + "spot_strategy": { + Type: schema.TypeString, + Computed: true, + }, + "spot_price_limit": { + Type: schema.TypeList, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "instance_type": { + Type: schema.TypeString, + Optional: true, + }, + "price_limit": { + Type: schema.TypeFloat, + Optional: true, + }, + }, + }, + Computed: true, + }, }, }, }, @@ -245,6 +273,10 @@ func scalingConfigurationsDescriptionAttribute(d *schema.ResourceData, scalingCo "data_disks": essService.flattenDataDiskMappings(scalingConfiguration.DataDisks.DataDisk), "lifecycle_state": scalingConfiguration.LifecycleState, "creation_time": scalingConfiguration.CreationTime, + "instance_name": scalingConfiguration.InstanceName, + "host_name": scalingConfiguration.HostName, + "spot_strategy": scalingConfiguration.SpotStrategy, + "spot_price_limit": essService.flattenSpotPriceLimitMappings(scalingConfiguration.SpotPriceLimit.SpotPriceModel), } ids = append(ids, scalingConfiguration.ScalingConfigurationId) names = append(names, scalingConfiguration.ScalingConfigurationName) diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_event_bridge_service.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_event_bridge_service.go index 0bdc374aa0e..ae23dc153de 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_event_bridge_service.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_event_bridge_service.go @@ -22,11 +22,6 @@ func dataSourceAlicloudEventBridgeService() *schema.Resource { Optional: true, Default: "Off", }, - "code": { - Type: schema.TypeString, - ValidateFunc: validation.StringInSlice([]string{"eventbridge_post_public_intl", "eventbridge_post_public_cn"}, false), - Required: true, - }, "status": { Type: schema.TypeString, Computed: true, @@ -47,9 +42,6 @@ func dataSourceAlicloudEventBridgeServiceRead(d *schema.ResourceData, meta inter "SubscriptionType": "PayAsYouGo", } - if v, ok := d.GetOk("code"); ok { - request["ProductType"] = v - } conn, err := meta.(*connectivity.AliyunClient).NewBssopenapiClient() if err != nil { return WrapError(err) diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_express_connect_virtual_border_routers.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_express_connect_virtual_border_routers.go new file mode 100644 index 00000000000..601f13bc3ef --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_express_connect_virtual_border_routers.go @@ -0,0 +1,356 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudExpressConnectVirtualBorderRouters() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudExpressConnectVirtualBorderRoutersRead, + Schema: map[string]*schema.Schema{ + "filter": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "values": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + }, + }, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"active", "deleting", "recovering", "terminated", "terminating", "unconfirmed"}, false), + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "routers": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "access_point_id": { + Type: schema.TypeString, + Computed: true, + }, + "activation_time": { + Type: schema.TypeString, + Computed: true, + }, + "circuit_code": { + Type: schema.TypeString, + Computed: true, + }, + "cloud_box_instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "detect_multiplier": { + Type: schema.TypeInt, + Computed: true, + }, + "ecc_id": { + Type: schema.TypeString, + Computed: true, + }, + "enable_ipv6": { + Type: schema.TypeBool, + Computed: true, + }, + "local_gateway_ip": { + Type: schema.TypeString, + Computed: true, + }, + "local_ipv6_gateway_ip": { + Type: schema.TypeString, + Computed: true, + }, + "min_rx_interval": { + Type: schema.TypeInt, + Computed: true, + }, + "min_tx_interval": { + Type: schema.TypeInt, + Computed: true, + }, + "payment_vbr_expire_time": { + Type: schema.TypeString, + Computed: true, + }, + "peer_gateway_ip": { + Type: schema.TypeString, + Computed: true, + }, + "peer_ipv6_gateway_ip": { + Type: schema.TypeString, + Computed: true, + }, + "peering_ipv6_subnet_mask": { + Type: schema.TypeString, + Computed: true, + }, + "peering_subnet_mask": { + Type: schema.TypeString, + Computed: true, + }, + "physical_connection_business_status": { + Type: schema.TypeString, + Computed: true, + }, + "physical_connection_id": { + Type: schema.TypeString, + Computed: true, + }, + "physical_connection_owner_uid": { + Type: schema.TypeString, + Computed: true, + }, + "physical_connection_status": { + Type: schema.TypeString, + Computed: true, + }, + "recovery_time": { + Type: schema.TypeString, + Computed: true, + }, + "route_table_id": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "termination_time": { + Type: schema.TypeString, + Computed: true, + }, + "type": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "virtual_border_router_id": { + Type: schema.TypeString, + Computed: true, + }, + "virtual_border_router_name": { + Type: schema.TypeString, + Computed: true, + }, + "vlan_id": { + Type: schema.TypeInt, + Computed: true, + }, + "vlan_interface_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudExpressConnectVirtualBorderRoutersRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeVirtualBorderRouters" + request := make(map[string]interface{}) + if v, ok := d.GetOk("filter"); ok { + for filterPtr, filter := range v.([]interface{}) { + filterArg := filter.(map[string]interface{}) + request[fmt.Sprintf("Filter.%d.Key", filterPtr+1)] = filterArg["key"] + for valuePtr, value := range filterArg["values"].([]interface{}) { + request[fmt.Sprintf("Filter.%d.Value.%d", filterPtr+1, valuePtr+1)] = value + } + } + } + request["RegionId"] = client.RegionId + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + var virtualBorderRouterNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + virtualBorderRouterNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_express_connect_virtual_border_routers", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.VirtualBorderRouterSet.VirtualBorderRouterType", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.VirtualBorderRouterSet.VirtualBorderRouterType", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if virtualBorderRouterNameRegex != nil && !virtualBorderRouterNameRegex.MatchString(fmt.Sprint(item["Name"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["VbrId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["Status"].(string) { + continue + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "access_point_id": object["AccessPointId"], + "activation_time": object["ActivationTime"], + "circuit_code": object["CircuitCode"], + "cloud_box_instance_id": object["CloudBoxInstanceId"], + "create_time": object["CreationTime"], + "description": object["Description"], + "detect_multiplier": formatInt(object["DetectMultiplier"]), + "ecc_id": object["EccId"], + "enable_ipv6": object["EnableIpv6"], + "local_gateway_ip": object["LocalGatewayIp"], + "local_ipv6_gateway_ip": object["LocalIpv6GatewayIp"], + "min_rx_interval": formatInt(object["MinRxInterval"]), + "min_tx_interval": formatInt(object["MinTxInterval"]), + "payment_vbr_expire_time": object["PConnVbrExpireTime"], + "peer_gateway_ip": object["PeerGatewayIp"], + "peer_ipv6_gateway_ip": object["PeerIpv6GatewayIp"], + "peering_ipv6_subnet_mask": object["PeeringIpv6SubnetMask"], + "peering_subnet_mask": object["PeeringSubnetMask"], + "physical_connection_business_status": object["PhysicalConnectionBusinessStatus"], + "physical_connection_id": object["PhysicalConnectionId"], + "physical_connection_owner_uid": object["PhysicalConnectionOwnerUid"], + "physical_connection_status": object["PhysicalConnectionStatus"], + "recovery_time": object["RecoveryTime"], + "route_table_id": object["RouteTableId"], + "status": object["Status"], + "termination_time": object["TerminationTime"], + "type": object["Type"], + "id": fmt.Sprint(object["VbrId"]), + "virtual_border_router_id": fmt.Sprint(object["VbrId"]), + "virtual_border_router_name": object["Name"], + "vlan_id": formatInt(object["VlanId"]), + "vlan_interface_id": object["VlanInterfaceId"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["Name"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("routers", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_fnf_executions.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_fnf_executions.go new file mode 100644 index 00000000000..c1d6cb7a74b --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_fnf_executions.go @@ -0,0 +1,224 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudFnFExecutions() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudFnFExecutionsRead, + Schema: map[string]*schema.Schema{ + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "flow_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Running", "Stopped", "Succeeded", "Failed", "TimedOut"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "executions": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, + "execution_name": { + Type: schema.TypeString, + Computed: true, + }, + "flow_name": { + Type: schema.TypeString, + Computed: true, + }, + "input": { + Type: schema.TypeString, + Computed: true, + }, + "output": { + Type: schema.TypeString, + Computed: true, + }, + "started_time": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "stopped_time": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudFnFExecutionsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListExecutions" + request := make(map[string]interface{}) + request["FlowName"] = d.Get("flow_name") + if v, ok := d.GetOk("status"); ok { + request["Status"] = v + } + var objects []map[string]interface{} + var executionNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + executionNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + + var response map[string]interface{} + conn, err := client.NewFnfClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("GET"), StringPointer("2019-03-15"), StringPointer("AK"), request, nil, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_fnf_executions", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Executions", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Executions", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if executionNameRegex != nil && !executionNameRegex.MatchString(fmt.Sprint(item["Name"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["FlowName"], ":", item["Name"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "id": fmt.Sprint(object["FlowName"], ":", object["Name"]), + "execution_name": fmt.Sprint(object["Name"]), + "flow_name": object["FlowName"], + "input": object["Input"], + "output": object["Output"], + "started_time": object["StartedTime"], + "stopped_time": object["StoppedTime"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["Name"]) + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + s = append(s, mapping) + continue + } + id := fmt.Sprint(object["FlowName"], ":", object["Name"]) + fnfService := FnfService{client} + getResp, err := fnfService.DescribeFnFExecution(id) + if err != nil { + return WrapError(err) + } + mapping["status"] = getResp["Status"] + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("executions", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ga_acls.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ga_acls.go new file mode 100644 index 00000000000..03541948312 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ga_acls.go @@ -0,0 +1,242 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudGaAcls() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudGaAclsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "acl_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"active", "configuring", "deleting", "init"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "acls": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "acl_entries": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "entry": { + Type: schema.TypeString, + Computed: true, + }, + "entry_description": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "acl_id": { + Type: schema.TypeString, + Computed: true, + }, + "acl_name": { + Type: schema.TypeString, + Computed: true, + }, + "address_ip_version": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudGaAclsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListAcls" + request := make(map[string]interface{}) + if v, ok := d.GetOk("acl_name"); ok { + request["AclName"] = v + } + request["RegionId"] = client.RegionId + request["MaxResults"] = PageSizeLarge + var objects []map[string]interface{} + var aclNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + aclNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewGaplusClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_ga_acls", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Acls", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Acls", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if aclNameRegex != nil && !aclNameRegex.MatchString(fmt.Sprint(item["AclName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["AclId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["AclStatus"].(string) { + continue + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "id": fmt.Sprint(object["AclId"]), + "acl_id": fmt.Sprint(object["AclId"]), + "acl_name": object["AclName"], + "address_ip_version": object["AddressIPVersion"], + "status": object["AclStatus"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["AclName"]) + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + s = append(s, mapping) + continue + } + id := fmt.Sprint(object["AclId"]) + gaService := GaService{client} + getResp, err := gaService.DescribeGaAcl(id) + if err != nil { + return WrapError(err) + } + if v, ok := getResp["AclEntries"].([]interface{}); ok { + aclEntries := make([]map[string]interface{}, 0) + for _, val := range v { + item := val.(map[string]interface{}) + temp := map[string]interface{}{ + "entry": item["Entry"], + "entry_description": item["EntryDescription"], + } + + aclEntries = append(aclEntries, temp) + } + mapping["acl_entries"] = aclEntries + } + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("acls", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ga_additional_certificates.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ga_additional_certificates.go new file mode 100644 index 00000000000..4eb93686ee0 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ga_additional_certificates.go @@ -0,0 +1,163 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudGaAdditionalCertificates() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudGaAdditionalCertificatesRead, + Schema: map[string]*schema.Schema{ + "accelerator_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "listener_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "certificates": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "accelerator_id": { + Type: schema.TypeString, + Computed: true, + }, + "certificate_id": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "domain": { + Type: schema.TypeString, + Computed: true, + }, + "listener_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudGaAdditionalCertificatesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListListenerCertificates" + request := make(map[string]interface{}) + request["AcceleratorId"] = d.Get("accelerator_id") + request["ListenerId"] = d.Get("listener_id") + request["RegionId"] = client.RegionId + request["Role"] = "additional" + request["MaxResults"] = PageSizeLarge + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewGaplusClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_ga_additional_certificates", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Certificates", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Certificates", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(request["AcceleratorId"], ":", request["ListenerId"], ":", item["Domain"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "accelerator_id": request["AcceleratorId"], + "certificate_id": object["CertificateId"], + "id": fmt.Sprint(request["AcceleratorId"], ":", request["ListenerId"], ":", object["Domain"]), + "domain": fmt.Sprint(object["Domain"]), + "listener_id": request["ListenerId"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("certificates", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_gpdb_accounts.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_gpdb_accounts.go new file mode 100644 index 00000000000..aa9ae9e0d67 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_gpdb_accounts.go @@ -0,0 +1,190 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudGpdbAccounts() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudGpdbAccountsRead, + Schema: map[string]*schema.Schema{ + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "db_instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Active", "Creating", "Deleting"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "accounts": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "account_description": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "account_name": { + Type: schema.TypeString, + Computed: true, + }, + "db_instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudGpdbAccountsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeAccounts" + request := make(map[string]interface{}) + request["DBInstanceId"] = d.Get("db_instance_id") + var objects []map[string]interface{} + var accountNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + accountNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewGpdbClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-05-03"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + + if NeedRetry(err) { + + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_gpdb_accounts", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Accounts.DBInstanceAccount", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Accounts.DBInstanceAccount", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if accountNameRegex != nil && !accountNameRegex.MatchString(fmt.Sprint(item["AccountName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["DBInstanceId"], ":", item["AccountName"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["AccountStatus"].(string) { + continue + } + objects = append(objects, item) + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "account_description": object["AccountDescription"], + "id": fmt.Sprint(object["DBInstanceId"], ":", object["AccountName"]), + "account_name": fmt.Sprint(object["AccountName"]), + "db_instance_id": object["DBInstanceId"], + "status": convertGpdbAccountStatusResponse(object["AccountStatus"]), + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["AccountName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("accounts", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_graph_database_db_instances.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_graph_database_db_instances.go new file mode 100644 index 00000000000..f7df74f8f65 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_graph_database_db_instances.go @@ -0,0 +1,362 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudGraphDatabaseDbInstances() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudGraphDatabaseDbInstancesRead, + Schema: map[string]*schema.Schema{ + "db_instance_description": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Creating", "Running", "Deleting", "DBInstanceClassChanging", "NetAddressCreating", "NetAddressDeleting"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "instances": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "connection_string": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "current_minor_version": { + Type: schema.TypeString, + Computed: true, + }, + "db_instance_category": { + Type: schema.TypeString, + Computed: true, + }, + "db_instance_cpu": { + Type: schema.TypeString, + Computed: true, + }, + "db_instance_description": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "db_instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "db_instance_memory": { + Type: schema.TypeString, + Computed: true, + }, + "db_instance_network_type": { + Type: schema.TypeString, + Computed: true, + }, + "db_instance_storage_type": { + Type: schema.TypeString, + Computed: true, + }, + "db_instance_type": { + Type: schema.TypeString, + Computed: true, + }, + "db_node_class": { + Type: schema.TypeString, + Computed: true, + }, + "db_node_count": { + Type: schema.TypeString, + Computed: true, + }, + "db_node_storage": { + Type: schema.TypeString, + Computed: true, + }, + "db_version": { + Type: schema.TypeString, + Computed: true, + }, + "expire_time": { + Type: schema.TypeString, + Computed: true, + }, + "expired": { + Type: schema.TypeString, + Computed: true, + }, + "latest_minor_version": { + Type: schema.TypeString, + Computed: true, + }, + "lock_mode": { + Type: schema.TypeString, + Computed: true, + }, + "lock_reason": { + Type: schema.TypeString, + Computed: true, + }, + "maintain_time": { + Type: schema.TypeString, + Computed: true, + }, + "master_db_instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "payment_type": { + Type: schema.TypeString, + Computed: true, + }, + "port": { + Type: schema.TypeInt, + Computed: true, + }, + "public_connection_string": { + Type: schema.TypeString, + Computed: true, + }, + "public_port": { + Type: schema.TypeInt, + Computed: true, + }, + "read_only_db_instance_ids": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "vswitch_id": { + Type: schema.TypeString, + Computed: true, + }, + "vpc_id": { + Type: schema.TypeString, + Computed: true, + }, + "zone_id": { + Type: schema.TypeString, + Computed: true, + }, + "db_instance_ip_array": { + Type: schema.TypeSet, + Optional: true, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "db_instance_ip_array_attribute": { + Type: schema.TypeString, + Optional: true, + }, + "db_instance_ip_array_name": { + Type: schema.TypeString, + Optional: true, + }, + "security_ips": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudGraphDatabaseDbInstancesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeDBInstances" + request := make(map[string]interface{}) + if v, ok := d.GetOk("db_instance_description"); ok { + request["DBInstanceDescription"] = v + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("status"); ok { + request["DBInstanceStatus"] = v + } + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewGdsClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-03"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_graph_database_db_instances", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Items.DBInstance", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Items.DBInstance", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["DBInstanceId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "create_time": object["CreateTime"], + "db_instance_category": object["Category"], + "db_instance_description": object["DBInstanceDescription"], + "id": fmt.Sprint(object["DBInstanceId"]), + "db_instance_id": fmt.Sprint(object["DBInstanceId"]), + "db_instance_type": object["DBInstanceType"], + "db_node_class": object["DBNodeClass"], + "db_node_count": fmt.Sprint(object["DBNodeCount"]), + "db_node_storage": fmt.Sprint(object["DBNodeStorage"]), + "db_version": object["DBVersion"], + "expire_time": object["ExpireTime"], + "expired": fmt.Sprint(object["Expired"]), + "lock_mode": object["LockMode"], + "lock_reason": object["LockReason"], + "master_db_instance_id": object["MasterInstanceId"], + "payment_type": convertGraphDatabaseDbInstancePaymentTypeResponse(object["PayType"]), + "status": object["DBInstanceStatus"], + "vswitch_id": object["VSwitchId"], + "vpc_id": object["VpcId"], + "zone_id": object["ZoneId"], + } + if v := object["ReadOnlyDBInstanceIds"].(map[string]interface{})["ReadOnlyDBInstanceId"].([]interface{}); len(v) > 0 { + mapping["read_only_db_instance_ids"] = v[0].(map[string]interface{})["DBInstanceId"] + } + ids = append(ids, fmt.Sprint(mapping["id"])) + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + s = append(s, mapping) + continue + } + id := fmt.Sprint(object["DBInstanceId"]) + gdbService := GdbService{client} + getResp, err := gdbService.DescribeGraphDatabaseDbInstance(id) + if err != nil { + return WrapError(err) + } + mapping["connection_string"] = getResp["ConnectionString"] + mapping["current_minor_version"] = getResp["CurrentMinorVersion"] + mapping["db_instance_cpu"] = getResp["DBInstanceCPU"] + mapping["db_instance_memory"] = getResp["DBInstanceMemory"] + mapping["db_instance_network_type"] = getResp["DBInstanceNetworkType"] + mapping["db_instance_storage_type"] = getResp["DBInstanceStorageType"] + mapping["latest_minor_version"] = getResp["LatestMinorVersion"] + mapping["maintain_time"] = getResp["MaintainTime"] + if DBInstanceIPArray, ok := getResp["DBInstanceIPArray"]; ok { + DBInstanceIPArrayAry, ok := DBInstanceIPArray.([]interface{}) + if ok && len(DBInstanceIPArrayAry) > 0 { + DBInstanceIPArraySli := make([]map[string]interface{}, 0) + for _, DBInstanceIPArrayArg := range DBInstanceIPArrayAry { + DBInstanceIPArrayMap := make(map[string]interface{}) + DBInstanceIPArrayMap["security_ips"] = DBInstanceIPArrayArg.(map[string]interface{})["SecurityIps"] + DBInstanceIPArrayMap["db_instance_ip_array_name"] = DBInstanceIPArrayArg.(map[string]interface{})["DBInstanceIPArrayName"] + if v, ok := DBInstanceIPArrayArg.(map[string]interface{})["DBInstanceIPArrayAttribute"]; ok { + DBInstanceIPArrayMap["db_instance_ip_array_attribute"] = v + } + DBInstanceIPArraySli = append(DBInstanceIPArraySli, DBInstanceIPArrayMap) + } + mapping["db_instance_ip_array"] = DBInstanceIPArraySli + } + } + if v, ok := getResp["Port"]; ok && v.(string) != "" { + mapping["port"] = formatInt(v) + } + mapping["public_connection_string"] = getResp["PublicConnectionString"] + if v, ok := getResp["PublicPort"]; ok && fmt.Sprint(v) != "0" { + mapping["public_port"] = formatInt(v) + } + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("instances", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_hbr_backup_jobs.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_hbr_backup_jobs.go new file mode 100644 index 00000000000..f55719dcb70 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_hbr_backup_jobs.go @@ -0,0 +1,345 @@ +package alicloud + +import ( + "fmt" + "strconv" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudHbrBackupJobs() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudHbrBackupJobsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "sort_direction": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"ASCEND", "DESCEND"}, false), + }, + "source_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"ECS_FILE", "NAS", "OSS"}, false), + }, + "filter": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "values": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "operator": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"EQUAL", "NOT_EQUAL", "GREATER_THAN", "GREATER_THAN_OR_EQUAL", "LESS_THAN", "LESS_THAN_OR_EQUAL", "BETWEEN", "IN"}, false), + }, + }, + }, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"COMPLETE", "FAILED", "PARTIAL_COMPLETE", "UNAVAILABLE"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "jobs": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "actual_bytes": { + Type: schema.TypeString, + Computed: true, + }, + "actual_items": { + Type: schema.TypeString, + Computed: true, + }, + "back_job_name": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "backup_job_id": { + Type: schema.TypeString, + Computed: true, + }, + "backup_type": { + Type: schema.TypeString, + Computed: true, + }, + "bucket": { + Type: schema.TypeString, + Computed: true, + }, + "bytes_done": { + Type: schema.TypeString, + Computed: true, + }, + "bytes_total": { + Type: schema.TypeString, + Computed: true, + }, + "complete_time": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "exclude": { + Type: schema.TypeString, + Computed: true, + }, + "file_system_id": { + Type: schema.TypeString, + Computed: true, + }, + "include": { + Type: schema.TypeString, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "items_done": { + Type: schema.TypeString, + Computed: true, + }, + "items_total": { + Type: schema.TypeString, + Computed: true, + }, + "nas_create_time": { + Type: schema.TypeString, + Computed: true, + }, + "paths": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "plan_id": { + Type: schema.TypeString, + Computed: true, + }, + "prefix": { + Type: schema.TypeString, + Computed: true, + }, + "source_type": { + Type: schema.TypeString, + Computed: true, + }, + "start_time": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "updated_time": { + Type: schema.TypeString, + Computed: true, + }, + "vault_id": { + Type: schema.TypeString, + Computed: true, + }, + "progress": { + Type: schema.TypeString, + Computed: true, + }, + "error_message": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudHbrBackupJobsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeBackupJobs2" + request := make(map[string]interface{}) + + if v, ok := d.GetOk("sort_direction"); ok { + request["SortDirection"] = v + } + request["SourceType"] = d.Get("source_type") + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + + if v, ok := d.GetOk("filter"); ok { + for filterPtr, filter := range v.([]interface{}) { + filterArg := filter.(map[string]interface{}) + request[fmt.Sprintf("Filters.%d.Key", filterPtr+1)] = filterArg["key"] + request[fmt.Sprintf("Filters.%d.Operator", filterPtr+1)] = filterArg["operator"] + if filterArg["key"] == "CompleteTime" { + for valuePtr, value := range filterArg["values"].([]interface{}) { + request[fmt.Sprintf("Filters.%d.Values.%d", filterPtr+1, valuePtr+1)] = strconv.FormatInt(ConvertNasFileSystemStringToUnix(value.(string)), 10) + } + } else { + for valuePtr, value := range filterArg["values"].([]interface{}) { + request[fmt.Sprintf("Filters.%d.Values.%d", filterPtr+1, valuePtr+1)] = value + } + } + } + } + + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewHbrClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-09-08"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_hbr_backup_jobs", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + resp, err := jsonpath.Get("$.BackupJobs.BackupJob", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.BackupJobs.BackupJob", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["JobId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["Status"].(string) { + continue + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "actual_bytes": fmt.Sprint(object["ActualBytes"]), + "actual_items": fmt.Sprint(object["ActualItems"]), + "back_job_name": object["JobName"], + "id": fmt.Sprint(object["JobId"]), + "backup_job_id": fmt.Sprint(object["JobId"]), + "backup_type": object["BackupType"], + "bucket": object["Bucket"], + "bytes_done": fmt.Sprint(object["BytesDone"]), + "bytes_total": fmt.Sprint(object["BytesTotal"]), + "complete_time": fmt.Sprint(object["CompleteTime"]), + "create_time": fmt.Sprint(object["CreatedTime"]), + "exclude": object["Exclude"], + "file_system_id": object["FileSystemId"], + "include": object["Include"], + "instance_id": object["InstanceId"], + "items_done": fmt.Sprint(object["ItemsDone"]), + "items_total": fmt.Sprint(object["ItemsTotal"]), + "progress": fmt.Sprint(object["Progress"]), + "nas_create_time": fmt.Sprint(object["CreateTime"]), + "plan_id": object["PlanId"], + "prefix": object["Prefix"], + "source_type": object["SourceType"], + "error_message": object["ErrorMessage"], + "start_time": fmt.Sprint(object["StartTime"]), + "status": object["Status"], + "updated_time": fmt.Sprint(object["UpdatedTime"]), + "vault_id": object["VaultId"], + } + if object["Path"] != nil { + mapping["path"] = object["Paths"].(map[string]interface{})["Path"] + } + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("jobs", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_hbr_ecs_backup_plans.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_hbr_ecs_backup_plans.go index 1fc798f7316..b253638f9c3 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_hbr_ecs_backup_plans.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_hbr_ecs_backup_plans.go @@ -58,6 +58,10 @@ func dataSourceAlicloudHbrEcsBackupPlans() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "source_type": { + Type: schema.TypeString, + Computed: true, + }, "create_time": { Type: schema.TypeString, Computed: true, @@ -66,6 +70,14 @@ func dataSourceAlicloudHbrEcsBackupPlans() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "created_time": { + Type: schema.TypeString, + Computed: true, + }, + "updated_time": { + Type: schema.TypeString, + Computed: true, + }, "disabled": { Type: schema.TypeBool, Computed: true, @@ -222,8 +234,11 @@ func dataSourceAlicloudHbrEcsBackupPlansRead(d *schema.ResourceData, meta interf for _, object := range objects { mapping := map[string]interface{}{ "backup_type": object["BackupType"], + "source_type": object["SourceType"], "create_time": fmt.Sprint(object["CreateTime"]), "detail": object["Detail"], + "created_time": fmt.Sprint(object["CreatedTime"]), + "updated_time": fmt.Sprint(object["UpdatedTime"]), "disabled": object["Disabled"], "id": fmt.Sprint(object["PlanId"]), "ecs_backup_plan_id": fmt.Sprint(object["PlanId"]), diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_hbr_nas_backup_plans.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_hbr_nas_backup_plans.go index 04f1e692d71..6daa335a8fa 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_hbr_nas_backup_plans.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_hbr_nas_backup_plans.go @@ -103,6 +103,14 @@ func dataSourceAlicloudHbrNasBackupPlans() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "created_time": { + Type: schema.TypeString, + Computed: true, + }, + "updated_time": { + Type: schema.TypeString, + Computed: true, + }, }, }, }, @@ -217,6 +225,8 @@ func dataSourceAlicloudHbrNasBackupPlansRead(d *schema.ResourceData, meta interf "retention": fmt.Sprint(object["Retention"]), "schedule": object["Schedule"], "vault_id": object["VaultId"], + "created_time": fmt.Sprint(object["CreatedTime"]), + "updated_time": fmt.Sprint(object["UpdatedTime"]), } if object["Path"] != nil { mapping["path"] = object["Paths"].(map[string]interface{})["Path"] diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_hbr_oss_backup_plans.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_hbr_oss_backup_plans.go index 3d88c416799..7fc52b602a1 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_hbr_oss_backup_plans.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_hbr_oss_backup_plans.go @@ -94,6 +94,14 @@ func dataSourceAlicloudHbrOssBackupPlans() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "created_time": { + Type: schema.TypeString, + Computed: true, + }, + "updated_time": { + Type: schema.TypeString, + Computed: true, + }, }, }, }, @@ -209,6 +217,8 @@ func dataSourceAlicloudHbrOssBackupPlansRead(d *schema.ResourceData, meta interf for _, object := range objects { mapping := map[string]interface{}{ "backup_type": object["BackupType"], + "created_time": fmt.Sprint(object["CreatedTime"]), + "updated_time": fmt.Sprint(object["UpdatedTime"]), "bucket": object["Bucket"], "disabled": object["Disabled"], "id": fmt.Sprint(object["PlanId"]), diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_hbr_replication_vault_regions.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_hbr_replication_vault_regions.go new file mode 100644 index 00000000000..a21058f38b4 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_hbr_replication_vault_regions.go @@ -0,0 +1,91 @@ +package alicloud + +import ( + "fmt" + "strconv" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudHbrReplicationVaultRegions() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudHbrReplicationVaultRegionsRead, + Schema: map[string]*schema.Schema{ + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "regions": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "replication_region_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudHbrReplicationVaultRegionsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DescribeVaultReplicationRegions" + request := make(map[string]interface{}) + var response map[string]interface{} + conn, err := client.NewHbrClient() + if err != nil { + return WrapError(err) + } + + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-09-08"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_hbr_replication_vault_regions", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Regions.RegionId", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Regions", response) + } + result, _ := resp.([]interface{}) + s := make([]map[string]interface{}, 0) + for _, v := range result { + mapping := map[string]interface{}{ + "replication_region_id": fmt.Sprint(v), + } + + s = append(s, mapping) + } + + d.SetId(strconv.FormatInt(time.Now().Unix(), 16)) + if err := d.Set("regions", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_hbr_restore_jobs.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_hbr_restore_jobs.go new file mode 100644 index 00000000000..d8130bf150c --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_hbr_restore_jobs.go @@ -0,0 +1,363 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudHbrRestoreJobs() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudHbrRestoreJobsRead, + Schema: map[string]*schema.Schema{ + "restore_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"ECS_FILE", "NAS", "OSS"}, false), + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"CANCELED", "CANCELING", "COMPLETE", "CREATED", "EXPIRED", "FAILED", "PARTIAL_COMPLETE", "QUEUED", "RUNNING"}, false), + }, + "restore_id": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "source_type": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "target_bucket": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "target_file_system_id": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "target_instance_id": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "vault_id": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "ids": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "jobs": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, + "actual_bytes": { + Type: schema.TypeString, + Computed: true, + }, + "actual_items": { + Type: schema.TypeString, + Computed: true, + }, + "bytes_done": { + Type: schema.TypeString, + Computed: true, + }, + "bytes_total": { + Type: schema.TypeString, + Computed: true, + }, + "complete_time": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "error_file": { + Type: schema.TypeString, + Computed: true, + }, + "error_message": { + Type: schema.TypeString, + Computed: true, + }, + "expire_time": { + Type: schema.TypeString, + Computed: true, + }, + "items_done": { + Type: schema.TypeString, + Computed: true, + }, + "items_total": { + Type: schema.TypeString, + Computed: true, + }, + "options": { + Type: schema.TypeString, + Computed: true, + }, + "parent_id": { + Type: schema.TypeString, + Computed: true, + }, + "progress": { + Type: schema.TypeInt, + Computed: true, + }, + "restore_job_id": { + Type: schema.TypeString, + Computed: true, + }, + "restore_type": { + Type: schema.TypeString, + Computed: true, + }, + "snapshot_hash": { + Type: schema.TypeString, + Computed: true, + }, + "snapshot_id": { + Type: schema.TypeString, + Computed: true, + }, + "source_type": { + Type: schema.TypeString, + Computed: true, + }, + "start_time": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "target_bucket": { + Type: schema.TypeString, + Computed: true, + }, + "target_client_id": { + Type: schema.TypeString, + Computed: true, + }, + "target_create_time": { + Type: schema.TypeString, + Computed: true, + }, + "target_data_source_id": { + Type: schema.TypeString, + Computed: true, + }, + "target_file_system_id": { + Type: schema.TypeString, + Computed: true, + }, + "target_instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "target_path": { + Type: schema.TypeString, + Computed: true, + }, + "target_prefix": { + Type: schema.TypeString, + Computed: true, + }, + "updated_time": { + Type: schema.TypeString, + Computed: true, + }, + "vault_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudHbrRestoreJobsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeRestoreJobs2" + request := make(map[string]interface{}) + request["RestoreType"] = d.Get("restore_type") + + filtersMapList := make([]map[string]interface{}, 0) + if v, ok := d.GetOk("vault_id"); ok { + filtersMapList = append(filtersMapList, map[string]interface{}{ + "Key": "vaultId", + "Values": v, + }) + } + if v, ok := d.GetOk("restore_id"); ok { + filtersMapList = append(filtersMapList, map[string]interface{}{ + "Key": "restoreId", + "Values": v, + }) + } + if v, ok := d.GetOk("source_type"); ok { + filtersMapList = append(filtersMapList, map[string]interface{}{ + "Key": "sourceType", + "Values": v, + }) + } + if v, ok := d.GetOk("target_bucket"); ok { + filtersMapList = append(filtersMapList, map[string]interface{}{ + "Key": "targetBucket", + "Values": v, + }) + } + if v, ok := d.GetOk("target_file_system_id"); ok { + filtersMapList = append(filtersMapList, map[string]interface{}{ + "Key": "targetFileSystemId", + "Values": v, + }) + } + if v, ok := d.GetOk("target_instance_id"); ok { + filtersMapList = append(filtersMapList, map[string]interface{}{ + "Key": "targetInstanceId", + "Values": v, + }) + } + request["Filters"] = filtersMapList + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewHbrClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-09-08"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_hbr_restore_jobs", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + resp, err := jsonpath.Get("$.RestoreJobs.RestoreJob", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.RestoreJobs.RestoreJob", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if statusOk && status.(string) != "" && status.(string) != item["Status"].(string) { + continue + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "id": fmt.Sprint(object["RestoreId"], ":", object["RestoreType"]), + "actual_bytes": fmt.Sprint(object["ActualBytes"]), + "actual_items": fmt.Sprint(object["ActualItems"]), + "bytes_done": fmt.Sprint(object["BytesDone"]), + "bytes_total": fmt.Sprint(object["BytesTotal"]), + "complete_time": fmt.Sprint(object["CompleteTime"]), + "create_time": fmt.Sprint(object["CreatedTime"]), + "error_file": object["ErrorFile"], + "error_message": object["ErrorMessage"], + "expire_time": fmt.Sprint(object["ExpireTime"]), + "items_done": fmt.Sprint(object["ItemsDone"]), + "items_total": fmt.Sprint(object["ItemsTotal"]), + "options": object["Options"], + "parent_id": object["ParentId"], + "progress": formatInt(object["Progress"]), + "restore_job_id": object["RestoreId"], + "restore_type": object["RestoreType"], + "snapshot_hash": object["SnapshotHash"], + "snapshot_id": object["SnapshotId"], + "source_type": object["SourceType"], + "start_time": fmt.Sprint(object["StartTime"]), + "status": object["Status"], + "target_bucket": object["TargetBucket"], + "target_client_id": object["TargetClientId"], + "target_create_time": fmt.Sprint(object["TargetCreateTime"]), + "target_data_source_id": object["TargetDataSourceId"], + "target_file_system_id": object["TargetFileSystemId"], + "target_instance_id": object["TargetInstanceId"], + "target_path": object["TargetPath"], + "target_prefix": object["TargetPrefix"], + "updated_time": fmt.Sprint(object["UpdatedTime"]), + "vault_id": object["VaultId"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("jobs", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_hbr_server_backup_plans.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_hbr_server_backup_plans.go new file mode 100644 index 00000000000..bf361b798b8 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_hbr_server_backup_plans.go @@ -0,0 +1,266 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudHbrServerBackupPlans() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudHbrServerBackupPlansRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "filters": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "values": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + }, + }, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "plans": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "detail": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "app_consistent": { + Type: schema.TypeBool, + Computed: true, + }, + "snapshot_group": { + Type: schema.TypeBool, + Computed: true, + }, + "enable_fs_freeze": { + Type: schema.TypeBool, + Computed: true, + }, + "pre_script_path": { + Type: schema.TypeString, + Computed: true, + }, + "post_script_path": { + Type: schema.TypeString, + Computed: true, + }, + "timeout_in_seconds": { + Type: schema.TypeInt, + Computed: true, + }, + "disk_id_list": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "do_copy": { + Type: schema.TypeBool, + Computed: true, + }, + "destination_region_id": { + Type: schema.TypeString, + Computed: true, + }, + "destination_retention": { + Type: schema.TypeInt, + Computed: true, + }, + }, + }, + }, + "disabled": { + Type: schema.TypeBool, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "ecs_server_backup_plan_id": { + Type: schema.TypeString, + Computed: true, + }, + "ecs_server_backup_plan_name": { + Type: schema.TypeString, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "retention": { + Type: schema.TypeString, + Computed: true, + }, + "schedule": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudHbrServerBackupPlansRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeBackupPlans" + request := make(map[string]interface{}) + if v, ok := d.GetOk("filters"); ok { + for filtersPtr, filters := range v.([]interface{}) { + filtersArg := filters.(map[string]interface{}) + request[fmt.Sprintf("Filters.%d.Key", filtersPtr+1)] = filtersArg["key"] + for valuesPtr, values := range filtersArg["values"].([]interface{}) { + request[fmt.Sprintf("Filters.%d.Values.%d", filtersPtr+1, valuesPtr+1)] = values + } + } + } + request["SourceType"] = "UDM_ECS" + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewHbrClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-09-08"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_hbr_server_backup_plans", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + resp, err := jsonpath.Get("$.BackupPlans.BackupPlan", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.BackupPlans.BackupPlan", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["PlanId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "create_time": fmt.Sprint(object["CreatedTime"]), + "disabled": object["Disabled"], + "id": fmt.Sprint(object["PlanId"]), + "ecs_server_backup_plan_id": fmt.Sprint(object["PlanId"]), + "ecs_server_backup_plan_name": object["PlanName"], + "instance_id": object["InstanceId"], + "retention": fmt.Sprint(object["Retention"]), + "schedule": object["Schedule"], + } + if v, ok := object["Detail"].(map[string]interface{}); ok { + details := make([]map[string]interface{}, 0) + detail := make(map[string]interface{}) + detail["app_consistent"] = v["appConsistent"] + detail["snapshot_group"] = v["snapshotGroup"] + detail["enable_fs_freeze"] = v["enableFsFreeze"] + detail["pre_script_path"] = v["preScriptPath"] + detail["post_script_path"] = v["postScriptPath"] + detail["timeout_in_seconds"] = formatInt(v["timeoutInSeconds"]) + detail["do_copy"] = v["doCopy"] + detail["destination_region_id"] = v["destinationRegionId"] + detail["destination_retention"] = v["destinationRetention"] + if v["diskIdList"] != nil { + detail["disk_id_list"] = expandStringList(v["diskIdList"].([]interface{})) + } + details = append(details, detail) + mapping["detail"] = details + } + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("plans", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_hbr_snapshots.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_hbr_snapshots.go new file mode 100644 index 00000000000..717f3dd5428 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_hbr_snapshots.go @@ -0,0 +1,403 @@ +package alicloud + +import ( + "fmt" + "strconv" + "strings" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudHbrSnapshots() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudHbrSnapshotsRead, + Schema: map[string]*schema.Schema{ + "limit": { + Type: schema.TypeInt, + Optional: true, + ForceNew: true, + }, + "query": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "source_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"ECS_FILE", "OSS", "NAS"}, false), + }, + "vault_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "instance_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "file_system_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "create_time": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "bucket": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "complete_time": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "complete_time_checker": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"MATCH_TERM", "GREATER_THAN", "GREATER_THAN_OR_EQUAL", "LESS_THAN", "LESS_THAN_OR_EQUAL", "BETWEEN", "IN", "NOT_IN"}, false), + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"COMPLETE", "PARTIAL_COMPLETE"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "snapshots": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "actual_bytes": { + Type: schema.TypeString, + Computed: true, + }, + "actual_items": { + Type: schema.TypeString, + Computed: true, + }, + "backup_type": { + Type: schema.TypeString, + Computed: true, + }, + "bucket": { + Type: schema.TypeString, + Computed: true, + }, + "bytes_done": { + Type: schema.TypeString, + Computed: true, + }, + "bytes_total": { + Type: schema.TypeString, + Computed: true, + }, + "complete_time": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "created_time": { + Type: schema.TypeString, + Computed: true, + }, + "error_file": { + Type: schema.TypeString, + Computed: true, + }, + "file_system_id": { + Type: schema.TypeString, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "items_done": { + Type: schema.TypeString, + Computed: true, + }, + "items_total": { + Type: schema.TypeString, + Computed: true, + }, + "job_id": { + Type: schema.TypeString, + Computed: true, + }, + "parent_snapshot_hash": { + Type: schema.TypeString, + Computed: true, + }, + "path": { + Type: schema.TypeString, + Computed: true, + }, + "prefix": { + Type: schema.TypeString, + Computed: true, + }, + "client_id": { + Type: schema.TypeString, + Computed: true, + }, + "retention": { + Type: schema.TypeString, + Computed: true, + }, + "snapshot_hash": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "snapshot_id": { + Type: schema.TypeString, + Computed: true, + }, + "source_type": { + Type: schema.TypeString, + Computed: true, + }, + "start_time": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "updated_time": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +type QueryField struct { + Field string `json:"field"` + Value string `json:"value"` + Operation string `json:"operation"` +} + +func dataSourceAlicloudHbrSnapshotsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "SearchHistoricalSnapshots" + request := make(map[string]interface{}) + if v, ok := d.GetOk("limit"); ok { + request["Limit"] = v + } + request["SourceType"] = d.Get("source_type") + + filtersMapList := make([]map[string]interface{}, 0) + + if v, ok := d.GetOk("vault_id"); ok { + filtersMapList = append(filtersMapList, map[string]interface{}{ + "field": "VaultId", + "value": v.(string), + "operation": "MATCH_TERM", + }) + } + if v, ok := d.GetOk("instance_id"); ok { + filtersMapList = append(filtersMapList, map[string]interface{}{ + "field": "InstanceId", + "value": v.(string), + "operation": "MATCH_TERM", + }) + } + if v, ok := d.GetOk("bucket"); ok { + filtersMapList = append(filtersMapList, map[string]interface{}{ + "field": "Bucket", + "value": v.(string), + "operation": "MATCH_TERM", + }) + } + if v, ok := d.GetOk("file_system_id"); ok { + filtersMapList = append(filtersMapList, map[string]interface{}{ + "field": "FileSystemId", + "value": v.(string), + "operation": "MATCH_TERM", + }) + } + if v, ok := d.GetOk("create_time"); ok { + filtersMapList = append(filtersMapList, map[string]interface{}{ + "field": "CreateTime", + "value": strconv.FormatInt(ConvertNasFileSystemStringToUnix(v.(string)), 10), + "operation": "MATCH_TERM", + }) + } + if v, ok := d.GetOk("complete_time"); ok { + completeChecker := make(map[string]interface{}) + completeChecker["field"] = "CompleteTime" + completeChecker["operation"] = "MATCH_TERM" + if vv, ok := d.GetOk("complete_time_checker"); ok { + completeChecker["operation"] = vv.(string) + } + if completeChecker["operation"] == "BETWEEN" { + timeSection := strings.Split(v.(string), ",") + completeChecker["value"] = ConvertNasFileSystemStringToUnix(timeSection[0]) + completeChecker["value2"] = ConvertNasFileSystemStringToUnix(timeSection[1]) + } else { + completeChecker["value"] = ConvertNasFileSystemStringToUnix(v.(string)) + } + filtersMapList = append(filtersMapList, completeChecker) + } + if v, ok := d.GetOk("status"); ok { + filtersMapList = append(filtersMapList, map[string]interface{}{ + "field": "Status", + "value": v.(string), + "operation": "MATCH_TERM", + }) + } + request["Query"], _ = convertListMapToJsonString(filtersMapList) + + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewHbrClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-09-08"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_hbr_snapshots", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + resp, err := jsonpath.Get("$.Snapshots.Snapshot", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Snapshots.Snapshot", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["SnapshotId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["Status"].(string) { + continue + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "actual_bytes": fmt.Sprint(object["ActualBytes"]), + "actual_items": fmt.Sprint(object["ActualItems"]), + "backup_type": object["BackupType"], + "bucket": object["Bucket"], + "bytes_done": fmt.Sprint(object["BytesDone"]), + "bytes_total": fmt.Sprint(object["BytesTotal"]), + "complete_time": fmt.Sprint(object["CompleteTime"]), + "create_time": fmt.Sprint(object["CreateTime"]), + "created_time": fmt.Sprint(object["CreatedTime"]), + "error_file": object["ErrorFile"], + "file_system_id": object["FileSystemId"], + "instance_id": object["InstanceId"], + "items_done": fmt.Sprint(object["ItemsDone"]), + "items_total": fmt.Sprint(object["ItemsTotal"]), + "job_id": object["JobId"], + "parent_snapshot_hash": object["ParentSnapshotHash"], + "prefix": object["Prefix"], + "client_id": object["ClientId"], + "retention": fmt.Sprint(object["Retention"]), + "snapshot_hash": object["SnapshotHash"], + "id": fmt.Sprint(object["SnapshotId"]), + "snapshot_id": fmt.Sprint(object["SnapshotId"]), + "source_type": object["SourceType"], + "start_time": fmt.Sprint(object["StartTime"]), + "status": object["Status"], + "updated_time": fmt.Sprint(object["UpdatedTime"]), + } + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("snapshots", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_hbr_vaults.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_hbr_vaults.go index 1f9b97887e9..edabf9346e9 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_hbr_vaults.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_hbr_vaults.go @@ -65,7 +65,7 @@ func dataSourceAlicloudHbrVaults() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "create_time": { + "created_time": { Type: schema.TypeString, Computed: true, }, @@ -254,7 +254,7 @@ func dataSourceAlicloudHbrVaultsRead(d *schema.ResourceData, meta interface{}) e mapping := map[string]interface{}{ "bucket_name": object["BucketName"], "bytes_done": fmt.Sprint(object["BytesDone"]), - "create_time": fmt.Sprint(object["CreatedTime"]), + "created_time": fmt.Sprint(object["CreatedTime"]), "dedup": object["Dedup"], "description": object["Description"], "index_available": object["IndexAvailable"], diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_images.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_images.go index 0b6db5da1fd..f7c5f8bcbba 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_images.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_images.go @@ -52,6 +52,14 @@ func dataSourceAlicloudImages() *schema.Resource { Default: "Available", ValidateFunc: validation.StringInSlice([]string{"Available", "Creating", "Waiting", "UnAvailable", "CreateFailed", "Deprecated"}, false), }, + "image_id": { + Type: schema.TypeString, + Optional: true, + }, + "image_name": { + Type: schema.TypeString, + Optional: true, + }, "is_support_io_optimized": { Type: schema.TypeBool, Optional: true, @@ -240,7 +248,7 @@ func dataSourceAlicloudImagesRead(d *schema.ResourceData, meta interface{}) erro request := ecs.CreateDescribeImagesRequest() request.PageNumber = requests.NewInteger(1) - request.PageSize = requests.NewInteger(PageSizeLarge) + request.PageSize = requests.NewInteger(PageSizeXLarge) if ownersOk { request.ImageOwnerAlias = owners.(string) @@ -250,6 +258,14 @@ func dataSourceAlicloudImagesRead(d *schema.ResourceData, meta interface{}) erro request.Status = status.(string) } + if v, ok := d.GetOk("image_id"); ok && v.(string) != "" { + request.ImageId = v.(string) + } + + if v, ok := d.GetOk("image_name"); ok && v.(string) != "" { + request.ImageName = v.(string) + } + if v, ok := d.GetOk("snapshot_id"); ok && v.(string) != "" { request.SnapshotId = v.(string) } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_imm_projects.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_imm_projects.go new file mode 100644 index 00000000000..864fad6a47f --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_imm_projects.go @@ -0,0 +1,172 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudImmProjects() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudImmProjectsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "projects": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "billing_type": { + Type: schema.TypeString, + Computed: true, + }, + "compute_unit": { + Type: schema.TypeInt, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "modify_time": { + Type: schema.TypeString, + Computed: true, + }, + "type": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "project": { + Type: schema.TypeString, + Computed: true, + }, + "service_role": { + Type: schema.TypeString, + Computed: true, + }, + "endpoint": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudImmProjectsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListProjects" + request := map[string]interface{}{ + "MaxKeys": PageSizeLarge, + "RegionId": client.RegionId, + } + + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewImmClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-09-06"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_imm_projects", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Projects", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Projects", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["Project"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if marker, ok := response["Marker"].(string); ok && marker != "" { + request["Marker"] = marker + } else { + break + } + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "billing_type": object["BillingType"], + "compute_unit": formatInt(object["CU"]), + "create_time": object["CreateTime"], + "modify_time": object["ModifyTime"], + "type": object["Type"], + "id": fmt.Sprint(object["Project"]), + "project": fmt.Sprint(object["Project"]), + "service_role": object["ServiceRole"], + "endpoint": object["Endpoint"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("projects", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_imp_app_templates.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_imp_app_templates.go new file mode 100644 index 00000000000..fa72d97f9be --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_imp_app_templates.go @@ -0,0 +1,248 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudImpAppTemplates() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudImpAppTemplatesRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"attached", "unattached"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "templates": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "app_template_creator": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "app_template_id": { + Type: schema.TypeString, + Computed: true, + }, + "app_template_name": { + Type: schema.TypeString, + Computed: true, + }, + "component_list": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "config_list": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Computed: true, + }, + "value": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "integration_mode": { + Type: schema.TypeString, + Computed: true, + }, + "scene": { + Type: schema.TypeString, + Computed: true, + }, + "sdk_info": { + Type: schema.TypeString, + Computed: true, + }, + "standard_room_info": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudImpAppTemplatesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListAppTemplates" + request := make(map[string]interface{}) + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + var appTemplateNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + appTemplateNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewImpClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-06-30"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_imp_app_templates", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Result.AppTemplateInfoList", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Result.AppTemplateInfoList", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if appTemplateNameRegex != nil && !appTemplateNameRegex.MatchString(fmt.Sprint(item["AppTemplateName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["AppTemplateId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["Status"].(string) { + continue + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "app_template_creator": object["AppTemplateCreator"], + "id": fmt.Sprint(object["AppTemplateId"]), + "app_template_id": fmt.Sprint(object["AppTemplateId"]), + "app_template_name": object["AppTemplateName"], + "component_list": object["ComponentList"], + "create_time": object["CreateTime"], + "integration_mode": object["IntegrationMode"], + "scene": object["Scene"], + "sdk_info": object["SdkInfo"], + "standard_room_info": object["StandardRoomInfo"], + "status": object["Status"], + } + if configList, ok := object["ConfigList"]; ok && configList != nil { + configListMaps := make([]map[string]interface{}, 0) + for _, configListItem := range configList.([]interface{}) { + if configListItemMap, ok := configListItem.(map[string]interface{}); ok { + configListMap := make(map[string]interface{}, 0) + configListMap["key"] = configListItemMap["Key"] + configListMap["value"] = configListItemMap["Value"] + configListMaps = append(configListMaps, configListMap) + } + } + mapping["config_list"] = configListMaps + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["AppTemplateName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("templates", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_instance_types.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_instance_types.go index 1d991a95edc..926359e3f5f 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_instance_types.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_instance_types.go @@ -110,7 +110,6 @@ func dataSourceAlicloudInstanceTypes() *schema.Resource { Type: schema.TypeString, Optional: true, ForceNew: true, - Default: "cloud_efficiency", ValidateFunc: validation.StringInSlice([]string{"cloud", "ephemeral_ssd", "cloud_essd", "cloud_efficiency", "cloud_ssd"}, false), }, "output_file": { @@ -231,15 +230,15 @@ func dataSourceAlicloudInstanceTypesRead(d *schema.ResourceData, meta interface{ continue } for _, r := range zone.AvailableResources.AvailableResource { - if r.Type == string(InstanceTypeResource) { - for _, t := range r.SupportedResources.SupportedResource { - if t.Status == string(SoldOut) { - continue - } - - zones, _ := mapInstanceTypes[t.Value] - zones = append(zones, zone.ZoneId) - mapInstanceTypes[t.Value] = zones + for _, t := range r.SupportedResources.SupportedResource { + if t.Status == string(SoldOut) { + continue + } + if v, ok := mapInstanceTypes[t.Value]; ok { + v = append(v, zone.ZoneId) + mapInstanceTypes[t.Value] = v + } else { + mapInstanceTypes[t.Value] = []string{zone.ZoneId} } } } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_instances.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_instances.go index 76a645872b1..066500ba5c4 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_instances.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_instances.go @@ -2,6 +2,7 @@ package alicloud import ( "regexp" + "strconv" "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" "github.com/aliyun/alibaba-cloud-sdk-go/services/ecs" @@ -79,6 +80,14 @@ func dataSourceAlicloudInstances() *schema.Resource { Optional: true, ForceNew: true, }, + "page_number": { + Type: schema.TypeInt, + Optional: true, + }, + "page_size": { + Type: schema.TypeInt, + Optional: true, + }, // Computed values "names": { @@ -209,6 +218,10 @@ func dataSourceAlicloudInstances() *schema.Resource { }, }, }, + "total_count": { + Type: schema.TypeInt, + Computed: true, + }, }, } } @@ -247,9 +260,18 @@ func dataSourceAlicloudInstancesRead(d *schema.ResourceData, meta interface{}) e } var allInstances []ecs.Instance - request.PageSize = requests.NewInteger(PageSizeLarge) - request.PageNumber = requests.NewInteger(1) + if v, ok := d.GetOk("page_number"); ok && v.(int) > 0 { + request.PageNumber = requests.NewInteger(v.(int)) + } else { + request.PageNumber = requests.NewInteger(1) + } + if v, ok := d.GetOk("page_size"); ok && v.(int) > 0 { + request.PageSize = requests.NewInteger(v.(int)) + } else { + request.PageSize = requests.NewInteger(PageSizeLarge) + } + var response *ecs.DescribeInstancesResponse for { raw, err := client.WithEcsClient(func(ecsClient *ecs.Client) (interface{}, error) { return ecsClient.DescribeInstances(request) @@ -258,14 +280,22 @@ func dataSourceAlicloudInstancesRead(d *schema.ResourceData, meta interface{}) e return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_instances", request.GetActionName(), AlibabaCloudSdkGoERROR) } addDebug(request.GetActionName(), raw, request.RpcRequest, request) - response, _ := raw.(*ecs.DescribeInstancesResponse) + response, _ = raw.(*ecs.DescribeInstancesResponse) + if isPagingRequest(d) { + allInstances = response.Instances.Instance + break + } if len(response.Instances.Instance) < 1 { break } allInstances = append(allInstances, response.Instances.Instance...) + pageSize, err := strconv.Atoi(string(request.PageSize)) + if err != nil { + return WrapError(err) + } - if len(response.Instances.Instance) < PageSizeLarge { + if len(response.Instances.Instance) < pageSize { break } @@ -349,11 +379,11 @@ func dataSourceAlicloudInstancesRead(d *schema.ResourceData, meta interface{}) e return WrapError(err) } - return instancessDescriptionAttributes(d, filteredInstancesTemp, instanceRoleNameMap, instanceDiskMappings, meta) + return instancessDescriptionAttributes(d, filteredInstancesTemp, instanceRoleNameMap, instanceDiskMappings, meta, response.TotalCount) } // populate the numerous fields that the instance description returns. -func instancessDescriptionAttributes(d *schema.ResourceData, instances []ecs.Instance, instanceRoleNameMap map[string]string, instanceDisksMap map[string][]map[string]interface{}, meta interface{}) error { +func instancessDescriptionAttributes(d *schema.ResourceData, instances []ecs.Instance, instanceRoleNameMap map[string]string, instanceDisksMap map[string][]map[string]interface{}, meta interface{}, totalCount int) error { client := meta.(*connectivity.AliyunClient) ecsService := EcsService{client} var ids []string @@ -411,7 +441,9 @@ func instancessDescriptionAttributes(d *schema.ResourceData, instances []ecs.Ins if err := d.Set("instances", s); err != nil { return WrapError(err) } - + if err := d.Set("total_count", totalCount); err != nil { + return WrapError(err) + } // create a json file in current directory and write data source to it. if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { writeToFile(output.(string), s) diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_iot_device_groups.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_iot_device_groups.go new file mode 100644 index 00000000000..5661c837b50 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_iot_device_groups.go @@ -0,0 +1,224 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudIotDeviceGroups() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudIotDeviceGroupsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "group_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(0, 30), + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + }, + "iot_instance_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "super_group_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "groups": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "device_active": { + Type: schema.TypeString, + Computed: true, + }, + "device_count": { + Type: schema.TypeString, + Computed: true, + }, + "device_online": { + Type: schema.TypeString, + Computed: true, + }, + "error_message": { + Type: schema.TypeString, + Computed: true, + }, + "group_desc": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "group_id": { + Type: schema.TypeString, + Computed: true, + }, + "group_name": { + Type: schema.TypeString, + Computed: true, + }, + "success": { + Type: schema.TypeBool, + Computed: true, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudIotDeviceGroupsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "QueryDeviceGroupList" + request := make(map[string]interface{}) + if v, ok := d.GetOk("group_name"); ok { + request["GroupName"] = v + } + if v, ok := d.GetOk("iot_instance_id"); ok { + request["IotInstanceId"] = v + } + if v, ok := d.GetOk("super_group_id"); ok { + request["SuperGroupId"] = v + } + request["PageSize"] = PageSizeLarge + request["CurrentPage"] = 1 + var objects []map[string]interface{} + var nameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + nameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewIotClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-01-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_iot_device_groups", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + resp, err := jsonpath.Get("$.Data.GroupInfo", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Data.GroupInfo", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if nameRegex != nil { + if !nameRegex.MatchString(fmt.Sprint(item["GroupName"])) { + continue + } + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["GroupId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["CurrentPage"] = request["CurrentPage"].(int) + 1 + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "error_message": response["ErrorMessage"], + "success": response["Success"], + "create_time": object["UtcCreate"], + "group_desc": object["GroupDesc"], + "group_id": object["GroupId"], + "group_name": object["GroupName"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("groups", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_log_service.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_log_service.go index c50f12b0572..ec9d52d9b8c 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_log_service.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_log_service.go @@ -1,6 +1,9 @@ package alicloud import ( + "time" + + rpc "github.com/alibabacloud-go/tea-rpc/client" util "github.com/alibabacloud-go/tea-utils/service" "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" @@ -10,6 +13,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/validation" ) +const maxWaitTime = 60 + func dataSourceAlicloudLogService() *schema.Resource { return &schema.Resource{ Read: dataSourceAlicloudLogServiceRead, @@ -38,32 +43,55 @@ func dataSourceAlicloudLogServiceRead(d *schema.ResourceData, meta interface{}) if err != nil { return WrapError(err) } - response, err := conn.DoRequest(StringPointer("GetSlsService"), nil, StringPointer("POST"), StringPointer("2019-10-23"), StringPointer("AK"), nil, nil, &util.RuntimeOptions{}) - addDebug("GetSlsService", response, nil) - if err != nil { - return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_log_service", "GetLogService", AlibabaCloudSdkGoERROR) - } - - if response["Success"] != nil && !response["Success"].(bool) { - return WrapErrorf(fmt.Errorf("%s", response), DataDefaultErrorMsg, "alicloud_log_service", "GetLogService", AlibabaCloudSdkGoERROR) - } - if response["Enabled"] != nil && response["Enabled"].(bool) { + isNotOpened, err := waitServiceReady(conn, false) + if err == nil { d.SetId("LogServiceHasBeenOpened") d.Set("status", "Opened") return nil } - - response, err = conn.DoRequest(StringPointer("OpenSlsService"), nil, StringPointer("POST"), StringPointer("2019-10-23"), StringPointer("AK"), nil, nil, &util.RuntimeOptions{}) - addDebug("OpenSlsService", response, nil) - if err != nil { - return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_log_service", "OpenLogService", AlibabaCloudSdkGoERROR) + if isNotOpened { + response, err := conn.DoRequest(StringPointer("OpenSlsService"), nil, StringPointer("POST"), StringPointer("2019-10-23"), StringPointer("AK"), nil, nil, &util.RuntimeOptions{}) + addDebug("OpenSlsService", response, nil) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_log_service", "OpenLogService", AlibabaCloudSdkGoERROR) + } + if response["Success"] != nil && !response["Success"].(bool) { + return WrapErrorf(fmt.Errorf("%s", response), DataDefaultErrorMsg, "alicloud_log_service", "OpenLogService", AlibabaCloudSdkGoERROR) + } + _, err = waitServiceReady(conn, true) + if err == nil { + d.SetId("LogServiceHasBeenOpened") + d.Set("status", "Opened") + return nil + } + return WrapError(err) } + return WrapError(err) +} - if response["Success"] != nil && !response["Success"].(bool) { - return WrapErrorf(fmt.Errorf("%s", response), DataDefaultErrorMsg, "alicloud_log_service", "OpenLogService", AlibabaCloudSdkGoERROR) +func waitServiceReady(conn *rpc.Client, hasOpened bool) (bool, error) { + beginTime := time.Now().Unix() + for { + response, err := conn.DoRequest(StringPointer("GetSlsService"), nil, StringPointer("POST"), StringPointer("2019-10-23"), StringPointer("AK"), nil, nil, &util.RuntimeOptions{}) + addDebug("GetSlsService", response, nil) + if err != nil { + return false, WrapErrorf(err, DataDefaultErrorMsg, "alicloud_log_service", "GetLogService", AlibabaCloudSdkGoERROR) + } + if response["Success"] != nil && !response["Success"].(bool) { + return false, WrapErrorf(fmt.Errorf("%s", response), DataDefaultErrorMsg, "alicloud_log_service", "GetLogService", AlibabaCloudSdkGoERROR) + } + status := response["Status"].(string) + if "Opened" == status { + return false, nil + } + if hasOpened || "Opening" == status { + if time.Now().Unix()-beginTime >= maxWaitTime { + return false, fmt.Errorf("wait until the maxWaitTime(60s) is still in the %s state", status) + } + time.Sleep(time.Second) + continue + } + return true, fmt.Errorf("incorrect status: %s", status) } - d.SetId("LogServiceHasBeenOpened") - d.Set("status", "Opened") - return nil } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_mhub_apps.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_mhub_apps.go new file mode 100644 index 00000000000..106149ba341 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_mhub_apps.go @@ -0,0 +1,236 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudMhubApps() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudMhubAppsRead, + Schema: map[string]*schema.Schema{ + "product_id": { + Type: schema.TypeString, + Required: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "os_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Android", "iOS"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "apps": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, + "app_key": { + Type: schema.TypeString, + Computed: true, + }, + "app_name": { + Type: schema.TypeString, + Computed: true, + }, + "bundle_id": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "encoded_icon": { + Type: schema.TypeString, + Computed: true, + }, + "industry_id": { + Type: schema.TypeString, + Computed: true, + }, + "package_name": { + Type: schema.TypeString, + Computed: true, + }, + "product_id": { + Type: schema.TypeString, + Computed: true, + }, + "type": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudMhubAppsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListApps" + request := make(map[string]interface{}) + + if v, ok := d.GetOk("os_type"); ok { + request["OsType"] = convertTypeRequest(v.(string)) + } + ProductId := d.Get("product_id") + + request["ProductId"] = ProductId + request["PageSize"] = PageSizeLarge + request["Page"] = 1 + var objects []map[string]interface{} + var appNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + appNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewMhubClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-08-25"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_mhub_apps", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.AppInfos.AppInfo", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.AppInfos.AppInfo", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if appNameRegex != nil && !appNameRegex.MatchString(fmt.Sprint(item["Name"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprintf("%s:%s", ProductId, item["AppKey"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["Page"] = request["Page"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "id": fmt.Sprintf("%s:%s", ProductId, object["AppKey"]), + "app_key": fmt.Sprint(object["AppKey"]), + "app_name": object["Name"], + "bundle_id": object["BundleId"], + "encoded_icon": object["EncodedIcon"], + "industry_id": fmt.Sprint(object["IndustryId"]), + "package_name": object["PackageName"], + "type": convertTypeResponse(formatInt(object["Type"])), + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["Name"]) + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + s = append(s, mapping) + continue + } + id := fmt.Sprint(object["AppKey"]) + mhubService := MhubService{client} + getResp, err := mhubService.DescribeMhubApp(id) + if err != nil { + return WrapError(err) + } + mapping["create_time"] = getResp["CreateTime"] + mapping["product_id"] = getResp["ProductId"] + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("apps", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_mhub_products.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_mhub_products.go new file mode 100644 index 00000000000..fa3e090fae0 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_mhub_products.go @@ -0,0 +1,174 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudMhubProducts() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudMhubProductsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "products": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, + "product_id": { + Type: schema.TypeString, + Computed: true, + }, + "product_name": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudMhubProductsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListProducts" + request := make(map[string]interface{}) + + request["Offset"] = 0 + + request["Simple"] = false + + request["Size"] = PageSizeMedium + + var objects []map[string]interface{} + var productNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + productNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewMhubClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-08-25"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_mhub_products", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.ProductInfos.ProductInfo", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.ProductInfos.ProductInfo", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if productNameRegex != nil && !productNameRegex.MatchString(fmt.Sprint(item["Name"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["ProductId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeMedium { + break + } + request["Offset"] = request["Offset"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "id": fmt.Sprint(object["ProductId"]), + "product_id": fmt.Sprint(object["ProductId"]), + "product_name": object["Name"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["Name"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("products", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_mongodb_accounts.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_mongodb_accounts.go new file mode 100644 index 00000000000..60d05c64bcc --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_mongodb_accounts.go @@ -0,0 +1,136 @@ +package alicloud + +import ( + "fmt" + "strconv" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudMongodbAccounts() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudMongodbAccountsRead, + Schema: map[string]*schema.Schema{ + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "account_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"root"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "accounts": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "account_description": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "account_name": { + Type: schema.TypeString, + Computed: true, + }, + "character_type": { + Type: schema.TypeString, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudMongodbAccountsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeAccounts" + request := make(map[string]interface{}) + request["DBInstanceId"] = d.Get("instance_id") + if v, ok := d.GetOk("account_name"); ok { + request["AccountName"] = v + } + var objects []map[string]interface{} + var response map[string]interface{} + conn, err := client.NewDdsClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-12-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_mongodb_accounts", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Accounts.Account", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Accounts.Account", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + objects = append(objects, item) + } + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "account_description": object["AccountDescription"], + "id": fmt.Sprint(object["DBInstanceId"], ":", object["AccountName"]), + "account_name": fmt.Sprint(object["AccountName"]), + "character_type": object["CharacterType"], + "instance_id": object["DBInstanceId"], + "status": object["AccountStatus"], + } + s = append(s, mapping) + } + + d.SetId(strconv.FormatInt(time.Now().Unix(), 16)) + if err := d.Set("accounts", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_mongodb_audit_policies.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_mongodb_audit_policies.go new file mode 100644 index 00000000000..497c8c5d635 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_mongodb_audit_policies.go @@ -0,0 +1,81 @@ +package alicloud + +import ( + "fmt" + "strconv" + "time" + + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudMongodbAuditPolicies() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudMongodbAuditPoliciesRead, + Schema: map[string]*schema.Schema{ + "db_instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "policies": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, + "db_instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "audit_status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudMongodbAuditPoliciesRead(d *schema.ResourceData, meta interface{}) error { + + client := meta.(*connectivity.AliyunClient) + MongoDBService := MongoDBService{client} + dbInstanceId := d.Get("db_instance_id") + object, err := MongoDBService.DescribeMongodbAuditPolicy(dbInstanceId.(string)) + if err != nil { + if NotFoundError(err) { + d.SetId("MongodbAuditPolicy") + return nil + } + return WrapError(err) + } + + s := make([]map[string]interface{}, 0) + mapping := map[string]interface{}{ + "id": fmt.Sprint(object["DBInstanceId"]), + "db_instance_id": fmt.Sprint(object["DBInstanceId"]), + "audit_status": convertMongodbAuditPolicyResponse(object["LogAuditStatus"].(string)), + } + s = append(s, mapping) + + d.SetId(strconv.FormatInt(time.Now().Unix(), 16)) + + if err := d.Set("policies", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_mongodb_serverless_instances.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_mongodb_serverless_instances.go new file mode 100644 index 00000000000..a86354fa19e --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_mongodb_serverless_instances.go @@ -0,0 +1,412 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudMongodbServerlessInstances() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudMongodbServerlessInstancesRead, + Schema: map[string]*schema.Schema{ + "db_instance_class": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "db_instance_description": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "network_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Classic", "VPC"}, false), + }, + "resource_group_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Creating", "DBInstanceClassChanging", "DBInstanceNetTypeChanging", "Deleting", "EngineVersionUpgrading", "GuardSwitching", "HASwitching", "Importing", "ImportingFromOthers", "LinkSwitching", "MinorVersionUpgrading", "NodeCreating", "NodeDeleting", "Rebooting", "Restoring", "Running", "SSLModifying", "TDEModifying", "TempDBInstanceCreating", "Transing", "TransingToOthers", "released"}, false), + }, + "tags": tagsSchema(), + "vswitch_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "vpc_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "zone_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "instances": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "capacity_unit": { + Type: schema.TypeInt, + Computed: true, + }, + "payment_type": { + Type: schema.TypeString, + Computed: true, + }, + "db_instance_class": { + Type: schema.TypeString, + Computed: true, + }, + "db_instance_description": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "db_instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "db_instance_release_protection": { + Type: schema.TypeBool, + Computed: true, + }, + "db_instance_storage": { + Type: schema.TypeInt, + Computed: true, + }, + "engine": { + Type: schema.TypeString, + Computed: true, + }, + "engine_version": { + Type: schema.TypeString, + Computed: true, + }, + "expire_time": { + Type: schema.TypeString, + Computed: true, + }, + "kind_code": { + Type: schema.TypeString, + Computed: true, + }, + "lock_mode": { + Type: schema.TypeString, + Computed: true, + }, + "maintain_end_time": { + Type: schema.TypeString, + Computed: true, + }, + "maintain_start_time": { + Type: schema.TypeString, + Computed: true, + }, + "max_connections": { + Type: schema.TypeInt, + Computed: true, + }, + "max_iops": { + Type: schema.TypeInt, + Computed: true, + }, + "network_type": { + Type: schema.TypeString, + Computed: true, + }, + "protocol_type": { + Type: schema.TypeString, + Computed: true, + }, + "resource_group_id": { + Type: schema.TypeString, + Computed: true, + }, + "security_ip_groups": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "security_ip_group_attribute": { + Type: schema.TypeString, + Computed: true, + }, + "security_ip_group_name": { + Type: schema.TypeString, + Computed: true, + }, + "security_ip_list": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "storage_engine": { + Type: schema.TypeString, + Computed: true, + }, + "tags": { + Type: schema.TypeMap, + Computed: true, + }, + "vswitch_id": { + Type: schema.TypeString, + Computed: true, + }, + "vpc_auth_mode": { + Type: schema.TypeString, + Computed: true, + }, + "vpc_id": { + Type: schema.TypeString, + Computed: true, + }, + "zone_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudMongodbServerlessInstancesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeDBInstances" + request := make(map[string]interface{}) + if v, ok := d.GetOk("db_instance_class"); ok { + request["DBInstanceClass"] = v + } + if v, ok := d.GetOk("db_instance_description"); ok { + request["DBInstanceDescription"] = v + } + request["DBInstanceType"] = "serverless" + if v, ok := d.GetOk("network_type"); ok { + request["NetworkType"] = v + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("resource_group_id"); ok { + request["ResourceGroupId"] = v + } + status, statusOk := d.GetOk("status") + if v, ok := d.GetOk("tags"); ok { + tags := make([]map[string]interface{}, 0) + for key, value := range v.(map[string]interface{}) { + tags = append(tags, map[string]interface{}{ + "Key": key, + "Value": value.(string), + }) + } + request["Tag"] = tags + } + if v, ok := d.GetOk("vswitch_id"); ok { + request["VSwitchId"] = v + } + if v, ok := d.GetOk("vpc_id"); ok { + request["VpcId"] = v + } + if v, ok := d.GetOk("zone_id"); ok { + request["ZoneId"] = v + } + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewDdsClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-12-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_mongodb_serverless_instances", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.DBInstances.DBInstance", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.DBInstances.DBInstance", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["DBInstanceId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["DBInstanceStatus"].(string) { + continue + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "payment_type": convertMongodbServerlessInstancePayTypeResponse(object["ChargeType"].(string)), + "db_instance_class": object["DBInstanceClass"], + "db_instance_description": object["DBInstanceDescription"], + "id": fmt.Sprint(object["DBInstanceId"]), + "db_instance_id": fmt.Sprint(object["DBInstanceId"]), + "db_instance_storage": formatInt(object["DBInstanceStorage"]), + "engine": object["Engine"], + "engine_version": object["EngineVersion"], + "expire_time": object["ExpireTime"], + "kind_code": object["KindCode"], + "lock_mode": object["LockMode"], + "network_type": object["NetworkType"], + "resource_group_id": object["ResourceGroupId"], + "status": object["DBInstanceStatus"], + "vpc_auth_mode": object["VpcAuthMode"], + "zone_id": object["ZoneId"], + } + + tags := make(map[string]interface{}) + t, _ := jsonpath.Get("$.Tags.Tag", object) + if t != nil { + for _, t := range t.([]interface{}) { + key := t.(map[string]interface{})["Key"].(string) + value := t.(map[string]interface{})["Value"].(string) + if !ignoredTags(key, value) { + tags[key] = value + } + } + } + mapping["tags"] = tags + ids = append(ids, fmt.Sprint(mapping["id"])) + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + s = append(s, mapping) + continue + } + id := fmt.Sprint(object["DBInstanceId"]) + MongoDBService := MongoDBService{client} + getResp, err := MongoDBService.DescribeMongodbServerlessInstance(id) + if err != nil { + return WrapError(err) + } + mapping["capacity_unit"] = formatInt(getResp["CapacityUnit"]) + mapping["db_instance_release_protection"] = getResp["DBInstanceReleaseProtection"] + mapping["maintain_end_time"] = getResp["MaintainEndTime"] + mapping["maintain_start_time"] = getResp["MaintainStartTime"] + if v, ok := getResp["MaxConnections"]; ok && fmt.Sprint(v) != "0" { + mapping["max_connections"] = formatInt(v) + } + if v, ok := getResp["MaxIOPS"]; ok && fmt.Sprint(v) != "0" { + mapping["max_iops"] = formatInt(v) + } + mapping["protocol_type"] = getResp["ProtocolType"] + mapping["storage_engine"] = convertMongodbServerlessInstanceStorageEngineResponse(getResp["StorageEngine"].(string)) + mapping["vswitch_id"] = getResp["VSwitchId"] + mapping["vpc_id"] = getResp["VPCId"] + getResp1, err := MongoDBService.DescribeSecurityIps(id) + if err != nil { + return WrapError(err) + } + iPArray := make([]map[string]interface{}, 0) + if securityIpGroup, ok := getResp1["SecurityIpGroups"].(map[string]interface{})["SecurityIpGroup"].([]interface{}); ok { + for _, v := range securityIpGroup { + if m1, ok := v.(map[string]interface{}); ok { + if m1["SecurityIpGroupName"].(string) == "default" { + continue + } + temp1 := map[string]interface{}{ + "security_ip_group_attribute": m1["SecurityIpGroupAttribute"], + "security_ip_group_name": m1["SecurityIpGroupName"], + "security_ip_list": m1["SecurityIpList"], + } + iPArray = append(iPArray, temp1) + } + } + } + mapping["security_ip_groups"] = iPArray + + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + if err := d.Set("instances", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_mongodb_sharding_network_public_addresses.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_mongodb_sharding_network_public_addresses.go new file mode 100644 index 00000000000..e772868b491 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_mongodb_sharding_network_public_addresses.go @@ -0,0 +1,178 @@ +package alicloud + +import ( + "strconv" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudMongodbShardingNetworkPublicAddresses() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudMongodbShardingNetworkPublicAddressesRead, + Schema: map[string]*schema.Schema{ + "db_instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "node_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "role": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Primary", "Secondary"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "addresses": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "db_instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "expired_time": { + Type: schema.TypeString, + Computed: true, + }, + "ip_address": { + Type: schema.TypeString, + Computed: true, + }, + "network_address": { + Type: schema.TypeString, + Computed: true, + }, + "network_type": { + Type: schema.TypeString, + Computed: true, + }, + "node_id": { + Type: schema.TypeString, + Computed: true, + }, + "node_type": { + Type: schema.TypeString, + Computed: true, + }, + "port": { + Type: schema.TypeString, + Computed: true, + }, + "role": { + Type: schema.TypeString, + Computed: true, + }, + "vpc_id": { + Type: schema.TypeString, + Computed: true, + }, + "vswitch_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudMongodbShardingNetworkPublicAddressesRead(d *schema.ResourceData, meta interface{}) error { + + client := meta.(*connectivity.AliyunClient) + + action := "DescribeShardingNetworkAddress" + request := make(map[string]interface{}) + request["DBInstanceId"] = d.Get("db_instance_id") + if v, ok := d.GetOk("node_id"); ok { + request["NodeId"] = v + } + role, roleOk := d.GetOk("role") + var response map[string]interface{} + var objects []map[string]interface{} + conn, err := client.NewDdsClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-12-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_mongodb_sharding_network_public_addresses", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.NetworkAddresses.NetworkAddress", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.NetworkAddresses.NetworkAddress", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if roleOk && role.(string) != "" && role.(string) != item["Role"].(string) { + continue + } + if item["NetworkType"].(string) != "Public" { + continue + } + objects = append(objects, item) + } + + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "db_instance_id": request["DBInstanceId"], + "expired_time": object["ExpiredTime"], + "ip_address": object["IPAddress"], + "network_address": object["NetworkAddress"], + "network_type": object["NetworkType"], + "node_type": object["NodeType"], + "port": object["Port"], + "role": object["Role"], + "vpc_id": object["VPCId"], + "vswitch_id": object["VswitchId"], + } + if v, ok := d.GetOk("node_id"); ok { + mapping["node_id"] = v + } else { + mapping["node_id"] = object["NodeId"] + } + s = append(s, mapping) + } + + d.SetId(strconv.FormatInt(time.Now().Unix(), 16)) + if err := d.Set("addresses", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_msc_sub_contacts.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_msc_sub_contacts.go index f5ac9ed2216..df434059738 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_msc_sub_contacts.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_msc_sub_contacts.go @@ -108,6 +108,7 @@ func dataSourceAlicloudMscSubContactsRead(d *schema.ResourceData, meta interface action := "ListContacts" request := make(map[string]interface{}) + request["Locale"] = "en" request["MaxResults"] = PageSizeLarge var objects []map[string]interface{} var contactNameRegex *regexp.Regexp @@ -195,7 +196,7 @@ func dataSourceAlicloudMscSubContactsRead(d *schema.ResourceData, meta interface "last_email_verification_time_stamp": fmt.Sprint(object["LastEmailVerificationTimeStamp"]), "last_mobile_verification_time_stamp": fmt.Sprint(object["LastMobileVerificationTimeStamp"]), "mobile": object["Mobile"], - "position": object["Position"], + "position": convertMscSubContactPositionResponse(fmt.Sprint(object["Position"])), } ids = append(ids, fmt.Sprint(mapping["id"])) names = append(names, object["ContactName"]) diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_msc_sub_subscriptions.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_msc_sub_subscriptions.go new file mode 100644 index 00000000000..b185a410c8d --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_msc_sub_subscriptions.go @@ -0,0 +1,168 @@ +package alicloud + +import ( + "fmt" + "strconv" + "time" + + "github.com/PaesslerAG/jsonpath" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudMscSubSubscriptions() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudMscSubSubscriptionsRead, + Schema: map[string]*schema.Schema{ + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "subscriptions": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "channel": { + Type: schema.TypeString, + Computed: true, + }, + "contact_ids": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeInt}, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "email_status": { + Type: schema.TypeInt, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "item_id": { + Type: schema.TypeString, + Computed: true, + }, + "item_name": { + Type: schema.TypeString, + Computed: true, + }, + "pmsg_status": { + Type: schema.TypeInt, + Computed: true, + }, + "sms_status": { + Type: schema.TypeInt, + Computed: true, + }, + "tts_status": { + Type: schema.TypeInt, + Computed: true, + }, + "webhook_ids": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeInt}, + }, + "webhook_status": { + Type: schema.TypeInt, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudMscSubSubscriptionsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListSubscriptionItems" + request := make(map[string]interface{}) + if v, ok := d.GetOk("filter"); ok { + request["Filter"] = v + } + request["Locale"] = "en" + request["MaxResults"] = PageSizeLarge + var objects []map[string]interface{} + var response map[string]interface{} + conn, err := client.NewMscopensubscriptionClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("GET"), StringPointer("2021-07-13"), StringPointer("AK"), request, nil, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_msc_sub_subscriptions", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + resp, err := jsonpath.Get("$.SubscriptionItems", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.SubscriptionItems", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "channel": object["Channel"], + "contact_ids": object["ContactIds"], + "description": object["Description"], + "email_status": formatInt(object["EmailStatus"]), + "id": fmt.Sprint(object["ItemId"]), + "item_id": fmt.Sprint(object["ItemId"]), + "item_name": object["ItemName"], + "pmsg_status": formatInt(object["PmsgStatus"]), + "sms_status": formatInt(object["SmsStatus"]), + "tts_status": formatInt(object["TtsStatus"]), + "webhook_ids": object["WebhookIds"], + "webhook_status": formatInt(object["WebhookStatus"]), + } + s = append(s, mapping) + } + + d.SetId(strconv.FormatInt(time.Now().Unix(), 16)) + + if err := d.Set("subscriptions", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_msc_sub_webhooks.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_msc_sub_webhooks.go new file mode 100644 index 00000000000..d962d377f65 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_msc_sub_webhooks.go @@ -0,0 +1,178 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudMscSubWebhooks() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudMscSubWebhooksRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "webhooks": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "server_url": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "webhook_id": { + Type: schema.TypeString, + Computed: true, + }, + "webhook_name": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudMscSubWebhooksRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListWebhooks" + request := make(map[string]interface{}) + request["Locale"] = "en" + request["MaxResults"] = PageSizeLarge + var objects []map[string]interface{} + var webhookNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + webhookNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewMscopensubscriptionClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("GET"), StringPointer("2021-07-13"), StringPointer("AK"), request, nil, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_msc_sub_webhooks", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + resp, err := jsonpath.Get("$.Webhooks", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Webhooks", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if webhookNameRegex != nil && !webhookNameRegex.MatchString(fmt.Sprint(item["WebhookName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["WebhookId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "server_url": object["ServerUrl"], + "id": fmt.Sprint(object["WebhookId"]), + "webhook_id": fmt.Sprint(object["WebhookId"]), + "webhook_name": object["WebhookName"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["WebhookName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("webhooks", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_nas_auto_snapshot_policies.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_nas_auto_snapshot_policies.go new file mode 100644 index 00000000000..9facfbc2f24 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_nas_auto_snapshot_policies.go @@ -0,0 +1,217 @@ +package alicloud + +import ( + "fmt" + "regexp" + "strings" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudNasAutoSnapshotPolicies() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudNasAutoSnapshotPoliciesRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Available", "Creating"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "policies": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, + "auto_snapshot_policy_id": { + Type: schema.TypeString, + Computed: true, + }, + "auto_snapshot_policy_name": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "file_system_nums": { + Type: schema.TypeInt, + Computed: true, + }, + "repeat_weekdays": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "retention_days": { + Type: schema.TypeInt, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "time_points": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudNasAutoSnapshotPoliciesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeAutoSnapshotPolicies" + request := make(map[string]interface{}) + request["FileSystemType"] = "extreme" + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + var autoSnapshotPolicyNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + autoSnapshotPolicyNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewNasClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-06-26"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_nas_auto_snapshot_policies", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.AutoSnapshotPolicies.AutoSnapshotPolicy", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.AutoSnapshotPolicies.AutoSnapshotPolicy", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if autoSnapshotPolicyNameRegex != nil && !autoSnapshotPolicyNameRegex.MatchString(fmt.Sprint(item["AutoSnapshotPolicyName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["AutoSnapshotPolicyId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["Status"].(string) { + continue + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "id": fmt.Sprint(object["AutoSnapshotPolicyId"]), + "auto_snapshot_policy_id": fmt.Sprint(object["AutoSnapshotPolicyId"]), + "auto_snapshot_policy_name": object["AutoSnapshotPolicyName"], + "create_time": object["CreateTime"], + "file_system_nums": formatInt(object["FileSystemNums"]), + "repeat_weekdays": strings.Split(object["RepeatWeekdays"].(string), ","), + "retention_days": formatInt(object["RetentionDays"]), + "status": object["Status"], + "time_points": strings.Split(object["TimePoints"].(string), ","), + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["AutoSnapshotPolicyName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("policies", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_nas_file_systems.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_nas_file_systems.go index 05e6d52da54..99ea2bd0ce5 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_nas_file_systems.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_nas_file_systems.go @@ -21,7 +21,7 @@ func dataSourceAlicloudFileSystems() *schema.Resource { Type: schema.TypeString, Optional: true, ForceNew: true, - ValidateFunc: validation.StringInSlice([]string{"Capacity", "Performance"}, false), + ValidateFunc: validation.StringInSlice([]string{"Capacity", "Performance", "standard", "advance"}, false), }, "protocol_type": { Type: schema.TypeString, @@ -89,6 +89,22 @@ func dataSourceAlicloudFileSystems() *schema.Resource { Type: schema.TypeInt, Computed: true, }, + "file_system_type": { + Type: schema.TypeString, + Computed: true, + }, + "capacity": { + Type: schema.TypeInt, + Computed: true, + }, + "kms_key_id": { + Type: schema.TypeString, + Computed: true, + }, + "zone_id": { + Type: schema.TypeString, + Computed: true, + }, }, }, }, @@ -171,14 +187,18 @@ func dataSourceAlicloudFileSystemsRead(d *schema.ResourceData, meta interface{}) s := make([]map[string]interface{}, 0) for _, object := range objects { mapping := map[string]interface{}{ - "id": fmt.Sprint(object["FileSystemId"]), - "region_id": object["RegionId"], - "create_time": object["CreateTime"], - "description": object["Description"], - "protocol_type": object["ProtocolType"], - "storage_type": object["StorageType"], - "metered_size": formatInt(object["MeteredSize"]), - "encrypt_type": object["EncryptType"], + "id": fmt.Sprint(object["FileSystemId"]), + "region_id": object["RegionId"], + "create_time": object["CreateTime"], + "description": object["Description"], + "protocol_type": object["ProtocolType"], + "storage_type": object["StorageType"], + "metered_size": formatInt(object["MeteredSize"]), + "encrypt_type": object["EncryptType"], + "file_system_type": object["FileSystemType"], + "capacity": object["Capacity"], + "kms_key_id": object["KMSKeyId"], + "zone_id": object["ZoneId"], } ids = append(ids, fmt.Sprint(object["FileSystemId"])) descriptions = append(descriptions, object["Description"]) diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_nas_filesets.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_nas_filesets.go new file mode 100644 index 00000000000..f97945c4d94 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_nas_filesets.go @@ -0,0 +1,180 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudNasFilesets() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudNasFilesetsRead, + Schema: map[string]*schema.Schema{ + "file_system_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"CREATED", "CREATING", "RELEASED", "RELEASING"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "filesets": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "file_system_id": { + Type: schema.TypeString, + Computed: true, + }, + "file_system_path": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "fileset_id": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "update_time": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudNasFilesetsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeFilesets" + request := make(map[string]interface{}) + request["FileSystemId"] = d.Get("file_system_id") + request["MaxResults"] = PageSizeMedium + var objects []map[string]interface{} + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewNasClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-06-26"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_nas_filesets", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Entries.Entrie", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Entries.Entrie", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(request["FileSystemId"], ":", item["FsetId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["Status"].(string) { + continue + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "create_time": object["CreateTime"], + "description": object["Description"], + "file_system_id": request["FileSystemId"], + "file_system_path": object["FileSystemPath"], + "id": fmt.Sprint(request["FileSystemId"], ":", object["FsetId"]), + "fileset_id": fmt.Sprint(object["FsetId"]), + "status": object["Status"], + "update_time": object["UpdateTiem"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("filesets", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_nas_lifecycle_policies.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_nas_lifecycle_policies.go new file mode 100644 index 00000000000..9173ffdae67 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_nas_lifecycle_policies.go @@ -0,0 +1,196 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudNasLifecyclePolicies() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudNasLifecyclePoliciesRead, + Schema: map[string]*schema.Schema{ + "file_system_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "policies": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "file_system_id": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "lifecycle_policy_name": { + Type: schema.TypeString, + Computed: true, + }, + "lifecycle_rule_name": { + Type: schema.TypeString, + Computed: true, + }, + "paths": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "storage_type": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudNasLifecyclePoliciesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeLifecyclePolicies" + request := make(map[string]interface{}) + request["FileSystemId"] = d.Get("file_system_id") + request["PageSize"] = PageSizeMedium + request["PageNumber"] = 1 + var objects []map[string]interface{} + var lifecyclePolicyNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + lifecyclePolicyNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewNasClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("GET"), StringPointer("2017-06-26"), StringPointer("AK"), request, nil, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_nas_lifecycle_policies", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.LifecyclePolicies", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.LifecyclePolicies", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if lifecyclePolicyNameRegex != nil && !lifecyclePolicyNameRegex.MatchString(fmt.Sprint(item["LifecyclePolicyName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["FileSystemId"], ":", item["LifecyclePolicyName"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeMedium { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "create_time": object["CreateTime"], + "file_system_id": object["FileSystemId"], + "id": fmt.Sprint(object["FileSystemId"], ":", object["LifecyclePolicyName"]), + "lifecycle_policy_name": fmt.Sprint(object["LifecyclePolicyName"]), + "lifecycle_rule_name": object["LifecycleRuleName"], + "paths": object["Paths"], + "storage_type": object["StorageType"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["LifecyclePolicyName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("policies", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_nas_snapshots.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_nas_snapshots.go new file mode 100644 index 00000000000..5039030427e --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_nas_snapshots.go @@ -0,0 +1,248 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudNasSnapshots() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudNasSnapshotsRead, + Schema: map[string]*schema.Schema{ + "file_system_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "snapshot_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"accomplished", "failed", "progressing"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "snapshots": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "encrypt_type": { + Type: schema.TypeInt, + Computed: true, + }, + "progress": { + Type: schema.TypeString, + Computed: true, + }, + "remain_time": { + Type: schema.TypeInt, + Computed: true, + }, + "retention_days": { + Type: schema.TypeInt, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "snapshot_id": { + Type: schema.TypeString, + Computed: true, + }, + "snapshot_name": { + Type: schema.TypeString, + Computed: true, + }, + "source_file_system_id": { + Type: schema.TypeString, + Computed: true, + }, + "source_file_system_size": { + Type: schema.TypeString, + Computed: true, + }, + "source_file_system_version": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudNasSnapshotsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeSnapshots" + request := make(map[string]interface{}) + if v, ok := d.GetOk("file_system_id"); ok { + request["FileSystemId"] = v + } + request["FileSystemType"] = "extreme" + if v, ok := d.GetOk("snapshot_name"); ok { + request["SnapshotName"] = v + } + if v, ok := d.GetOk("snapshot_type"); ok { + request["SnapshotType"] = v + } + if v, ok := d.GetOk("status"); ok { + request["Status"] = v + } + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + var snapshotNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + snapshotNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewNasClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-06-26"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_nas_snapshots", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Snapshots.Snapshot", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Snapshots.Snapshot", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if snapshotNameRegex != nil && !snapshotNameRegex.MatchString(fmt.Sprint(item["SnapshotName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["SnapshotId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "create_time": object["CreateTime"], + "description": object["Description"], + "encrypt_type": formatInt(object["EncryptType"]), + "progress": object["Progress"], + "remain_time": formatInt(object["RemainTime"]), + "retention_days": formatInt(object["RetentionDays"]), + "id": fmt.Sprint(object["SnapshotId"]), + "snapshot_id": fmt.Sprint(object["SnapshotId"]), + "snapshot_name": object["SnapshotName"], + "source_file_system_id": object["SourceFileSystemId"], + "source_file_system_size": fmt.Sprint(object["SourceFileSystemSize"]), + "source_file_system_version": object["SourceFileSystemVersion"], + "status": object["Status"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["SnapshotName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("snapshots", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_nas_zones.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_nas_zones.go new file mode 100644 index 00000000000..b734268343a --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_nas_zones.go @@ -0,0 +1,130 @@ +package alicloud + +import ( + "strconv" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudNasZones() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudNasZonesRead, + Schema: map[string]*schema.Schema{ + "file_system_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"standard", "extreme", "cpfs"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "zones": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "zone_id": { + Type: schema.TypeString, + Computed: true, + }, + "instance_types": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "storage_type": { + Type: schema.TypeString, + Computed: true, + }, + "protocol_type": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudNasZonesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeZones" + request := make(map[string]interface{}) + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("file_system_type"); ok { + request["FileSystemType"] = v + } + var objects []map[string]interface{} + var response map[string]interface{} + conn, err := client.NewNasClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-06-26"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_nas_zones", action, AlibabaCloudSdkGoERROR) + } + addDebug(action, response, request) + + resp, err := jsonpath.Get("$.Zones.Zone", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Zones.Zone", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + objects = append(objects, item) + } + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "zone_id": object["ZoneId"], + } + InstanceTypes := make([]map[string]interface{}, 0) + if InstanceTypesList, ok := object["InstanceTypes"]; ok { + if data, ok := InstanceTypesList.(map[string]interface{}); ok { + for _, v := range data { + if m1, ok := v.([]interface{}); ok { + for _, vv := range m1 { + if res, ok := vv.(map[string]interface{}); ok { + temp1 := map[string]interface{}{ + "storage_type": res["StorageType"], + "protocol_type": res["ProtocolType"], + } + InstanceTypes = append(InstanceTypes, temp1) + } + } + } + } + } + } + mapping["instance_types"] = InstanceTypes + s = append(s, mapping) + } + + d.SetId(strconv.FormatInt(time.Now().Unix(), 16)) + + if err := d.Set("zones", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_nat_gateways.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_nat_gateways.go index e8e34ff1988..ee7a66ec6fb 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_nat_gateways.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_nat_gateways.go @@ -179,6 +179,10 @@ func dataSourceAlicloudNatGateways() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "network_type": { + Type: schema.TypeString, + Computed: true, + }, }, }, }, @@ -307,6 +311,7 @@ func dataSourceAlicloudNatGatewaysRead(d *schema.ResourceData, meta interface{}) "nat_gateway_name": object["Name"], "name": object["Name"], "nat_type": object["NatType"], + "network_type": object["NetworkType"], "payment_type": convertNatGatewayPaymentTypeResponse(object["InstanceChargeType"].(string)), "resource_group_id": object["ResourceGroupId"], "snat_table_ids": object["SnatTableIds"].(map[string]interface{})["SnatTableId"], diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_oos_application_groups.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_oos_application_groups.go new file mode 100644 index 00000000000..48fa1c1e202 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_oos_application_groups.go @@ -0,0 +1,215 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudOosApplicationGroups() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudOosApplicationGroupsRead, + Schema: map[string]*schema.Schema{ + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "application_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "deploy_region_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "groups": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, + "application_group_name": { + Type: schema.TypeString, + Computed: true, + }, + "application_name": { + Type: schema.TypeString, + Computed: true, + }, + "cms_group_id": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "update_time": { + Type: schema.TypeString, + Computed: true, + }, + "deploy_region_id": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "import_tag_key": { + Type: schema.TypeString, + Computed: true, + }, + "import_tag_value": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudOosApplicationGroupsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListApplicationGroups" + request := make(map[string]interface{}) + request["ApplicationName"] = d.Get("application_name") + if v, ok := d.GetOk("deploy_region_id"); ok { + request["DeployRegionId"] = v + } + request["RegionId"] = client.RegionId + request["MaxResults"] = PageSizeLarge + var objects []map[string]interface{} + var applicationGroupNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + applicationGroupNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewOosClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_oos_application_groups", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.ApplicationGroups", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.ApplicationGroups", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if applicationGroupNameRegex != nil && !applicationGroupNameRegex.MatchString(fmt.Sprint(item["Name"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["Name"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "id": fmt.Sprint(object["Name"]), + "application_group_name": fmt.Sprint(object["Name"]), + "application_name": object["ApplicationName"], + "cms_group_id": object["CmsGroupId"], + "create_time": object["CreateDate"], + "deploy_region_id": object["DeployRegionId"], + "description": object["Description"], + "import_tag_key": object["ImportTagKey"], + "import_tag_value": object["ImportTagValue"], + "update_time": object["UpdateDate"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["Name"]) + s = append(s, mapping) + } + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + if err := d.Set("groups", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_oos_applications.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_oos_applications.go new file mode 100644 index 00000000000..7a8aab60592 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_oos_applications.go @@ -0,0 +1,211 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudOosApplications() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudOosApplicationsRead, + Schema: map[string]*schema.Schema{ + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "tags": tagsSchema(), + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "applications": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, + "application_name": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "resource_group_id": { + Type: schema.TypeString, + Computed: true, + }, + "update_time": { + Type: schema.TypeString, + Computed: true, + }, + "tags": { + Type: schema.TypeMap, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudOosApplicationsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListApplications" + request := make(map[string]interface{}) + request["RegionId"] = client.RegionId + request["MaxResults"] = PageSizeLarge + var objects []map[string]interface{} + var nameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + nameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + tagsMap := make(map[string]interface{}) + if v, ok := d.GetOk("tags"); ok && len(v.(map[string]interface{})) > 0 { + tagsMap = v.(map[string]interface{}) + } + var response map[string]interface{} + conn, err := client.NewOosClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_oos_applications", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Applications", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Applications", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if nameRegex != nil && !nameRegex.MatchString(fmt.Sprint(item["Name"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["Name"])]; !ok { + continue + } + } + if len(tagsMap) > 0 { + tagsItem := tagsToMap(item["Tags"]) + if len(tagsItem) != len(tagsMap) { + continue + } + match := true + for key, value := range tagsItem { + if v, ok := tagsMap[key]; !ok || v.(string) != value { + match = false + break + } + } + if !match { + continue + } + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "id": fmt.Sprint(object["Name"]), + "application_name": fmt.Sprint(object["Name"]), + "create_time": object["CreateDate"], + "update_time": object["UpdateDate"], + "description": object["Description"], + "resource_group_id": object["ResourceGroupId"], + "tags": tagsToMap(object["Tags"]), + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["Name"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("applications", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_oos_parameters.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_oos_parameters.go new file mode 100644 index 00000000000..ed20e7b9b8a --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_oos_parameters.go @@ -0,0 +1,292 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudOosParameters() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudOosParametersRead, + Schema: map[string]*schema.Schema{ + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "parameter_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "resource_group_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "sort_field": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Name", "CreatedDate"}, false), + }, + "sort_order": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Ascending", "Descending"}, false), + }, + "tags": tagsSchema(), + "type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"String", "StringList"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "parameters": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "constraints": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "created_by": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "parameter_id": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "parameter_name": { + Type: schema.TypeString, + Computed: true, + }, + "parameter_version": { + Type: schema.TypeInt, + Computed: true, + }, + "resource_group_id": { + Type: schema.TypeString, + Computed: true, + }, + "share_type": { + Type: schema.TypeString, + Computed: true, + }, + "tags": { + Type: schema.TypeMap, + Computed: true, + }, + "type": { + Type: schema.TypeString, + Computed: true, + }, + "updated_by": { + Type: schema.TypeString, + Computed: true, + }, + "updated_date": { + Type: schema.TypeString, + Computed: true, + }, + "value": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudOosParametersRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "ListParameters" + request := make(map[string]interface{}) + if v, ok := d.GetOk("parameter_name"); ok { + request["Name"] = v + } + if v, ok := d.GetOk("resource_group_id"); ok { + request["ResourceGroupId"] = v + } + if v, ok := d.GetOk("sort_field"); ok { + request["SortField"] = v + } + if v, ok := d.GetOk("sort_order"); ok { + request["SortOrder"] = v + } + if v, ok := d.GetOk("type"); ok { + request["Type"] = v + } + if v, ok := d.GetOk("tags"); ok { + respJson, err := convertMaptoJsonString(v.(map[string]interface{})) + if err != nil { + return WrapError(err) + } + request["Tags"] = respJson + } + request["MaxResults"] = PageSizeLarge + var objects []map[string]interface{} + var parameterNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + parameterNameRegex = r + } + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewOosClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_oos_parameters", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Parameters", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Parameters", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if parameterNameRegex != nil && !parameterNameRegex.MatchString(fmt.Sprint(item["Name"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["Name"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "create_time": object["CreatedDate"], + "created_by": object["CreatedBy"], + "description": object["Description"], + "parameter_id": object["Id"], + "id": fmt.Sprint(object["Name"]), + "parameter_name": fmt.Sprint(object["Name"]), + "parameter_version": formatInt(object["ParameterVersion"]), + "resource_group_id": object["ResourceGroupId"], + "share_type": object["ShareType"], + "type": object["Type"], + "updated_by": object["UpdatedBy"], + "updated_date": object["UpdatedDate"], + } + mapping["tags"] = tagsToMap(object["Tags"]) + + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["Name"]) + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + s = append(s, mapping) + continue + } + id := fmt.Sprint(object["Name"]) + oosService := OosService{client} + getResp, err := oosService.DescribeOosParameter(id) + if err != nil { + return WrapError(err) + } + mapping["constraints"] = getResp["Constraints"] + mapping["value"] = getResp["Value"] + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + if err := d.Set("parameters", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_oos_patch_baselines.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_oos_patch_baselines.go new file mode 100644 index 00000000000..4d03294cb38 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_oos_patch_baselines.go @@ -0,0 +1,243 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudOosPatchBaselines() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudOosPatchBaselinesRead, + Schema: map[string]*schema.Schema{ + "operation_system": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"AliyunLinux", "Anolis", "Centos", "Debian", "RedhatEnterpriseLinux", "Ubuntu", "Windows"}, false), + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "share_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Private", "Public"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "baselines": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "approval_rules": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "created_by": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "is_default": { + Type: schema.TypeBool, + Computed: true, + }, + "operation_system": { + Type: schema.TypeString, + Computed: true, + }, + "patch_baseline_id": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "patch_baseline_name": { + Type: schema.TypeString, + Computed: true, + }, + "share_type": { + Type: schema.TypeString, + Computed: true, + }, + "updated_by": { + Type: schema.TypeString, + Computed: true, + }, + "updated_date": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudOosPatchBaselinesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "ListPatchBaselines" + request := make(map[string]interface{}) + if v, ok := d.GetOk("operation_system"); ok { + request["OperationSystem"] = v + } + if v, ok := d.GetOk("share_type"); ok { + request["ShareType"] = v + } + request["MaxResults"] = PageSizeLarge + var objects []map[string]interface{} + var patchBaselineNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + patchBaselineNameRegex = r + } + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewOosClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_oos_patch_baselines", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.PatchBaselines", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.PatchBaselines", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if patchBaselineNameRegex != nil && !patchBaselineNameRegex.MatchString(fmt.Sprint(item["Name"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["Name"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "create_time": object["CreatedDate"], + "created_by": object["CreatedBy"], + "description": object["Description"], + "is_default": object["IsDefault"], + "operation_system": object["OperationSystem"], + "patch_baseline_id": object["Id"], + "id": fmt.Sprint(object["Name"]), + "patch_baseline_name": fmt.Sprint(object["Name"]), + "share_type": object["ShareType"], + "updated_by": object["UpdatedBy"], + "updated_date": object["UpdatedDate"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["Name"]) + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + s = append(s, mapping) + continue + } + id := fmt.Sprint(object["Name"]) + oosService := OosService{client} + getResp, err := oosService.DescribeOosPatchBaseline(id) + if err != nil { + return WrapError(err) + } + if v, err := convertMaptoJsonString(getResp["ApprovalRules"].(map[string]interface{})); err == nil { + mapping["approval_rules"] = v + } + s = append(s, mapping) + } + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + if err := d.Set("baselines", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_oos_secret_parameters.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_oos_secret_parameters.go new file mode 100644 index 00000000000..9e3c31b929d --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_oos_secret_parameters.go @@ -0,0 +1,285 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudOosSecretParameters() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudOosSecretParametersRead, + Schema: map[string]*schema.Schema{ + "resource_group_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "secret_parameter_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "sort_field": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Name", "CreatedDate"}, false), + }, + "sort_order": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Ascending", "Descending"}, false), + }, + "tags": tagsSchema(), + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "parameters": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, + "constraints": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "created_by": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "key_id": { + Type: schema.TypeString, + Computed: true, + }, + "parameter_version": { + Type: schema.TypeInt, + Computed: true, + }, + "resource_group_id": { + Type: schema.TypeString, + Computed: true, + }, + "secret_parameter_id": { + Type: schema.TypeString, + Computed: true, + }, + "secret_parameter_name": { + Type: schema.TypeString, + Computed: true, + }, + "share_type": { + Type: schema.TypeString, + Computed: true, + }, + "tags": { + Type: schema.TypeMap, + Computed: true, + }, + "type": { + Type: schema.TypeString, + Computed: true, + }, + "updated_by": { + Type: schema.TypeString, + Computed: true, + }, + "updated_date": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudOosSecretParametersRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListSecretParameters" + request := make(map[string]interface{}) + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("resource_group_id"); ok { + request["ResourceGroupId"] = v + } + if v, ok := d.GetOk("secret_parameter_name"); ok { + request["Name"] = v + } + if v, ok := d.GetOk("sort_field"); ok { + request["SortField"] = v + } + if v, ok := d.GetOk("sort_order"); ok { + request["SortOrder"] = v + } + if v, ok := d.GetOk("tags"); ok { + respJson, err := convertMaptoJsonString(v.(map[string]interface{})) + if err != nil { + return WrapError(err) + } + request["Tags"] = respJson + } + request["MaxResults"] = PageSizeLarge + var objects []map[string]interface{} + var secretParameterNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + secretParameterNameRegex = r + } + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewOosClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_oos_secret_parameters", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Parameters", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Parameters", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["Name"])]; !ok { + continue + } + } + if secretParameterNameRegex != nil && !secretParameterNameRegex.MatchString(fmt.Sprint(item["Name"])) { + continue + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "id": fmt.Sprint(object["Name"]), + "create_time": object["CreatedDate"], + "created_by": object["CreatedBy"], + "description": object["Description"], + "key_id": object["KeyId"], + "parameter_version": formatInt(object["ParameterVersion"]), + "resource_group_id": object["ResourceGroupId"], + "secret_parameter_id": object["Id"], + "secret_parameter_name": object["Name"], + "share_type": object["ShareType"], + "type": object["Type"], + "updated_by": object["UpdatedBy"], + "updated_date": object["UpdatedDate"], + } + mapping["tags"] = tagsToMap(object["Tags"]) + + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["Name"]) + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + s = append(s, mapping) + continue + } + id := fmt.Sprint(object["Name"]) + oosService := OosService{client} + getResp, err := oosService.DescribeOosSecretParameter(id) + if err != nil { + return WrapError(err) + } + mapping["constraints"] = getResp["Constraints"] + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + if err := d.Set("parameters", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_oos_state_configurations.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_oos_state_configurations.go new file mode 100644 index 00000000000..b8aee7f1e56 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_oos_state_configurations.go @@ -0,0 +1,226 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudOosStateConfigurations() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudOosStateConfigurationsRead, + Schema: map[string]*schema.Schema{ + "resource_group_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "tags": tagsSchema(), + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "configurations": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "configure_mode": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "update_time": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "parameters": { + Type: schema.TypeString, + Computed: true, + }, + "resource_group_id": { + Type: schema.TypeString, + Computed: true, + }, + "schedule_expression": { + Type: schema.TypeString, + Computed: true, + }, + "schedule_type": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "state_configuration_id": { + Type: schema.TypeString, + Computed: true, + }, + "tags": { + Type: schema.TypeMap, + Computed: true, + }, + "targets": { + Type: schema.TypeString, + Computed: true, + }, + "template_id": { + Type: schema.TypeString, + Computed: true, + }, + "template_name": { + Type: schema.TypeString, + Computed: true, + }, + "template_version": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudOosStateConfigurationsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListStateConfigurations" + request := make(map[string]interface{}) + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("resource_group_id"); ok { + request["ResourceGroupId"] = v + } + request["MaxResults"] = PageSizeLarge + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + tagsMap := make(map[string]interface{}) + if v, ok := d.GetOk("tags"); ok && len(v.(map[string]interface{})) > 0 { + tagsMap = v.(map[string]interface{}) + } + var response map[string]interface{} + conn, err := client.NewOosClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_oos_state_configurations", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.StateConfigurations", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.StateConfigurations", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["StateConfigurationId"])]; !ok { + continue + } + } + if len(tagsMap) > 0 { + match := true + tagsItem := tagsToMap(item["Tags"]) + for key, value := range tagsItem { + if v, ok := tagsMap[key]; !ok || v.(string) != value { + match = false + break + } + } + if !match { + continue + } + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "configure_mode": object["ConfigureMode"], + "create_time": object["CreateTime"], + "update_time": object["UpdateTime"], + "description": object["Description"], + "parameters": object["Parameters"], + "resource_group_id": object["ResourceGroupId"], + "schedule_expression": object["ScheduleExpression"], + "schedule_type": object["ScheduleType"], + "id": fmt.Sprint(object["StateConfigurationId"]), + "state_configuration_id": fmt.Sprint(object["StateConfigurationId"]), + "targets": object["Targets"], + "template_id": object["TemplateId"], + "template_name": object["TemplateName"], + "template_version": object["TemplateVersion"], + } + mapping["tags"] = tagsToMap(object["Tags"]) + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("configurations", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_open_search_app_groups.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_open_search_app_groups.go new file mode 100644 index 00000000000..474815332de --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_open_search_app_groups.go @@ -0,0 +1,357 @@ +package alicloud + +import ( + "encoding/json" + "fmt" + "regexp" + "strconv" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudOpenSearchAppGroups() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudOpenSearchAppGroupsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "resource_group_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{`standard`, `enhanced`}, false), + }, + "name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "groups": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "app_group_id": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "app_group_name": { + Type: schema.TypeString, + Computed: true, + }, + "payment_type": { + Type: schema.TypeString, + Computed: true, + }, + "charge_way": { + Type: schema.TypeInt, + Computed: true, + }, + "commodity_code": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeInt, + Computed: true, + }, + "current_version": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "domain": { + Type: schema.TypeString, + Computed: true, + }, + "expire_on": { + Type: schema.TypeString, + Computed: true, + }, + "first_rank_algo_deployment_id": { + Type: schema.TypeInt, + Computed: true, + }, + "has_pending_quota_review_task": { + Type: schema.TypeInt, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "lock_mode": { + Type: schema.TypeString, + Computed: true, + }, + "locked_by_expiration": { + Type: schema.TypeInt, + Computed: true, + }, + "pending_second_rank_algo_deployment_id": { + Type: schema.TypeInt, + Computed: true, + }, + "processing_order_id": { + Type: schema.TypeString, + Computed: true, + }, + "produced": { + Type: schema.TypeInt, + Computed: true, + }, + "project_id": { + Type: schema.TypeString, + Computed: true, + }, + "quota": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "compute_resource": { + Type: schema.TypeString, + Computed: true, + }, + "doc_size": { + Type: schema.TypeString, + Computed: true, + }, + "spec": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "resource_group_id": { + Type: schema.TypeString, + Computed: true, + }, + "second_rank_algo_deployment_id": { + Type: schema.TypeInt, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "switched_time": { + Type: schema.TypeInt, + Computed: true, + }, + "type": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudOpenSearchAppGroupsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "/v4/openapi/app-groups" + request := make(map[string]*string) + if v, ok := d.GetOk("instance_id"); ok { + request["instanceId"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("resource_group_id"); ok { + request["resourceGroupId"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("type"); ok { + request["type"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("name"); ok { + request["name"] = StringPointer(v.(string)) + } + request["PageSize"] = StringPointer(strconv.Itoa(PageSizeLarge)) + request["PageNumber"] = StringPointer("1") + var objects []map[string]interface{} + var appGroupNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + appGroupNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewOpensearchClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer("2017-12-25"), nil, StringPointer("GET"), StringPointer("AK"), StringPointer(action), request, nil, nil, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug("GET "+action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_open_search_app_groups", action, AlibabaCloudSdkGoERROR) + } + if respBody, isExist := response["body"]; isExist { + response = respBody.(map[string]interface{}) + } else { + return WrapError(fmt.Errorf("%s failed, response: %v", "GET "+action, response)) + } + resp, err := jsonpath.Get("$.result", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.result", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if appGroupNameRegex != nil && !appGroupNameRegex.MatchString(fmt.Sprint(item["name"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["name"])]; !ok { + continue + } + } + objects = append(objects, item) + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "payment_type": convertOpenSearchAppGroupPaymentTypeResponse(object["chargeType"].(string)), + "charge_way": formatInt(object["chargingWay"]), + "commodity_code": object["commodityCode"], + "create_time": formatInt(object["created"]), + "current_version": object["currentVersion"], + "description": object["description"], + "domain": object["domain"], + "expire_on": object["expireOn"], + "first_rank_algo_deployment_id": formatInt(object["firstRankAlgoDeploymentId"]), + "has_pending_quota_review_task": formatInt(object["hasPendingQuotaReviewTask"]), + "instance_id": object["instanceId"], + "lock_mode": object["lockMode"], + "locked_by_expiration": formatInt(object["lockedByExpiration"]), + "pending_second_rank_algo_deployment_id": formatInt(object["pendingSecondRankAlgoDeploymentId"]), + "processing_order_id": object["processingOrderId"], + "produced": formatInt(object["produced"]), + "project_id": object["projectId"], + "second_rank_algo_deployment_id": formatInt(object["secondRankAlgoDeploymentId"]), + "status": object["status"], + "switched_time": formatInt(object["switchedTime"]), + "type": object["type"], + } + quotaSli := make([]map[string]interface{}, 0) + if _, exist := object["quota"]; exist { + quotaval := object["quota"].(map[string]interface{}) + quotaSli = append(quotaSli, map[string]interface{}{ + "doc_size": quotaval["docSize"].(json.Number).String(), + "compute_resource": quotaval["computeResource"].(json.Number).String(), + "spec": quotaval["spec"], + }) + } + mapping["quota"] = quotaSli + ids = append(ids, fmt.Sprint(mapping["name"])) + names = append(names, fmt.Sprint(mapping["name"])) + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + s = append(s, mapping) + continue + } + + id := fmt.Sprint(object["name"]) + openSearchService := OpenSearchService{client} + getResp, err := openSearchService.DescribeOpenSearchAppGroup(id) + if err != nil { + return WrapError(err) + } + mapping["app_group_id"] = getResp["id"] + mapping["app_group_name"] = getResp["name"] + mapping["resource_group_id"] = getResp["resourceGroupId"] + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("groups", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ots_instance_attachments.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ots_instance_attachments.go index 216f2d672e7..8f5a56312a5 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ots_instance_attachments.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ots_instance_attachments.go @@ -84,7 +84,7 @@ func dataSourceAlicloudOtsInstanceAttachmentsRead(d *schema.ResourceData, meta i otsService := OtsService{client} instanceName := d.Get("instance_name").(string) allVpcs, err := otsService.ListOtsInstanceVpc(instanceName) - if err != err { + if err != nil { return WrapError(err) } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_pvtz_endpoints.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_pvtz_endpoints.go new file mode 100644 index 00000000000..91c1bca259f --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_pvtz_endpoints.go @@ -0,0 +1,242 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudPvtzEndpoints() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudPvtzEndpointsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"CHANGE_FAILED", "EXCEPTION", "FAILED", "INIT", "SUCCESS"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "endpoints": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "endpoint_name": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "ip_configs": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "cidr_block": { + Type: schema.TypeString, + Computed: true, + }, + "ip": { + Type: schema.TypeString, + Computed: true, + }, + "vswitch_id": { + Type: schema.TypeString, + Computed: true, + }, + "zone_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "security_group_id": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "vpc_id": { + Type: schema.TypeString, + Computed: true, + }, + "vpc_name": { + Type: schema.TypeString, + Computed: true, + }, + "vpc_region_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudPvtzEndpointsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeResolverEndpoints" + request := make(map[string]interface{}) + request["Lang"] = "en" + if v, ok := d.GetOk("status"); ok { + request["Status"] = v + } + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + var endpointNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + endpointNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewPvtzClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-01-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_pvtz_endpoints", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Endpoints", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Endpoints", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if endpointNameRegex != nil && !endpointNameRegex.MatchString(fmt.Sprint(item["Name"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["Id"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "create_time": object["CreateTime"], + "endpoint_name": object["Name"], + "id": object["Id"], + "security_group_id": object["SecurityGroupId"], + "status": object["Status"], + "vpc_id": object["VpcId"], + "vpc_name": object["VpcName"], + "vpc_region_id": object["VpcRegionId"], + } + ipConfigsSli := make([]map[string]interface{}, 0) + if ipConfigs, ok := object["IpConfigs"].([]interface{}); ok { + for _, ipConfigArgs := range ipConfigs { + ipConfigArg := ipConfigArgs.(map[string]interface{}) + ipConfigsMap := make(map[string]interface{}) + ipConfigsMap["zone_id"] = ipConfigArg["AzId"] + ipConfigsMap["cidr_block"] = ipConfigArg["CidrBlock"] + ipConfigsMap["ip"] = ipConfigArg["Ip"] + ipConfigsMap["vswitch_id"] = ipConfigArg["VSwitchId"] + ipConfigsSli = append(ipConfigsSli, ipConfigsMap) + } + } + mapping["ip_configs"] = ipConfigsSli + + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, fmt.Sprint(mapping["endpoint_name"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("endpoints", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_pvtz_resolver_zones.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_pvtz_resolver_zones.go new file mode 100644 index 00000000000..1f0d464d938 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_pvtz_resolver_zones.go @@ -0,0 +1,100 @@ +package alicloud + +import ( + "strconv" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudPvtzResolverZones() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudPvtzResolverZonesRead, + Schema: map[string]*schema.Schema{ + "status": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"SOLD_OUT", "NORMAL"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "zones": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "status": { + Type: schema.TypeString, + Computed: true, + }, + "zone_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudPvtzResolverZonesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeResolverAvailableZones" + request := make(map[string]interface{}) + request["ResolverRegionId"] = client.RegionId + var objects []map[string]interface{} + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewPvtzClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-01-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_pvtz_resolver_zones", action, AlibabaCloudSdkGoERROR) + } + addDebug(action, response, request) + + resp, err := jsonpath.Get("$.AvailableZones", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.AvailableZones", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if statusOk && status.(string) != "" && status.(string) != item["Status"].(string) { + continue + } + objects = append(objects, item) + } + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "status": object["Status"], + "zone_id": object["AzId"], + } + s = append(s, mapping) + } + + d.SetId(strconv.FormatInt(time.Now().Unix(), 16)) + + if err := d.Set("zones", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_pvtz_rules.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_pvtz_rules.go new file mode 100644 index 00000000000..97a503627c9 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_pvtz_rules.go @@ -0,0 +1,231 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudPvtzRules() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudPvtzRulesRead, + Schema: map[string]*schema.Schema{ + "endpoint_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "rules": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "endpoint_id": { + Type: schema.TypeString, + Computed: true, + }, + "forward_ips": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "ip": { + Type: schema.TypeString, + Computed: true, + }, + "port": { + Type: schema.TypeInt, + Computed: true, + }, + }, + }, + }, + "endpoint_name": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "rule_id": { + Type: schema.TypeString, + Computed: true, + }, + "rule_name": { + Type: schema.TypeString, + Computed: true, + }, + "type": { + Type: schema.TypeString, + Computed: true, + }, + "zone_name": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudPvtzRulesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeResolverRules" + request := make(map[string]interface{}) + if v, ok := d.GetOk("endpoint_id"); ok { + request["EndpointId"] = v + } + + request["Lang"] = "en" + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + var ruleNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + ruleNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewPvtzClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-01-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_pvtz_rules", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Rules", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Rules", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if ruleNameRegex != nil && !ruleNameRegex.MatchString(fmt.Sprint(item["Name"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["Id"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "create_time": object["CreateTime"], + "endpoint_id": object["EndpointId"], + "endpoint_name": object["EndpointName"], + "id": fmt.Sprint(object["Id"]), + "rule_id": fmt.Sprint(object["Id"]), + "rule_name": object["Name"], + "type": object["Type"], + "zone_name": object["ZoneName"], + } + forwardConfigsSli := make([]map[string]interface{}, 0) + if forwardConfigs, ok := object["ForwardIps"].([]interface{}); ok { + for _, forwardConfigArgs := range forwardConfigs { + forwardConfigArg := forwardConfigArgs.(map[string]interface{}) + forwardConfigsMap := make(map[string]interface{}) + forwardConfigsMap["ip"] = forwardConfigArg["Ip"] + forwardConfigsMap["port"] = formatInt(forwardConfigArg["Port"]) + forwardConfigsSli = append(forwardConfigsSli, forwardConfigsMap) + } + } + mapping["forward_ips"] = forwardConfigsSli + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["Name"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("rules", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_quick_bi_users.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_quick_bi_users.go new file mode 100644 index 00000000000..0e07e21666e --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_quick_bi_users.go @@ -0,0 +1,197 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudQuickBiUsers() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudQuickBiUsersRead, + Schema: map[string]*schema.Schema{ + "keyword": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "users": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "account_id": { + Type: schema.TypeString, + Computed: true, + }, + "account_name": { + Type: schema.TypeString, + Computed: true, + }, + "admin_user": { + Type: schema.TypeBool, + Computed: true, + }, + "auth_admin_user": { + Type: schema.TypeBool, + Computed: true, + }, + "email": { + Type: schema.TypeString, + Computed: true, + }, + "nick_name": { + Type: schema.TypeString, + Computed: true, + }, + "phone": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "user_id": { + Type: schema.TypeString, + Computed: true, + }, + "user_type": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudQuickBiUsersRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "QueryUserList" + request := make(map[string]interface{}) + if v, ok := d.GetOk("keyword"); ok { + request["Keyword"] = v + } + request["PageSize"] = PageSizeLarge + request["PageNum"] = 1 + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewQuickbiClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("GET"), StringPointer("2020-08-01"), StringPointer("AK"), request, nil, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_quick_bi_users", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Result.Data", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Result.Data", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["UserId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNum"] = request["PageNum"].(int) + 1 + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "account_id": object["AccountId"], + "account_name": object["AccountName"], + "admin_user": object["AdminUser"], + "auth_admin_user": object["AuthAdminUser"], + "nick_name": object["NickName"], + "id": fmt.Sprint(object["UserId"]), + "user_id": fmt.Sprint(object["UserId"]), + "user_type": convertQuickBiUserUserTypeResponse(formatInt(object["UserType"])), + } + ids = append(ids, fmt.Sprint(mapping["id"])) + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + s = append(s, mapping) + continue + } + id := fmt.Sprint(object["UserId"]) + quickbiPublicService := QuickbiPublicService{client} + getResp, err := quickbiPublicService.DescribeQuickBiUser(id) + if err != nil { + return WrapError(err) + } + mapping["email"] = getResp["Email"] + mapping["phone"] = getResp["Phone"] + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("users", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_rdc_organizations.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_rdc_organizations.go new file mode 100644 index 00000000000..d6262765189 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_rdc_organizations.go @@ -0,0 +1,169 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudRdcOrganizations() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudRdcOrganizationsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "real_pk": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "organizations": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, + "organization_id": { + Type: schema.TypeString, + Computed: true, + }, + "organization_name": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudRdcOrganizationsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListUserOrganization" + request := make(map[string]interface{}) + if v, ok := d.GetOk("real_pk"); ok { + request["RealPk"] = v + } + var objects []map[string]interface{} + var organizationNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + organizationNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewDevopsrdcClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-03-03"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_rdc_organizations", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Object", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Object", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if organizationNameRegex != nil && !organizationNameRegex.MatchString(fmt.Sprint(item["Name"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["Id"])]; !ok { + continue + } + } + objects = append(objects, item) + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "id": fmt.Sprint(object["Id"]), + "organization_id": fmt.Sprint(object["Id"]), + "organization_name": object["Name"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["Name"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("organizations", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_rds_backups.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_rds_backups.go new file mode 100644 index 00000000000..1458de801ed --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_rds_backups.go @@ -0,0 +1,271 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudRdsBackups() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudRdsBackupsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "backup_mode": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Automated", "Manual"}, false), + }, + "db_instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "end_time": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "start_time": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "backup_status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Success", "Failed"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "backups": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "backup_download_url": { + Type: schema.TypeString, + Computed: true, + }, + "backup_end_time": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "backup_id": { + Type: schema.TypeString, + Computed: true, + }, + "backup_initiator": { + Type: schema.TypeString, + Computed: true, + }, + "backup_intranet_download_url": { + Type: schema.TypeString, + Computed: true, + }, + "backup_method": { + Type: schema.TypeString, + Computed: true, + }, + "backup_mode": { + Type: schema.TypeString, + Computed: true, + }, + "backup_size": { + Type: schema.TypeString, + Computed: true, + }, + "backup_start_time": { + Type: schema.TypeString, + Computed: true, + }, + "backup_type": { + Type: schema.TypeString, + Computed: true, + }, + "consistent_time": { + Type: schema.TypeString, + Computed: true, + }, + "copy_only_backup": { + Type: schema.TypeString, + Computed: true, + }, + "db_instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "encryption": { + Type: schema.TypeString, + Computed: true, + }, + "host_instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "is_avail": { + Type: schema.TypeInt, + Computed: true, + }, + "meta_status": { + Type: schema.TypeString, + Computed: true, + }, + "backup_status": { + Type: schema.TypeString, + Computed: true, + }, + "storage_class": { + Type: schema.TypeString, + Computed: true, + }, + "store_status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudRdsBackupsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeBackups" + request := make(map[string]interface{}) + request["SourceIp"] = client.SourceIp + if v, ok := d.GetOk("backup_mode"); ok { + request["BackupMode"] = v + } + request["DBInstanceId"] = d.Get("db_instance_id") + if v, ok := d.GetOk("end_time"); ok { + request["EndTime"] = v + } + if v, ok := d.GetOk("start_time"); ok { + request["StartTime"] = v + } + if v, ok := d.GetOk("backup_status"); ok { + request["BackupStatus"] = v + } + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewRdsClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_rds_backups", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Items.Backup", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Items.Backup", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["DBInstanceId"], ":", item["BackupId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "backup_download_url": object["BackupDownloadURL"], + "backup_end_time": object["BackupEndTime"], + "id": fmt.Sprint(object["DBInstanceId"], ":", object["BackupId"]), + "backup_id": fmt.Sprint(object["BackupId"]), + "backup_initiator": object["BackupInitiator"], + "backup_intranet_download_url": object["BackupIntranetDownloadURL"], + "backup_method": object["BackupMethod"], + "backup_mode": object["BackupMode"], + "backup_size": fmt.Sprint(object["BackupSize"]), + "backup_start_time": object["BackupStartTime"], + "backup_type": object["BackupType"], + "consistent_time": fmt.Sprint(object["ConsistentTime"]), + "copy_only_backup": object["CopyOnlyBackup"], + "db_instance_id": object["DBInstanceId"], + "encryption": object["Encryption"], + "host_instance_id": object["HostInstanceID"], + "is_avail": formatInt(object["IsAvail"]), + "meta_status": object["MetaStatus"], + "backup_status": object["BackupStatus"], + "storage_class": object["StorageClass"], + "store_status": object["StoreStatus"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("backups", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_regions.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_regions.go index bcee9d2d4c2..c3ebf786923 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_regions.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_regions.go @@ -77,7 +77,10 @@ func dataSourceAlicloudRegionsRead(d *schema.ResourceData, meta interface{}) err return fmt.Errorf("no matching regions found") } name, nameOk := d.GetOk("name") - current := d.Get("current").(bool) + current := false + if v, exist := d.GetOk("current"); exist { + current = v.(bool) + } var filterRegions []ecs.Region for _, region := range resp.Regions.Region { if current { diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ros_regions.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ros_regions.go new file mode 100644 index 00000000000..85daecedd12 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ros_regions.go @@ -0,0 +1,110 @@ +package alicloud + +import ( + "fmt" + "strconv" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudRosRegions() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudRosRegionsRead, + Schema: map[string]*schema.Schema{ + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "regions": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "region_id": { + Type: schema.TypeString, + Computed: true, + }, + "region_endpoint": { + Type: schema.TypeString, + Computed: true, + }, + "local_name": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudRosRegionsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DescribeRegions" + request := make(map[string]interface{}) + + request["AcceptLanguage"] = "en-US" + + var objects []map[string]interface{} + + var response map[string]interface{} + conn, err := client.NewRosClient() + if err != nil { + return WrapError(err) + } + + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-10"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_ros_regions", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Regions", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Regions", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + objects = append(objects, item) + } + + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "region_id": fmt.Sprint(object["RegionId"]), + "region_endpoint": object["RegionEndpoint"], + "local_name": object["LocalName"], + } + + s = append(s, mapping) + } + d.SetId(strconv.FormatInt(time.Now().Unix(), 16)) + if err := d.Set("regions", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ros_stack_instances.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ros_stack_instances.go new file mode 100644 index 00000000000..6232ac22037 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ros_stack_instances.go @@ -0,0 +1,245 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudRosStackInstances() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudRosStackInstancesRead, + Schema: map[string]*schema.Schema{ + "stack_group_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-zA-Z][-_a-zA-Z0-9]{1,254}$`), "The name can be up to 255 characters in length and can contain digits, letters, hyphens (-), and underscores (_). It must start with a digit or letter."), + }, + "stack_instance_account_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^\d+$`), "It can only be made of numbers."), + }, + "stack_instance_region_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"CURRENT", "OUTDATED"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "instances": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "parameter_overrides": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "parameter_key": { + Type: schema.TypeString, + Computed: true, + }, + "parameter_value": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "stack_group_id": { + Type: schema.TypeString, + Computed: true, + }, + "stack_group_name": { + Type: schema.TypeString, + Computed: true, + }, + "stack_id": { + Type: schema.TypeString, + Computed: true, + }, + "stack_instance_account_id": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "stack_instance_region_id": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "status_reason": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudRosStackInstancesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListStackInstances" + request := make(map[string]interface{}) + request["RegionId"] = client.RegionId + request["StackGroupName"] = d.Get("stack_group_name") + if v, ok := d.GetOk("stack_instance_account_id"); ok { + request["StackInstanceAccountId"] = v + } + if v, ok := d.GetOk("stack_instance_region_id"); ok { + request["StackInstanceRegionId"] = v + } + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewRosClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-10"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_ros_stack_instances", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.StackInstances", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.StackInstances", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(request["StackGroupName"], ":", item["AccountId"], ":", item["RegionId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["Status"].(string) { + continue + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "stack_group_id": object["StackGroupId"], + "stack_group_name": object["StackGroupName"], + "stack_id": object["StackId"], + "stack_instance_account_id": fmt.Sprint(object["AccountId"]), + "id": fmt.Sprint(object["StackGroupName"], ":", object["AccountId"], ":", object["RegionId"]), + "stack_instance_region_id": fmt.Sprint(object["RegionId"]), + "status": object["Status"], + "status_reason": object["StatusReason"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + s = append(s, mapping) + continue + } + rosService := RosService{client} + getResp, err := rosService.DescribeRosStackInstance(mapping["id"].(string)) + if err != nil { + return WrapError(err) + } + + parameterOverrides := make([]map[string]interface{}, 0) + if parameterOverridesList, ok := getResp["ParameterOverrides"].([]interface{}); ok { + for _, v := range parameterOverridesList { + if m1, ok := v.(map[string]interface{}); ok { + temp1 := map[string]interface{}{ + "parameter_key": m1["ParameterKey"], + "parameter_value": m1["ParameterValue"], + } + parameterOverrides = append(parameterOverrides, temp1) + } + } + } + mapping["parameter_overrides"] = parameterOverrides + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("instances", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ros_template_scratches.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ros_template_scratches.go new file mode 100644 index 00000000000..8db07357ac1 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ros_template_scratches.go @@ -0,0 +1,349 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudRosTemplateScratches() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudRosTemplateScratchesRead, + Schema: map[string]*schema.Schema{ + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"GENERATE_COMPLETE", "GENERATE_FAILED", "GENERATE_IN_PROGRESS"}, false), + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "template_scratch_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"ResourceImport", "ArchitectureReplication"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "scratches": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "logical_id_strategy": { + Type: schema.TypeString, + Computed: true, + }, + "preference_parameters": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "parameter_key": { + Type: schema.TypeString, + Computed: true, + }, + "parameter_value": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "source_tag": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "resource_tags": { + Type: schema.TypeMap, + Computed: true, + }, + "resource_type_filter": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + }, + "source_resource_group": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "resource_group_id": { + Type: schema.TypeString, + Computed: true, + }, + "resource_type_filter": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + }, + "source_resources": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "resource_id": { + Type: schema.TypeString, + Computed: true, + }, + "resource_type": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "stacks": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "stack_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "template_scratch_id": { + Type: schema.TypeString, + Computed: true, + }, + "template_scratch_type": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudRosTemplateScratchesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListTemplateScratches" + request := make(map[string]interface{}) + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("status"); ok { + request["Status"] = convertListToJsonString([]interface{}{v}) + } + if v, ok := d.GetOk("template_scratch_type"); ok { + request["TemplateScratchType"] = v + } + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewRosClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-10"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_ros_template_scratches", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.TemplateScratches", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.TemplateScratches", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["TemplateScratchId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "create_time": object["CreateTime"], + "description": object["Description"], + "logical_id_strategy": object["LogicalIdStrategy"], + "status": object["Status"], + "id": fmt.Sprint(object["TemplateScratchId"]), + "template_scratch_id": fmt.Sprint(object["TemplateScratchId"]), + "template_scratch_type": object["TemplateScratchType"], + } + + preferenceParameters := make([]map[string]interface{}, 0) + if preferenceParametersList, ok := object["PreferenceParameters"].([]interface{}); ok { + for _, v := range preferenceParametersList { + if m1, ok := v.(map[string]interface{}); ok { + if v, ok := m1["ParameterValue"]; ok && fmt.Sprint(v) != "" { + temp1 := map[string]interface{}{ + "parameter_key": m1["ParameterKey"], + "parameter_value": v, + } + preferenceParameters = append(preferenceParameters, temp1) + } + } + } + } + mapping["preference_parameters"] = preferenceParameters + + sourceResourceGroupSli := make([]map[string]interface{}, 0) + if v, ok := object["SourceResourceGroup"]; ok { + if sourceResourceGroup, ok := v.(map[string]interface{}); ok && len(sourceResourceGroup) > 0 { + sourceResourceGroupMap := make(map[string]interface{}) + sourceResourceGroupMap["resource_group_id"] = sourceResourceGroup["ResourceGroupId"] + resourceTypeFilter := make([]interface{}, 0) + if v, ok := sourceResourceGroup["ResourceTypeFilter"]; ok { + if vv, ok := v.([]interface{}); ok && len(vv) > 0 { + resourceTypeFilter = append(resourceTypeFilter, vv...) + } + } + sourceResourceGroupMap["resource_type_filter"] = resourceTypeFilter + sourceResourceGroupSli = append(sourceResourceGroupSli, sourceResourceGroupMap) + } + } + mapping["source_resource_group"] = sourceResourceGroupSli + + sourceResources := make([]map[string]interface{}, 0) + if sourceResourcesList, ok := object["SourceResources"].([]interface{}); ok { + for _, v := range sourceResourcesList { + if m1, ok := v.(map[string]interface{}); ok { + temp1 := map[string]interface{}{ + "resource_id": m1["ResourceId"], + "resource_type": m1["ResourceType"], + } + sourceResources = append(sourceResources, temp1) + } + } + } + mapping["source_resources"] = sourceResources + + sourceTagSli := make([]map[string]interface{}, 0) + if v, ok := object["SourceTag"]; ok { + if sourceTag, ok := v.(map[string]interface{}); ok && len(sourceTag) > 0 { + sourceTagMap := make(map[string]interface{}) + sourceTagMap["resource_tags"] = sourceTag["ResourceTags"] + resourceTypeFilter := make([]interface{}, 0) + if v, ok := sourceTag["ResourceTypeFilter"]; ok { + if vv, ok := v.([]interface{}); ok && len(vv) > 0 { + resourceTypeFilter = append(resourceTypeFilter, vv...) + } + } + sourceTagMap["resource_type_filter"] = resourceTypeFilter + sourceTagSli = append(sourceTagSli, sourceTagMap) + } + } + mapping["source_tag"] = sourceTagSli + + ids = append(ids, fmt.Sprint(mapping["id"])) + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + s = append(s, mapping) + continue + } + id := fmt.Sprint(object["TemplateScratchId"]) + rosService := RosService{client} + getResp, err := rosService.DescribeRosTemplateScratch(id) + if err != nil { + return WrapError(err) + } + + stacks := make([]map[string]interface{}, 0) + if stacksList, ok := getResp["Stacks"].([]interface{}); ok { + for _, v := range stacksList { + if m1, ok := v.(map[string]interface{}); ok { + temp1 := map[string]interface{}{ + "stack_id": m1["StackId"], + } + stacks = append(stacks, temp1) + } + } + } + mapping["stacks"] = stacks + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + if err := d.Set("scratches", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_sae_applications.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_sae_applications.go new file mode 100644 index 00000000000..42cced0b3a7 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_sae_applications.go @@ -0,0 +1,493 @@ +package alicloud + +import ( + "fmt" + "strconv" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudSaeApplications() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudSaeApplicationsRead, + Schema: map[string]*schema.Schema{ + "app_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "field_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"appName", "appIds", "slbIps", "instanceIps"}, false), + }, + "field_value": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "namespace_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "order_by": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"running", "instances"}, false), + }, + "reverse": { + Type: schema.TypeBool, + Optional: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"RUNNING", "STOPPED", "UNKNOWN"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "applications": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "app_description": { + Type: schema.TypeString, + Computed: true, + }, + "app_name": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "application_id": { + Type: schema.TypeString, + Computed: true, + }, + "command": { + Type: schema.TypeString, + Computed: true, + }, + "command_args": { + Type: schema.TypeString, + Computed: true, + }, + "config_map_mount_desc": { + Type: schema.TypeString, + Computed: true, + }, + "cpu": { + Type: schema.TypeInt, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "region_id": { + Type: schema.TypeString, + Computed: true, + }, + "repo_name": { + Type: schema.TypeString, + Computed: true, + }, + "repo_namespace": { + Type: schema.TypeString, + Computed: true, + }, + "repo_origin_type": { + Type: schema.TypeString, + Computed: true, + }, + "custom_host_alias": { + Type: schema.TypeString, + Computed: true, + }, + "edas_container_version": { + Type: schema.TypeString, + Computed: true, + }, + "envs": { + Type: schema.TypeString, + Computed: true, + }, + "image_url": { + Type: schema.TypeString, + Computed: true, + }, + "jar_start_args": { + Type: schema.TypeString, + Computed: true, + }, + "jar_start_options": { + Type: schema.TypeString, + Computed: true, + }, + "jdk": { + Type: schema.TypeString, + Computed: true, + }, + "liveness": { + Type: schema.TypeString, + Computed: true, + }, + "memory": { + Type: schema.TypeInt, + Computed: true, + }, + "min_ready_instances": { + Type: schema.TypeInt, + Computed: true, + }, + "mount_desc": { + Type: schema.TypeString, + Computed: true, + }, + "mount_host": { + Type: schema.TypeString, + Computed: true, + }, + "namespace_id": { + Type: schema.TypeString, + Computed: true, + }, + "nas_id": { + Type: schema.TypeString, + Computed: true, + }, + "oss_ak_id": { + Type: schema.TypeString, + Computed: true, + }, + "oss_ak_secret": { + Type: schema.TypeString, + Computed: true, + }, + "oss_mount_descs": { + Type: schema.TypeString, + Computed: true, + }, + "package_type": { + Type: schema.TypeString, + Computed: true, + }, + "package_url": { + Type: schema.TypeString, + Computed: true, + }, + "package_version": { + Type: schema.TypeString, + Computed: true, + }, + "php_arms_config_location": { + Type: schema.TypeString, + Computed: true, + }, + "php_config": { + Type: schema.TypeString, + Computed: true, + }, + "php_config_location": { + Type: schema.TypeString, + Computed: true, + }, + "post_start": { + Type: schema.TypeString, + Computed: true, + }, + "pre_stop": { + Type: schema.TypeString, + Computed: true, + }, + "readiness": { + Type: schema.TypeString, + Computed: true, + }, + "replicas": { + Type: schema.TypeInt, + Computed: true, + }, + "security_group_id": { + Type: schema.TypeString, + Computed: true, + }, + "sls_configs": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "termination_grace_period_seconds": { + Type: schema.TypeInt, + Computed: true, + }, + "acr_assume_role_arn": { + Type: schema.TypeString, + Computed: true, + }, + "timezone": { + Type: schema.TypeString, + Computed: true, + }, + "tomcat_config": { + Type: schema.TypeString, + Computed: true, + }, + "vswitch_id": { + Type: schema.TypeString, + Computed: true, + }, + "vpc_id": { + Type: schema.TypeString, + Computed: true, + }, + "war_start_options": { + Type: schema.TypeString, + Computed: true, + }, + "web_container": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudSaeApplicationsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "/pop/v1/sam/app/listApplications" + request := make(map[string]*string) + if v, ok := d.GetOk("app_name"); ok { + request["AppName"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("field_type"); ok { + request["FieldType"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("field_value"); ok { + request["FieldValue"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("namespace_id"); ok { + request["NamespaceId"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("order_by"); ok { + request["OrderBy"] = StringPointer(v.(string)) + } + if v, ok := d.GetOkExists("reverse"); ok { + request["Reverse"] = StringPointer(v.(string)) + } + request["PageSize"] = StringPointer(strconv.Itoa(PageSizeLarge)) + request["CurrentPage"] = StringPointer("1") + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewServerlessClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer("2019-05-06"), nil, StringPointer("GET"), StringPointer("AK"), StringPointer(action), request, nil, nil, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_sae_applications", "GET "+action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", "GET "+action, response)) + } + if respBody, isExist := response["body"]; isExist { + response = respBody.(map[string]interface{}) + } else { + return WrapError(fmt.Errorf("%s failed, response: %v", "GET "+action, response)) + } + resp, err := jsonpath.Get("$.Data.Applications", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Data.Applications", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["AppId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + currentPage, err := strconv.Atoi(*request["CurrentPage"]) + if err != nil { + return WrapError(err) + } + request["CurrentPage"] = StringPointer(strconv.Itoa(currentPage + 1)) + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "app_description": object["AppDescription"], + "app_name": object["AppName"], + "id": fmt.Sprint(object["AppId"]), + "application_id": fmt.Sprint(object["AppId"]), + "namespace_id": object["NamespaceId"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + s = append(s, mapping) + continue + } + id := fmt.Sprint(object["AppId"]) + saeService := SaeService{client} + getResp, err := saeService.DescribeSaeApplication(id) + if err != nil { + return WrapError(err) + } + mapping["acr_assume_role_arn"] = getResp["AcrAssumeRoleArn"] + mapping["command"] = getResp["Command"] + mapping["command_args"] = getResp["CommandArgs"] + config_map_mount_desc, _ := convertArrayObjectToJsonString(getResp["ConfigMapMountDesc"]) + mapping["config_map_mount_desc"] = config_map_mount_desc + + if v, ok := getResp["Cpu"]; ok && fmt.Sprint(v) != "0" { + mapping["cpu"] = formatInt(v) + } + mapping["custom_host_alias"] = getResp["CustomHostAlias"] + mapping["edas_container_version"] = getResp["EdasContainerVersion"] + mapping["envs"] = getResp["Envs"] + mapping["image_url"] = getResp["ImageUrl"] + mapping["jar_start_args"] = getResp["JarStartArgs"] + mapping["jar_start_options"] = getResp["JarStartOptions"] + mapping["jdk"] = getResp["Jdk"] + mapping["liveness"] = getResp["Liveness"] + if v, ok := getResp["Memory"]; ok && fmt.Sprint(v) != "0" { + mapping["memory"] = formatInt(v) + } + if v, ok := getResp["MinReadyInstances"]; ok && fmt.Sprint(v) != "0" { + mapping["min_ready_instances"] = formatInt(v) + } + mapping["mount_desc"] = getResp["MountDesc"] + mapping["mount_host"] = getResp["MountHost"] + mapping["nas_id"] = getResp["NasId"] + mapping["oss_ak_id"] = getResp["OssAkId"] + mapping["oss_ak_secret"] = getResp["OssAkSecret"] + mapping["oss_mount_descs"] = getResp["OssMountDescs"] + mapping["package_type"] = getResp["PackageType"] + mapping["package_url"] = getResp["PackageUrl"] + mapping["package_version"] = getResp["PackageVersion"] + mapping["php_arms_config_location"] = getResp["PhpArmsConfigLocation"] + mapping["php_config"] = getResp["PhpConfig"] + mapping["php_config_location"] = getResp["PhpConfigLocation"] + mapping["post_start"] = getResp["PostStart"] + mapping["pre_stop"] = getResp["PreStop"] + mapping["readiness"] = getResp["Readiness"] + if v, ok := getResp["Replicas"]; ok && fmt.Sprint(v) != "0" { + mapping["replicas"] = formatInt(v) + } + mapping["security_group_id"] = getResp["SecurityGroupId"] + mapping["sls_configs"] = getResp["SlsConfigs"] + if v, ok := getResp["TerminationGracePeriodSeconds"]; ok && fmt.Sprint(v) != "0" { + mapping["termination_grace_period_seconds"] = formatInt(v) + } + mapping["timezone"] = getResp["Timezone"] + mapping["tomcat_config"] = getResp["TomcatConfig"] + mapping["vswitch_id"] = getResp["VSwitchId"] + mapping["vpc_id"] = getResp["VpcId"] + mapping["war_start_options"] = getResp["WarStartOptions"] + mapping["web_container"] = getResp["WebContainer"] + saeService = SaeService{client} + if imageUrl, exist := getResp["ImageUrl"]; exist { + applicationImageResp, err := saeService.DescribeApplicationImage(id, imageUrl.(string)) + if err != nil { + return WrapError(err) + } + mapping["region_id"] = applicationImageResp["RegionId"] + mapping["repo_name"] = applicationImageResp["RepoName"] + mapping["repo_namespace"] = applicationImageResp["RepoNamespace"] + mapping["repo_origin_type"] = applicationImageResp["RepoOriginType"] + } + + getRespStatus, err := saeService.DescribeApplicationStatus(id) + if err != nil { + return WrapError(err) + } + if statusOk && status != "" && status != getRespStatus["CurrentStatus"].(string) { + continue + } + mapping["create_time"] = getRespStatus["CreateTime"] + mapping["status"] = getRespStatus["CurrentStatus"] + + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("applications", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_sae_ingresses.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_sae_ingresses.go new file mode 100644 index 00000000000..0a590b30c48 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_sae_ingresses.go @@ -0,0 +1,186 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudSaeIngresses() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudSaeIngressesRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "namespace_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "ingresses": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "cert_id": { + Type: schema.TypeString, + Computed: true, + }, + "default_rule": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "ingress_id": { + Type: schema.TypeString, + Computed: true, + }, + "listener_port": { + Type: schema.TypeInt, + Computed: true, + }, + "namespace_id": { + Type: schema.TypeString, + Computed: true, + }, + "slb_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudSaeIngressesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "/pop/v1/sam/ingress/IngressList" + request := make(map[string]*string) + request["NamespaceId"] = StringPointer(d.Get("namespace_id").(string)) + + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewServerlessClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer("2019-05-06"), nil, StringPointer("GET"), StringPointer("AK"), StringPointer(action), request, nil, nil, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_sae_ingresses", action, AlibabaCloudSdkGoERROR) + } + if respBody, isExist := response["body"]; isExist { + response = respBody.(map[string]interface{}) + } else { + return WrapError(fmt.Errorf("%s failed, response: %v", "AlicloudSaeIngressesRead", response)) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", "GET "+action, response)) + } + resp, err := jsonpath.Get("$.Data.IngressList", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Data.IngressList", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["Id"])]; !ok { + continue + } + } + objects = append(objects, item) + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "cert_id": object["CertId"], + "description": object["Description"], + "id": fmt.Sprint(object["Id"]), + "ingress_id": fmt.Sprint(object["Id"]), + "listener_port": formatInt(object["ListenerPort"]), + "namespace_id": object["NamespaceId"], + "slb_id": object["SlbId"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + s = append(s, mapping) + continue + } + id := fmt.Sprint(object["Id"]) + saeService := SaeService{client} + getResp, err := saeService.DescribeSaeIngress(id) + if err != nil { + return WrapError(err) + } + mapping["default_rule"] = getResp["DefaultRule"] + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("ingresses", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_sae_instance_specifications.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_sae_instance_specifications.go new file mode 100644 index 00000000000..c87bbdda4e2 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_sae_instance_specifications.go @@ -0,0 +1,154 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudSaeInstanceSpecifications() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudSaeInstanceSpecificationsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "specifications": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "cpu": { + Type: schema.TypeInt, + Computed: true, + }, + "enable": { + Type: schema.TypeBool, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "instance_specification_id": { + Type: schema.TypeString, + Computed: true, + }, + "memory": { + Type: schema.TypeInt, + Computed: true, + }, + "spec_info": { + Type: schema.TypeString, + Computed: true, + }, + "version": { + Type: schema.TypeInt, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudSaeInstanceSpecificationsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "/pop/v1/paas/quota/instanceSpecifications" + request := make(map[string]*string) + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewServerlessClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer("2019-05-06"), nil, StringPointer("GET"), StringPointer("AK"), StringPointer(action), request, nil, nil, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_sae_instance_specifications", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + resp, err := jsonpath.Get("$.body.Data", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.body.Data", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["Id"])]; !ok { + continue + } + } + objects = append(objects, item) + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "cpu": formatInt(object["Cpu"]), + "enable": object["Enable"], + "id": fmt.Sprint(object["Id"]), + "instance_specification_id": fmt.Sprint(object["Id"]), + "memory": formatInt(object["Memory"]), + "spec_info": object["SpecInfo"], + "version": formatInt(object["Version"]), + } + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("specifications", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_sae_service.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_sae_service.go index f4976407b93..2841285a643 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_sae_service.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_sae_service.go @@ -54,7 +54,7 @@ func dataSourceAlicloudSaeServiceRead(d *schema.ResourceData, meta interface{}) return nil }) if err != nil { - if IsExpectedErrors(err, []string{"SYSTEM.SALE_VALIDATE_NO_SPECIFIC_CODE_FAILED"}) { + if IsExpectedErrors(err, []string{"ORDER.OPEND", "SYSTEM.SALE_VALIDATE_NO_SPECIFIC_CODE_FAILED"}) { d.SetId("SaeServiceHasBeenOpened") d.Set("status", "Opened") return nil diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_sddp_configs.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_sddp_configs.go new file mode 100644 index 00000000000..3f1a85c470d --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_sddp_configs.go @@ -0,0 +1,161 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudSddpConfigs() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudSddpConfigsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "lang": { + Type: schema.TypeString, + ValidateFunc: validation.StringInSlice([]string{"zh", "en"}, false), + Default: "zh", + Optional: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "configs": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, + "code": { + Type: schema.TypeString, + Computed: true, + }, + "config_id": { + Type: schema.TypeString, + Computed: true, + }, + "default_value": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "value": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudSddpConfigsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DescribeConfigs" + request := make(map[string]interface{}) + if v, ok := d.GetOk("lang"); ok { + request["Lang"] = v + } + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewSddpClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-01-03"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_sddp_configs", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$", response) + } + var configlistMap map[string]interface{} + if _, ok := resp.(map[string]interface{}); ok { + configlistMap = resp.(map[string]interface{}) + } + + result, _ := configlistMap["ConfigList"].([]interface{}) + + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["Code"])]; !ok { + continue + } + } + objects = append(objects, item) + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := make(map[string]interface{}, 0) + mapping["code"] = object["Code"] + mapping["config_id"] = object["Id"] + mapping["default_value"] = object["DefaultValue"] + mapping["description"] = object["Description"] + mapping["value"] = object["Value"] + ids = append(ids, fmt.Sprint(mapping["code"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("configs", s); err != nil { + return WrapError(err) + } + + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_sddp_instances.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_sddp_instances.go new file mode 100644 index 00000000000..e6d5cc0af2f --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_sddp_instances.go @@ -0,0 +1,130 @@ +package alicloud + +import ( + "fmt" + "strconv" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudSddpInstances() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudSddpInstancesRead, + Schema: map[string]*schema.Schema{ + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "instances": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "authed": { + Type: schema.TypeBool, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "instance_num": { + Type: schema.TypeString, + Computed: true, + }, + "odps_set": { + Type: schema.TypeBool, + Computed: true, + }, + "oss_bucket_set": { + Type: schema.TypeBool, + Computed: true, + }, + "oss_size": { + Type: schema.TypeString, + Computed: true, + }, + "payment_type": { + Type: schema.TypeString, + Computed: true, + }, + "rds_set": { + Type: schema.TypeBool, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudSddpInstancesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DescribeUserStatus" + request := make(map[string]interface{}) + var response map[string]interface{} + conn, err := client.NewSddpClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-01-03"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_sddp_instances", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.UserStatus", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.UserStatus", response) + } + userstatus := resp.(map[string]interface{}) + s := make([]map[string]interface{}, 0) + mapping := map[string]interface{}{ + "authed": userstatus["Authed"], + "id": fmt.Sprint(userstatus["InstanceId"]), + "instance_id": fmt.Sprint(userstatus["InstanceId"]), + "instance_num": fmt.Sprint(userstatus["InstanceNum"]), + "odps_set": userstatus["OdpsSet"], + "oss_bucket_set": userstatus["OssBucketSet"], + "oss_size": fmt.Sprint(userstatus["OssSize"]), + "payment_type": convertSddpInstancePaymentTypeToStandard(userstatus["ChargeType"]), + "rds_set": userstatus["RdsSet"], + "status": fmt.Sprint(userstatus["InstanceStatus"]), + } + s = append(s, mapping) + d.SetId(strconv.FormatInt(time.Now().Unix(), 16)) + + if err := d.Set("instances", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_security_center_groups.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_security_center_groups.go new file mode 100644 index 00000000000..76a90dedc18 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_security_center_groups.go @@ -0,0 +1,166 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudSecurityCenterGroups() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudSecurityCenterGroupsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "groups": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "group_flag": { + Type: schema.TypeInt, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "group_id": { + Type: schema.TypeString, + Computed: true, + }, + "group_name": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudSecurityCenterGroupsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeAllGroups" + request := make(map[string]interface{}) + var objects []map[string]interface{} + var groupNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + groupNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewSasClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-12-03"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_security_center_groups", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Groups", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Groups", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if groupNameRegex != nil && !groupNameRegex.MatchString(fmt.Sprint(item["GroupName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["GroupId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "group_flag": formatInt(object["GroupFlag"]), + "id": fmt.Sprint(object["GroupId"]), + "group_id": fmt.Sprint(object["GroupId"]), + "group_name": object["GroupName"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["GroupName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("groups", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_service_mesh_service_meshes.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_service_mesh_service_meshes.go new file mode 100644 index 00000000000..23e1c137e98 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_service_mesh_service_meshes.go @@ -0,0 +1,678 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudServiceMeshServiceMeshes() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudServiceMeshServiceMeshesRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"running", "initial"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "meshes": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "clusters": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "endpoints": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "intranet_api_server_endpoint": { + Type: schema.TypeString, + Computed: true, + }, + "intranet_pilot_endpoint": { + Type: schema.TypeString, + Computed: true, + }, + "public_api_server_endpoint": { + Type: schema.TypeString, + Computed: true, + }, + "public_pilot_endpoint": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "error_message": { + Type: schema.TypeString, + Computed: true, + }, + "load_balancer": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "api_server_loadbalancer_id": { + Type: schema.TypeString, + Computed: true, + }, + "api_server_public_eip": { + Type: schema.TypeBool, + Computed: true, + }, + "pilot_public_eip": { + Type: schema.TypeBool, + Computed: true, + }, + "pilot_public_loadbalancer_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "edition": { + Type: schema.TypeString, + Computed: true, + }, + "mesh_config": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "access_log": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "enabled": { + Type: schema.TypeBool, + Computed: true, + }, + }, + }, + }, + "audit": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "enabled": { + Type: schema.TypeBool, + Computed: true, + }, + "project": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "customized_zipkin": { + Type: schema.TypeBool, + Computed: true, + }, + "enable_locality_lb": { + Type: schema.TypeBool, + Computed: true, + }, + "include_ip_ranges": { + Type: schema.TypeString, + Computed: true, + }, + "kiali": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "enabled": { + Type: schema.TypeBool, + Computed: true, + }, + "url": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "opa": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "enabled": { + Type: schema.TypeBool, + Computed: true, + }, + "limit_cpu": { + Type: schema.TypeString, + Computed: true, + }, + "limit_memory": { + Type: schema.TypeString, + Computed: true, + }, + "log_level": { + Type: schema.TypeString, + Computed: true, + }, + "request_cpu": { + Type: schema.TypeString, + Computed: true, + }, + "request_memory": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "outbound_traffic_policy": { + Type: schema.TypeString, + Computed: true, + }, + "pilot": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "http10_enabled": { + Type: schema.TypeBool, + Computed: true, + }, + "trace_sampling": { + Type: schema.TypeFloat, + Computed: true, + }, + }, + }, + }, + "prometheus": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "external_url": { + Type: schema.TypeString, + Computed: true, + }, + "use_external": { + Type: schema.TypeBool, + Computed: true, + }, + }, + }, + }, + "proxy": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "cluster_domain": { + Type: schema.TypeString, + Computed: true, + }, + "limit_cpu": { + Type: schema.TypeString, + Computed: true, + }, + "limit_memory": { + Type: schema.TypeString, + Computed: true, + }, + "request_cpu": { + Type: schema.TypeString, + Computed: true, + }, + "request_memory": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "sidecar_injector": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "auto_injection_policy_enabled": { + Type: schema.TypeBool, + Computed: true, + }, + "enable_namespaces_by_default": { + Type: schema.TypeBool, + Computed: true, + }, + "init_cni_configuration": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "enabled": { + Type: schema.TypeBool, + Computed: true, + }, + "exclude_namespaces": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "limit_cpu": { + Type: schema.TypeString, + Computed: true, + }, + "limit_memory": { + Type: schema.TypeString, + Computed: true, + }, + "request_cpu": { + Type: schema.TypeString, + Computed: true, + }, + "request_memory": { + Type: schema.TypeString, + Computed: true, + }, + "sidecar_injector_webhook_as_yaml": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "telemetry": { + Type: schema.TypeBool, + Computed: true, + }, + "tracing": { + Type: schema.TypeBool, + Computed: true, + }, + }, + }, + }, + "network": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "security_group_id": { + Type: schema.TypeString, + Computed: true, + }, + "vswitche_list": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "vpc_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "service_mesh_id": { + Type: schema.TypeString, + Computed: true, + }, + "service_mesh_name": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "version": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "enable_details": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func dataSourceAlicloudServiceMeshServiceMeshesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeServiceMeshes" + request := make(map[string]interface{}) + var objects []map[string]interface{} + var serviceMeshNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + serviceMeshNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewServicemeshClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("GET"), StringPointer("2020-01-11"), StringPointer("AK"), request, nil, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_service_mesh_service_meshes", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.ServiceMeshes", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.ServiceMeshes", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if serviceMeshNameRegex != nil && !serviceMeshNameRegex.MatchString(fmt.Sprint(item["ServiceMeshInfo"].(map[string]interface{})["Name"])) { + continue + } + if len(idsMap) > 0 { + id := item["ServiceMeshInfo"].(map[string]interface{})["ServiceMeshId"] + if _, ok := idsMap[fmt.Sprint(id)]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["ServiceMeshInfo"].(map[string]interface{})["State"].(string) { + continue + } + objects = append(objects, item) + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "clusters": object["Clusters"], + } + if objectArg, ok := object["ServiceMeshInfo"].(map[string]interface{}); ok { + mapping["create_time"] = objectArg["CreationTime"] + mapping["error_message"] = objectArg["ErrorMessage"] + mapping["id"] = fmt.Sprint(objectArg["ServiceMeshId"]) + mapping["service_mesh_id"] = fmt.Sprint(objectArg["ServiceMeshId"]) + mapping["service_mesh_name"] = objectArg["Name"] + mapping["status"] = objectArg["State"] + mapping["version"] = objectArg["Version"] + } + + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["ServiceMeshInfo"].(map[string]interface{})["Name"]) + if detailedEnabled := d.Get("enable_details"); !detailedEnabled.(bool) { + s = append(s, mapping) + continue + } + id := fmt.Sprint(object["ServiceMeshInfo"].(map[string]interface{})["ServiceMeshId"]) + servicemeshService := ServicemeshService{client} + getResp, err := servicemeshService.DescribeServiceMeshServiceMesh(id) + if err != nil { + return WrapError(err) + } + endpointsSli := make([]map[string]interface{}, 0) + if endpoints, ok := getResp["Endpoints"]; ok { + endpointsMap := make(map[string]interface{}) + if endpointsArg, ok := endpoints.(map[string]interface{}); ok && len(endpointsArg) > 0 { + endpointsMap["intranet_pilot_endpoint"] = endpointsArg["IntranetPilotEndpoint"] + endpointsMap["public_pilot_endpoint"] = endpointsArg["PublicPilotEndpoint"] + endpointsMap["intranet_api_server_endpoint"] = endpointsArg["IntranetApiServerEndpoint"] + endpointsMap["public_api_server_endpoint"] = endpointsArg["PublicApiServerEndpoint"] + endpointsSli = append(endpointsSli, endpointsMap) + mapping["endpoints"] = endpointsSli + } + } + if spec, ok := getResp["Spec"]; ok { + if specArg, ok := spec.(map[string]interface{}); ok && len(specArg) > 0 { + meshConfigSli := make([]map[string]interface{}, 0) + if meshConfig, ok := specArg["MeshConfig"]; ok { + meshConfigMap := make(map[string]interface{}) + if meshConfigArg, ok := meshConfig.(map[string]interface{}); ok && len(meshConfigArg) > 0 { + accessLogSli := make([]map[string]interface{}, 0) + if accessLog, ok := meshConfigArg["AccessLog"]; ok { + if accessLogArg, ok := accessLog.(map[string]interface{}); ok && len(accessLogArg) > 0 { + accessLogMap := make(map[string]interface{}) + accessLogMap["enabled"] = accessLogArg["Enabled"] + accessLogSli = append(accessLogSli, accessLogMap) + } + } + meshConfigMap["access_log"] = accessLogSli + auditSli := make([]map[string]interface{}, 0) + if audit, ok := meshConfigArg["Audit"]; ok { + auditMap := make(map[string]interface{}) + if auditArg, ok := audit.(map[string]interface{}); ok && len(auditArg) > 0 { + auditMap["enabled"] = auditArg["Enabled"] + auditMap["project"] = auditArg["Project"] + auditSli = append(auditSli, auditMap) + meshConfigMap["audit"] = auditSli + } + } + mapping["edition"] = meshConfigArg["Profile"] + meshConfigMap["customized_zipkin"] = meshConfigArg["CustomizedZipkin"] + meshConfigMap["enable_locality_lb"] = meshConfigArg["EnableLocalityLB"] + meshConfigMap["include_ip_ranges"] = meshConfigArg["IncludeIPRanges"] + + kialiSli := make([]map[string]interface{}, 0) + if kiali, ok := meshConfigArg["Kiali"]; ok { + if kialiArg, ok := kiali.(map[string]interface{}); ok && len(kialiArg) > 0 { + kialiMap := make(map[string]interface{}) + kialiMap["enabled"] = kialiArg["Enabled"] + if v, ok := kialiArg["Url"]; ok { + kialiMap["url"] = v + } + kialiSli = append(kialiSli, kialiMap) + } + } + meshConfigMap["kiali"] = kialiSli + + opaSli := make([]map[string]interface{}, 0) + if opa, ok := meshConfigArg["OPA"]; ok { + opaMap := make(map[string]interface{}) + if opaArg, ok := opa.(map[string]interface{}); ok && len(opaArg) > 0 { + opaMap["enabled"] = opaArg["Enabled"] + opaMap["limit_cpu"] = opaArg["LimitCPU"] + opaMap["limit_memory"] = opaArg["LimitMemory"] + opaMap["log_level"] = opaArg["LogLevel"] + opaMap["request_cpu"] = opaArg["RequestCPU"] + opaMap["request_memory"] = opaArg["RequestMemory"] + } + opaSli = append(opaSli, opaMap) + } + meshConfigMap["opa"] = opaSli + meshConfigMap["outbound_traffic_policy"] = meshConfigArg["OutboundTrafficPolicy"] + + pilotSli := make([]map[string]interface{}, 0) + if pilot := meshConfigArg["Pilot"]; ok { + if pilotArg, ok := pilot.(map[string]interface{}); ok && len(pilotArg) > 0 { + pilotMap := make(map[string]interface{}) + pilotMap["http10_enabled"] = pilotArg["Http10Enabled"] + pilotMap["trace_sampling"] = pilotArg["TraceSampling"] + pilotSli = append(pilotSli, pilotMap) + } + } + meshConfigMap["pilot"] = pilotSli + + prometheusSli := make([]map[string]interface{}, 0) + if prometheus, ok := meshConfigArg["Prometheus"]; ok { + if prometheusArg, ok := prometheus.(map[string]interface{}); ok && len(prometheusArg) > 0 { + prometheusMap := make(map[string]interface{}) + prometheusMap["external_url"] = prometheusArg["ExternalUrl"] + prometheusMap["use_external"] = prometheusArg["UseExternal"] + prometheusSli = append(prometheusSli, prometheusMap) + } + } + meshConfigMap["prometheus"] = prometheusSli + + proxySli := make([]map[string]interface{}, 0) + if proxy, ok := meshConfigArg["Proxy"]; ok { + if proxyArg, ok := proxy.(map[string]interface{}); ok && len(proxyArg) > 0 { + proxyMap := make(map[string]interface{}) + proxyMap["cluster_domain"] = proxyArg["ClusterDomain"] + proxyMap["limit_cpu"] = proxyArg["LimitCPU"] + proxyMap["limit_memory"] = proxyArg["LimitMemory"] + proxyMap["request_cpu"] = proxyArg["RequestCPU"] + proxyMap["request_memory"] = proxyArg["RequestMemory"] + proxySli = append(proxySli, proxyMap) + } + } + meshConfigMap["proxy"] = proxySli + + sidecarInjectorSli := make([]map[string]interface{}, 0) + if sidecarInjector, ok := meshConfigArg["SidecarInjector"]; ok { + if sidecarInjectorArg, ok := sidecarInjector.(map[string]interface{}); ok && len(sidecarInjectorArg) > 0 { + sidecarInjectorMap := make(map[string]interface{}) + sidecarInjectorMap["auto_injection_policy_enabled"] = sidecarInjectorArg["AutoInjectionPolicyEnabled"] + sidecarInjectorMap["enable_namespaces_by_default"] = sidecarInjectorArg["EnableNamespacesByDefault"] + + initCNIConfigurationSli := make([]map[string]interface{}, 0) + if initCNIConfiguration, ok := sidecarInjectorArg["InitCNIConfiguration"]; ok { + if initCNIConfigurationArg, ok := initCNIConfiguration.(map[string]interface{}); ok && len(initCNIConfigurationArg) > 0 { + initCNIConfigurationMap := make(map[string]interface{}) + initCNIConfigurationMap["enabled"] = initCNIConfigurationArg["Enabled"] + initCNIConfigurationMap["exclude_namespaces"] = initCNIConfigurationArg["ExcludeNamespaces"] + initCNIConfigurationSli = append(initCNIConfigurationSli, initCNIConfigurationMap) + } + } + sidecarInjectorMap["init_cni_configuration"] = initCNIConfigurationSli + sidecarInjectorMap["limit_cpu"] = sidecarInjectorArg["LimitCPU"] + sidecarInjectorMap["limit_memory"] = sidecarInjectorArg["LimitMemory"] + sidecarInjectorMap["request_cpu"] = sidecarInjectorArg["RequestCPU"] + sidecarInjectorMap["request_memory"] = sidecarInjectorArg["RequestMemory"] + if v, ok := sidecarInjectorArg["SidecarInjectorWebhookAsYaml"]; ok { + sidecarInjectorMap["sidecar_injector_webhook_as_yaml"] = v + } + sidecarInjectorSli = append(sidecarInjectorSli, sidecarInjectorMap) + } + } + meshConfigMap["sidecar_injector"] = sidecarInjectorSli + meshConfigMap["telemetry"] = meshConfigArg["Telemetry"] + meshConfigMap["tracing"] = meshConfigArg["Tracing"] + meshConfigSli = append(meshConfigSli, meshConfigMap) + } + } + mapping["mesh_config"] = meshConfigSli + + loadBalancerSli := make([]map[string]interface{}, 0) + if loadBalancer, ok := specArg["LoadBalancer"]; ok { + if loadBalancerArg, ok := loadBalancer.(map[string]interface{}); ok && len(loadBalancerArg) > 0 { + loadBalancerMap := make(map[string]interface{}) + loadBalancerMap["pilot_public_eip"] = loadBalancerArg["PilotPublicEip"] + loadBalancerMap["pilot_public_loadbalancer_id"] = loadBalancerArg["PilotPublicLoadbalancerId"] + loadBalancerMap["api_server_loadbalancer_id"] = loadBalancerArg["ApiServerLoadbalancerId"] + loadBalancerMap["api_server_public_eip"] = loadBalancerArg["ApiServerPublicEip"] + loadBalancerSli = append(loadBalancerSli, loadBalancerMap) + } + } + mapping["load_balancer"] = loadBalancerSli + + networkSli := make([]map[string]interface{}, 0) + if network, ok := specArg["Network"]; ok { + if networkArg, ok := network.(map[string]interface{}); ok && len(networkArg) > 0 { + networkMap := make(map[string]interface{}) + networkMap["vswitche_list"] = networkArg["VSwitches"] + networkMap["vpc_id"] = networkArg["VpcId"] + networkMap["security_group_id"] = networkArg["SecurityGroupId"] + networkSli = append(networkSli, networkMap) + } + } + mapping["network"] = networkSli + } + } + + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("meshes", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_simple_application_server_custom_images.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_simple_application_server_custom_images.go new file mode 100644 index 00000000000..af52d64acf2 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_simple_application_server_custom_images.go @@ -0,0 +1,173 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudSimpleApplicationServerCustomImages() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudSimpleApplicationServerCustomImagesRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "images": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, + "custom_image_id": { + Type: schema.TypeString, + Computed: true, + }, + "custom_image_name": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "platform": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudSimpleApplicationServerCustomImagesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListImages" + request := make(map[string]interface{}) + request["ImageType"] = "custom" + request["RegionId"] = client.RegionId + var objects []map[string]interface{} + var customImageNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + customImageNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewSwasClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_simple_application_server_custom_images", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Images", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Images", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if customImageNameRegex != nil && !customImageNameRegex.MatchString(fmt.Sprint(item["ImageName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["ImageId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "id": fmt.Sprint(object["ImageId"]), + "custom_image_id": fmt.Sprint(object["ImageId"]), + "custom_image_name": object["ImageName"], + "description": object["Description"], + "platform": object["Platform"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["ImageName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("images", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_simple_application_server_disks.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_simple_application_server_disks.go new file mode 100644 index 00000000000..15b31899ac3 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_simple_application_server_disks.go @@ -0,0 +1,251 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudSimpleApplicationServerDisks() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudSimpleApplicationServerDisksRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "disk_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"System", "Data"}, false), + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Attaching", "Available", "Creating", "Detaching", "In_use", "ReIniting"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "disks": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "category": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "device": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "disk_id": { + Type: schema.TypeString, + Computed: true, + }, + "disk_name": { + Type: schema.TypeString, + Computed: true, + }, + "disk_type": { + Type: schema.TypeString, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "payment_type": { + Type: schema.TypeString, + Computed: true, + }, + "size": { + Type: schema.TypeInt, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudSimpleApplicationServerDisksRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListDisks" + request := make(map[string]interface{}) + if v, ok := d.GetOk("instance_id"); ok { + request["InstanceId"] = v + } + diskType, diskTypeOk := d.GetOk("disk_type") + request["RegionId"] = client.RegionId + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + var diskNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + diskNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewSwasClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidInstanceId.NotFound"}) { + break + } + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_simple_application_server_disks", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Disks", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Disks", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if diskNameRegex != nil && !diskNameRegex.MatchString(fmt.Sprint(item["DiskName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["DiskId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["Status"].(string) { + continue + } + if diskTypeOk && diskType.(string) != "" && diskType.(string) != item["DiskType"].(string) { + continue + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "category": object["Category"], + "create_time": object["CreationTime"], + "device": object["Device"], + "id": fmt.Sprint(object["DiskId"]), + "disk_id": fmt.Sprint(object["DiskId"]), + "disk_name": object["DiskName"], + "disk_type": object["DiskType"], + "instance_id": object["InstanceId"], + "payment_type": convertSimpleApplicationServerDiskPaymentTypeResponse(object["DiskChargeType"].(string)), + "size": formatInt(object["Size"]), + "status": object["Status"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["DiskName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("disks", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} + +func convertSimpleApplicationServerDiskPaymentTypeResponse(source interface{}) interface{} { + switch source { + case "PostPaid": + return "PayAsYouGo" + case "PrePaid": + return "Subscription" + } + return source +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_simple_application_server_firewall_rules.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_simple_application_server_firewall_rules.go new file mode 100644 index 00000000000..759727a212b --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_simple_application_server_firewall_rules.go @@ -0,0 +1,161 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudSimpleApplicationServerFirewallRules() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudSimpleApplicationServerFirewallRulesRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "rules": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, + "firewall_rule_id": { + Type: schema.TypeString, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "port": { + Type: schema.TypeString, + Computed: true, + }, + "remark": { + Type: schema.TypeString, + Computed: true, + }, + "rule_protocol": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudSimpleApplicationServerFirewallRulesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListFirewallRules" + request := make(map[string]interface{}) + request["InstanceId"] = d.Get("instance_id") + request["RegionId"] = client.RegionId + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewSwasClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_simple_application_server_firewall_rules", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.FirewallRules", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.FirewallRules", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(request["InstanceId"], ":", item["RuleId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "id": fmt.Sprint(request["InstanceId"], ":", object["FirewallId"]), + "firewall_rule_id": fmt.Sprint(object["RuleId"]), + "instance_id": request["InstanceId"], + "port": object["Port"], + "remark": object["Remark"], + "rule_protocol": convertSimpleApplicationServerFirewallRuleRuleProtocolResponse(object["RuleProtocol"].(string)), + } + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("rules", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_simple_application_server_images.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_simple_application_server_images.go new file mode 100644 index 00000000000..7fdb83d573d --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_simple_application_server_images.go @@ -0,0 +1,180 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudSimpleApplicationServerImages() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudSimpleApplicationServerImagesRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "image_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"app", "custom", "system"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "images": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "description": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "image_id": { + Type: schema.TypeString, + Computed: true, + }, + "image_name": { + Type: schema.TypeString, + Computed: true, + }, + "image_type": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudSimpleApplicationServerImagesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListImages" + request := make(map[string]interface{}) + if v, ok := d.GetOk("image_type"); ok { + request["ImageType"] = v + } + var objects []map[string]interface{} + var instanceImageNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + instanceImageNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewSwasClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_simple_application_server_images", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Images", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Images", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if instanceImageNameRegex != nil && !instanceImageNameRegex.MatchString(fmt.Sprint(item["ImageName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["ImageId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "description": object["Description"], + "id": fmt.Sprint(object["ImageId"]), + "image_id": fmt.Sprint(object["ImageId"]), + "image_name": object["ImageName"], + "image_type": object["ImageType"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["ImageName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("images", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_simple_application_server_instances.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_simple_application_server_instances.go new file mode 100644 index 00000000000..26a5bcef959 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_simple_application_server_instances.go @@ -0,0 +1,240 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudSimpleApplicationServerInstances() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudSimpleApplicationServerInstancesRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "payment_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Default: "Subscription", + ValidateFunc: validation.StringInSlice([]string{"Subscription"}, false), + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Disabled", "Pending", "Resetting", "Running", "Starting", "Stopped", "Stopping", "Upgrading"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "instances": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "business_status": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "ddos_status": { + Type: schema.TypeString, + Computed: true, + }, + "expired_time": { + Type: schema.TypeString, + Computed: true, + }, + "image_id": { + Type: schema.TypeString, + Computed: true, + }, + "inner_ip_address": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "instance_name": { + Type: schema.TypeString, + Computed: true, + }, + "payment_type": { + Type: schema.TypeString, + Computed: true, + }, + "plan_id": { + Type: schema.TypeString, + Computed: true, + }, + "public_ip_address": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudSimpleApplicationServerInstancesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListInstances" + request := make(map[string]interface{}) + if v, ok := d.GetOk("payment_type"); ok { + request["ChargeType"] = convertSimpleApplicationServerInstancePaymentTypeRequest(v) + } + request["RegionId"] = client.RegionId + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + var instanceNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + instanceNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewSwasClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_simple_application_server_instances", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Instances", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Instances", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if instanceNameRegex != nil && !instanceNameRegex.MatchString(fmt.Sprint(item["InstanceName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["InstanceId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["Status"].(string) { + continue + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "business_status": object["BusinessStatus"], + "create_time": object["CreationTime"], + "ddos_status": object["DdosStatus"], + "expired_time": object["ExpiredTime"], + "image_id": object["ImageId"], + "inner_ip_address": object["InnerIpAddress"], + "id": fmt.Sprint(object["InstanceId"]), + "instance_id": fmt.Sprint(object["InstanceId"]), + "instance_name": object["InstanceName"], + "payment_type": convertSimpleApplicationServerInstancePaymentTypeResponse(object["ChargeType"]), + "plan_id": object["PlanId"], + "public_ip_address": object["PublicIpAddress"], + "status": object["Status"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["InstanceName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("instances", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_simple_application_server_plans.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_simple_application_server_plans.go new file mode 100644 index 00000000000..bdd08c7a920 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_simple_application_server_plans.go @@ -0,0 +1,200 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func dataSourceAlicloudSimpleApplicationServerPlans() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudSimpleApplicationServerPlansRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "bandwidth": { + Type: schema.TypeInt, + Optional: true, + }, + "core": { + Type: schema.TypeInt, + Optional: true, + }, + "disk_size": { + Type: schema.TypeInt, + Optional: true, + }, + "flow": { + Type: schema.TypeInt, + Optional: true, + }, + "memory": { + Type: schema.TypeInt, + Optional: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "plans": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "bandwidth": { + Type: schema.TypeInt, + Computed: true, + }, + "core": { + Type: schema.TypeInt, + Computed: true, + }, + "disk_size": { + Type: schema.TypeInt, + Computed: true, + }, + "flow": { + Type: schema.TypeInt, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "plan_id": { + Type: schema.TypeString, + Computed: true, + }, + "memory": { + Type: schema.TypeInt, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudSimpleApplicationServerPlansRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListPlans" + request := make(map[string]interface{}) + request["RegionId"] = client.RegionId + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + + bandwidth, bandwidthOk := d.GetOk("bandwidth") + core, coreOk := d.GetOk("core") + diskSize, diskSizeOk := d.GetOk("disk_size") + memory, memoryOk := d.GetOk("memory") + flow, flowOk := d.GetOk("flow") + + var response map[string]interface{} + conn, err := client.NewSwasClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_simple_application_server_plans", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Plans", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Plans", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["PlanId"])]; !ok { + continue + } + } + + if bandwidthOk && bandwidth.(int) != 0 && bandwidth.(int) != formatInt(item["Bandwidth"]) { + continue + } + + if coreOk && core.(int) != 0 && core.(int) != formatInt(item["Core"]) { + continue + } + + if diskSizeOk && diskSize.(int) != 0 && diskSize.(int) != formatInt(item["DiskSize"]) { + continue + } + + if memoryOk && memory.(int) != 0 && memory.(int) != formatInt(item["Memory"]) { + continue + } + + if flowOk && flow.(int) != 0 && flow.(int) != formatInt(item["Flow"]) { + continue + } + + objects = append(objects, item) + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "bandwidth": formatInt(object["Bandwidth"]), + "core": formatInt(object["Core"]), + "disk_size": formatInt(object["DiskSize"]), + "flow": formatInt(object["Flow"]), + "id": fmt.Sprint(object["PlanId"]), + "plan_id": fmt.Sprint(object["PlanId"]), + "memory": formatInt(object["Memory"]), + } + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("plans", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_simple_application_server_snapshots.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_simple_application_server_snapshots.go new file mode 100644 index 00000000000..e9622af687b --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_simple_application_server_snapshots.go @@ -0,0 +1,226 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudSimpleApplicationServerSnapshots() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudSimpleApplicationServerSnapshotsRead, + Schema: map[string]*schema.Schema{ + "disk_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "instance_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Accomplished", "Failed", "Progressing"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "snapshots": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "disk_id": { + Type: schema.TypeString, + Computed: true, + }, + "progress": { + Type: schema.TypeString, + Computed: true, + }, + "remark": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "snapshot_id": { + Type: schema.TypeString, + Computed: true, + }, + "snapshot_name": { + Type: schema.TypeString, + Computed: true, + }, + "source_disk_type": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudSimpleApplicationServerSnapshotsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListSnapshots" + request := make(map[string]interface{}) + if v, ok := d.GetOk("disk_id"); ok { + request["DiskId"] = v + } + if v, ok := d.GetOk("instance_id"); ok { + request["InstanceId"] = v + } + request["RegionId"] = client.RegionId + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + var snapshotNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + snapshotNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewSwasClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_simple_application_server_snapshots", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Snapshots", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Snapshots", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if snapshotNameRegex != nil && !snapshotNameRegex.MatchString(fmt.Sprint(item["SnapshotName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["SnapshotId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["Status"].(string) { + continue + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "create_time": object["CreationTime"], + "disk_id": object["SourceDiskId"], + "progress": object["Progress"], + "remark": object["Remark"], + "id": fmt.Sprint(object["SnapshotId"]), + "snapshot_id": fmt.Sprint(object["SnapshotId"]), + "snapshot_name": object["SnapshotName"], + "source_disk_type": object["SourceDiskType"], + "status": object["Status"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["SnapshotName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("snapshots", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_slb_tls_cipher_policies.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_slb_tls_cipher_policies.go new file mode 100644 index 00000000000..90949353003 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_slb_tls_cipher_policies.go @@ -0,0 +1,252 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudSlbTlsCipherPolicies() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudSlbTlsCipherPoliciesRead, + Schema: map[string]*schema.Schema{ + "include_listener": { + Type: schema.TypeBool, + Optional: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"configuring", "normal"}, false), + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "tls_cipher_policy_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "policies": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "ciphers": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "relate_listeners": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "load_balancer_id": { + Type: schema.TypeString, + Computed: true, + }, + "port": { + Type: schema.TypeInt, + Computed: true, + }, + "protocol": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "tls_cipher_policy_id": { + Type: schema.TypeString, + Computed: true, + }, + "tls_cipher_policy_name": { + Type: schema.TypeString, + Computed: true, + }, + "tls_versions": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudSlbTlsCipherPoliciesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListTLSCipherPolicies" + request := make(map[string]interface{}) + if v, ok := d.GetOkExists("include_listener"); ok { + request["IncludeListener"] = v + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("tls_cipher_policy_name"); ok { + request["Name"] = v + } + var objects []map[string]interface{} + var tlsCipherPolicyNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + tlsCipherPolicyNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewSlbClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_slb_tls_cipher_policies", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.TLSCipherPolicies", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.TLSCipherPolicies", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if tlsCipherPolicyNameRegex != nil && !tlsCipherPolicyNameRegex.MatchString(fmt.Sprint(item["Name"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["InstanceId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["Status"].(string) { + continue + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "ciphers": object["Ciphers"], + "create_time": fmt.Sprint(object["CreateTime"]), + "status": object["Status"], + "id": fmt.Sprint(object["InstanceId"]), + "tls_cipher_policy_id": fmt.Sprint(object["InstanceId"]), + "tls_cipher_policy_name": object["Name"], + "tls_versions": object["TLSVersions"], + } + + relateListeners := make([]map[string]interface{}, 0) + if relateListenersList, ok := object["RelateListeners"].([]interface{}); ok { + for _, v := range relateListenersList { + if m1, ok := v.(map[string]interface{}); ok { + temp1 := map[string]interface{}{ + "load_balancer_id": m1["LoadBalancerId"], + "port": formatInt(m1["Port"]), + "protocol": m1["Protocol"], + } + relateListeners = append(relateListeners, temp1) + } + } + } + mapping["relate_listeners"] = relateListeners + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["Name"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("policies", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ssl_certificates_service_certificates.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ssl_certificates_service_certificates.go index 4eefaeb6927..7094583db87 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ssl_certificates_service_certificates.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_ssl_certificates_service_certificates.go @@ -70,7 +70,7 @@ func dataSourceAlicloudSslCertificatesServiceCertificates() *schema.Resource { }, "name": { Type: schema.TypeString, - Deprecated: "Field 'name' has been deprecated from provider version 1.129.0 and it will be remove in the future version. Please use the new attribute 'certificate_name' instead.", + Deprecated: "Field 'name' has been deprecated from provider version 1.129.0 and it will be removed in the future version. Please use the new attribute 'certificate_name' instead.", Computed: true, }, "city": { diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_video_surveillance_system_groups.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_video_surveillance_system_groups.go new file mode 100644 index 00000000000..10baf678ca0 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_video_surveillance_system_groups.go @@ -0,0 +1,282 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudVideoSurveillanceSystemGroups() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudVideoSurveillanceSystemGroupsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "in_protocol": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"gb28181", "rtmp"}, false), + }, + "name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"on", "off"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "groups": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "app": { + Type: schema.TypeString, + Computed: true, + }, + "callback": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "enabled": { + Type: schema.TypeBool, + Computed: true, + }, + "gb_id": { + Type: schema.TypeString, + Computed: true, + }, + "gb_ip": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "group_id": { + Type: schema.TypeString, + Computed: true, + }, + "group_name": { + Type: schema.TypeString, + Computed: true, + }, + "in_protocol": { + Type: schema.TypeString, + Computed: true, + }, + "out_protocol": { + Type: schema.TypeString, + Computed: true, + }, + "play_domain": { + Type: schema.TypeString, + Computed: true, + }, + "push_domain": { + Type: schema.TypeString, + Computed: true, + }, + "stats": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "device_num": { + Type: schema.TypeString, + Computed: true, + }, + "ied_num": { + Type: schema.TypeString, + Computed: true, + }, + "ipc_num": { + Type: schema.TypeString, + Computed: true, + }, + "platform_num": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudVideoSurveillanceSystemGroupsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeGroups" + request := make(map[string]interface{}) + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("in_protocol"); ok { + request["InProtocol"] = v + } + request["IncludeStats"] = true + if v, ok := d.GetOk("name"); ok { + request["Name"] = v + } + + if v, ok := d.GetOk("status"); ok { + request["Status"] = v + } + request["PageSize"] = PageSizeLarge + request["PageNum"] = 1 + var objects []map[string]interface{} + var nameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + nameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewVsClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-12-12"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_video_surveillance_system_groups", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Groups", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Groups", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if nameRegex != nil && !nameRegex.MatchString(fmt.Sprint(item["Name"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["Id"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNum"] = request["PageNum"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "app": object["App"], + "callback": object["Callback"], + "create_time": object["CreatedTime"], + "description": object["Description"], + "enabled": object["Enabled"], + "gb_id": object["GbId"], + "gb_ip": object["GbIp"], + "id": fmt.Sprint(object["Id"]), + "group_id": fmt.Sprint(object["Id"]), + "group_name": object["Name"], + "in_protocol": object["InProtocol"], + "out_protocol": object["OutProtocol"], + "play_domain": object["PlayDomain"], + "push_domain": object["PushDomain"], + "stats": []map[string]interface{}{ + { + "ipc_num": object["IpcNum"], + "device_num": object["DeviceNum"], + "ied_num": object["IedNum"], + "platform_num": object["PlatformNum"], + }}, + } + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + names = append(names, object["Name"]) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + if err := d.Set("groups", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vod_domains.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vod_domains.go new file mode 100644 index 00000000000..1224f3f208c --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vod_domains.go @@ -0,0 +1,273 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudVodDomains() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudVodDomainsRead, + Schema: map[string]*schema.Schema{ + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "domain_search_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Default: "fuzzy_match", + ValidateFunc: validation.StringInSlice([]string{"fuzzy_match", "pre_match", "suf_match", "full_match"}, false), + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"check_failed", "checking", "configure_failed", "configuring", "offline", "online"}, false), + }, + "tags": tagsSchema(), + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "domains": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "gmt_modified": { + Type: schema.TypeString, + Computed: true, + }, + "gmt_created": { + Type: schema.TypeString, + Computed: true, + }, + "cname": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "ssl_protocol": { + Type: schema.TypeString, + Computed: true, + }, + "domain_name": { + Type: schema.TypeString, + Computed: true, + }, + "sources": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "source_content": { + Type: schema.TypeString, + Computed: true, + }, + "source_port": { + Type: schema.TypeString, + Computed: true, + }, + "source_priority": { + Type: schema.TypeString, + Computed: true, + }, + "source_type": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "sand_box": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudVodDomainsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeVodUserDomains" + request := make(map[string]interface{}) + if v, ok := d.GetOk("domain_search_type"); ok { + request["DomainSearchType"] = v + } + if v, ok := d.GetOk("status"); ok { + request["DomainStatus"] = v + } + + if v, ok := d.GetOk("tags"); ok { + tags := make([]map[string]interface{}, 0) + for key, value := range v.(map[string]interface{}) { + tags = append(tags, map[string]interface{}{ + "Key": key, + "Value": value.(string), + }) + } + request["Tag"] = tags + } + + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + var domainNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + domainNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewVodClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-03-21"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_vod_domains", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Domains.PageData", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Domains.PageData", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if domainNameRegex != nil && !domainNameRegex.MatchString(fmt.Sprint(item["DomainName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["DomainName"])]; !ok { + continue + } + } + if statusOk && status != "" && status != item["DomainStatus"] { + continue + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "description": object["Description"], + "id": fmt.Sprint(object["DomainName"]), + "domain_name": fmt.Sprint(object["DomainName"]), + "gmt_modified": object["GmtModified"], + "ssl_protocol": object["SslProtocol"], + "gmt_created": object["GmtModified"], + "cname": object["Cname"], + "status": object["DomainStatus"], + "sand_box": object["Sandbox"], + } + if v, ok := object["Sources"].(map[string]interface{})["Source"].([]interface{}); ok { + source := make([]map[string]interface{}, 0) + for _, val := range v { + item := val.(map[string]interface{}) + temp := map[string]interface{}{ + "source_content": item["Content"], + "source_port": item["Port"], + "source_priority": item["Priority"], + "source_type": item["Type"], + } + source = append(source, temp) + } + mapping["sources"] = source + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["DomainName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("domains", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_bgp_groups.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_bgp_groups.go new file mode 100644 index 00000000000..9dc4289b2fc --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_bgp_groups.go @@ -0,0 +1,236 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudVpcBgpGroups() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudVpcBgpGroupsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "router_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Available", "Deleting", "Pending"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "groups": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "auth_key": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "bgp_group_name": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "hold": { + Type: schema.TypeString, + Computed: true, + }, + "ip_version": { + Type: schema.TypeString, + Computed: true, + }, + "is_fake_asn": { + Type: schema.TypeBool, + Computed: true, + }, + "keepalive": { + Type: schema.TypeString, + Computed: true, + }, + "local_asn": { + Type: schema.TypeInt, + Computed: true, + }, + "peer_asn": { + Type: schema.TypeInt, + Computed: true, + }, + "route_limit": { + Type: schema.TypeString, + Computed: true, + }, + "router_id": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudVpcBgpGroupsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeBgpGroups" + request := make(map[string]interface{}) + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("router_id"); ok { + request["RouterId"] = v + } + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + var bgpGroupNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + bgpGroupNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_vpc_bgp_groups", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.BgpGroups.BgpGroup", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.BgpGroups.BgpGroup", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if bgpGroupNameRegex != nil && !bgpGroupNameRegex.MatchString(fmt.Sprint(item["Name"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["BgpGroupId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["Status"].(string) { + continue + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "auth_key": object["AuthKey"], + "id": fmt.Sprint(object["BgpGroupId"]), + "bgp_group_name": object["Name"], + "description": object["Description"], + "hold": object["Hold"], + "ip_version": object["IpVersion"], + "is_fake_asn": object["IsFake"], + "keepalive": object["Keepalive"], + "local_asn": formatInt(object["LocalAsn"]), + "peer_asn": formatInt(object["PeerAsn"]), + "route_limit": object["RouteLimit"], + "router_id": object["RouterId"], + "status": object["Status"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["Name"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + if err := d.Set("groups", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_bgp_networks.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_bgp_networks.go new file mode 100644 index 00000000000..360a5293458 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_bgp_networks.go @@ -0,0 +1,164 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudVpcBgpNetworks() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudVpcBgpNetworksRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "router_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Available", "Pending", "Deleting"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "networks": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, + "dst_cidr_block": { + Type: schema.TypeString, + Computed: true, + }, + "router_id": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudVpcBgpNetworksRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeBgpNetworks" + request := make(map[string]interface{}) + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("router_id"); ok { + request["RouterId"] = v + } + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_vpc_bgp_networks", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.BgpNetworks.BgpNetwork", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.BgpNetworks.BgpNetwork", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["RouterId"], ":", item["DstCidrBlock"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["Status"].(string) { + continue + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "id": fmt.Sprint(object["RouterId"], ":", object["DstCidrBlock"]), + "dst_cidr_block": fmt.Sprint(object["DstCidrBlock"]), + "router_id": object["RouterId"], + "status": object["Status"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("networks", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_bgp_peers.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_bgp_peers.go new file mode 100644 index 00000000000..104fe540f9d --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_bgp_peers.go @@ -0,0 +1,245 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudVpcBgpPeers() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudVpcBgpPeersRead, + Schema: map[string]*schema.Schema{ + "bgp_group_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "router_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Available", "Deleted", "Deleting", "Modifying", "Pending"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "peers": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "auth_key": { + Type: schema.TypeString, + Computed: true, + }, + "bfd_multi_hop": { + Type: schema.TypeInt, + Computed: true, + }, + "bgp_group_id": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "bgp_peer_id": { + Type: schema.TypeString, + Computed: true, + }, + "bgp_peer_name": { + Type: schema.TypeString, + Computed: true, + }, + "bgp_status": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "enable_bfd": { + Type: schema.TypeBool, + Computed: true, + }, + "hold": { + Type: schema.TypeString, + Computed: true, + }, + "ip_version": { + Type: schema.TypeString, + Computed: true, + }, + "is_fake": { + Type: schema.TypeBool, + Computed: true, + }, + "keepalive": { + Type: schema.TypeString, + Computed: true, + }, + "local_asn": { + Type: schema.TypeString, + Computed: true, + }, + "peer_asn": { + Type: schema.TypeString, + Computed: true, + }, + "peer_ip_address": { + Type: schema.TypeString, + Computed: true, + }, + "route_limit": { + Type: schema.TypeString, + Computed: true, + }, + "router_id": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudVpcBgpPeersRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeBgpPeers" + request := make(map[string]interface{}) + if v, ok := d.GetOk("bgp_group_id"); ok { + request["BgpGroupId"] = v + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("router_id"); ok { + request["RouterId"] = v + } + request["PageSize"] = PageSizeMedium + request["PageNumber"] = 1 + var objects []map[string]interface{} + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_vpc_bgp_peers", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.BgpPeers.BgpPeer", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.BgpPeers.BgpPeer", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["BgpPeerId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["Status"].(string) { + continue + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "auth_key": object["AuthKey"], + "bfd_multi_hop": formatInt(object["BfdMultiHop"]), + "bgp_group_id": object["BgpGroupId"], + "id": fmt.Sprint(object["BgpPeerId"]), + "bgp_peer_id": fmt.Sprint(object["BgpPeerId"]), + "bgp_peer_name": object["Name"], + "bgp_status": object["BgpStatus"], + "description": object["Description"], + "enable_bfd": object["EnableBfd"], + "hold": object["Hold"], + "ip_version": object["IpVersion"], + "is_fake": object["IsFake"], + "keepalive": object["Keepalive"], + "local_asn": object["LocalAsn"], + "peer_asn": object["PeerAsn"], + "peer_ip_address": object["PeerIpAddress"], + "route_limit": object["RouteLimit"], + "router_id": object["RouterId"], + "status": object["Status"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + if err := d.Set("peers", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_dhcp_options_sets.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_dhcp_options_sets.go new file mode 100644 index 00000000000..f170e4a8492 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_dhcp_options_sets.go @@ -0,0 +1,237 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudVpcDhcpOptionsSets() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudVpcDhcpOptionsSetsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "dhcp_options_set_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "domain_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Available", "InUse", "Pending"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "sets": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "associate_vpcs": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "associate_status": { + Type: schema.TypeString, + Computed: true, + }, + "vpc_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "dhcp_options_set_description": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "dhcp_options_set_id": { + Type: schema.TypeString, + Computed: true, + }, + "dhcp_options_set_name": { + Type: schema.TypeString, + Computed: true, + }, + "domain_name": { + Type: schema.TypeString, + Computed: true, + }, + "domain_name_servers": { + Type: schema.TypeString, + Computed: true, + }, + "owner_id": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudVpcDhcpOptionsSetsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListDhcpOptionsSets" + request := make(map[string]interface{}) + if v, ok := d.GetOk("dhcp_options_set_name"); ok { + request["DhcpOptionsSetName"] = v + } + if v, ok := d.GetOk("domain_name"); ok { + request["DomainName"] = v + } + request["RegionId"] = client.RegionId + request["MaxResults"] = PageSizeLarge + var objects []map[string]interface{} + var dhcpOptionsSetNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + dhcpOptionsSetNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_vpc_dhcp_options_sets", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.DhcpOptionsSets", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.DhcpOptionsSets", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if dhcpOptionsSetNameRegex != nil && !dhcpOptionsSetNameRegex.MatchString(fmt.Sprint(item["DhcpOptionsSetName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["DhcpOptionsSetId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["Status"].(string) { + continue + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "dhcp_options_set_description": object["DhcpOptionsSetDescription"], + "id": fmt.Sprint(object["DhcpOptionsSetId"]), + "dhcp_options_set_id": fmt.Sprint(object["DhcpOptionsSetId"]), + "dhcp_options_set_name": object["DhcpOptionsSetName"], + "domain_name": object["DhcpOptions"].(map[string]interface{})["DomainName"], + "domain_name_servers": object["DhcpOptions"].(map[string]interface{})["DomainNameServers"], + "owner_id": fmt.Sprint(object["OwnerId"]), + "status": object["Status"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["DhcpOptionsSetName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("sets", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_ipv6_addresses.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_ipv6_addresses.go new file mode 100644 index 00000000000..dfa9b695e6d --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_ipv6_addresses.go @@ -0,0 +1,217 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudVpcIpv6Addresses() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudVpcIpv6AddressesRead, + Schema: map[string]*schema.Schema{ + "associated_instance_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Available", "Pending"}, false), + }, + "vswitch_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "vpc_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "addresses": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "associated_instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "associated_instance_type": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "ipv6_address": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "ipv6_address_id": { + Type: schema.TypeString, + Computed: true, + }, + "ipv6_address_name": { + Type: schema.TypeString, + Computed: true, + }, + "ipv6_gateway_id": { + Type: schema.TypeString, + Computed: true, + }, + "network_type": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "vswitch_id": { + Type: schema.TypeString, + Computed: true, + }, + "vpc_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudVpcIpv6AddressesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeIpv6Addresses" + request := make(map[string]interface{}) + if v, ok := d.GetOk("associated_instance_id"); ok { + request["AssociatedInstanceId"] = v + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("vswitch_id"); ok { + request["VSwitchId"] = v + } + if v, ok := d.GetOk("vpc_id"); ok { + request["VpcId"] = v + } + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_vpc_ipv6_addresses", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Ipv6Addresses.Ipv6Address", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Ipv6Addresses.Ipv6Address", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if statusOk && status.(string) != "" && status.(string) != item["Status"].(string) { + continue + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "associated_instance_id": object["AssociatedInstanceId"], + "associated_instance_type": object["AssociatedInstanceType"], + "ipv6_address": object["Ipv6Address"], + "id": fmt.Sprint(object["Ipv6AddressId"]), + "ipv6_address_id": fmt.Sprint(object["Ipv6AddressId"]), + "ipv6_address_name": object["Ipv6AddressName"], + "ipv6_gateway_id": object["Ipv6GatewayId"], + "network_type": object["NetworkType"], + "status": object["Status"], + "vswitch_id": object["VSwitchId"], + "vpc_id": object["VpcId"], + "create_time": object["AllocationTime"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["Ipv6AddressName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("addresses", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_ipv6_egress_rules.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_ipv6_egress_rules.go new file mode 100644 index 00000000000..2f311162666 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_ipv6_egress_rules.go @@ -0,0 +1,227 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudVpcIpv6EgressRules() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudVpcIpv6EgressRulesRead, + Schema: map[string]*schema.Schema{ + "instance_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "ipv6_egress_rule_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "ipv6_gateway_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Available", "Deleting", "Pending"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "rules": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "description": { + Type: schema.TypeString, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "instance_type": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "ipv6_egress_rule_id": { + Type: schema.TypeString, + Computed: true, + }, + "ipv6_egress_rule_name": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "ipv6_gateway_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudVpcIpv6EgressRulesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeIpv6EgressOnlyRules" + request := make(map[string]interface{}) + if v, ok := d.GetOk("instance_id"); ok { + request["InstanceId"] = v + } + if v, ok := d.GetOk("ipv6_egress_rule_name"); ok { + request["Name"] = v + } + request["Ipv6GatewayId"] = d.Get("ipv6_gateway_id") + request["RegionId"] = client.RegionId + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + var ipv6EgressRuleNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + ipv6EgressRuleNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_vpc_ipv6_egress_rules", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Ipv6EgressOnlyRules.Ipv6EgressOnlyRule", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Ipv6EgressOnlyRules.Ipv6EgressOnlyRule", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if ipv6EgressRuleNameRegex != nil && !ipv6EgressRuleNameRegex.MatchString(fmt.Sprint(item["Name"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(request["Ipv6GatewayId"], ":", item["Ipv6EgressOnlyRuleId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["Status"].(string) { + continue + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "description": object["Description"], + "instance_id": object["InstanceId"], + "instance_type": object["InstanceType"], + "id": fmt.Sprint(request["Ipv6GatewayId"], ":", object["Ipv6EgressOnlyRuleId"]), + "ipv6_egress_rule_id": fmt.Sprint(object["Ipv6EgressOnlyRuleId"]), + "ipv6_egress_rule_name": object["Name"], + "status": object["Status"], + "ipv6_gateway_id": request["Ipv6GatewayId"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["Name"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("rules", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_ipv6_gateways.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_ipv6_gateways.go new file mode 100644 index 00000000000..bc986be1e69 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_ipv6_gateways.go @@ -0,0 +1,244 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudVpcIpv6Gateways() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudVpcIpv6GatewaysRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "ipv6_gateway_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Available", "Deleting", "Pending"}, false), + }, + "vpc_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "gateways": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "business_status": { + Type: schema.TypeString, + Computed: true, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "expired_time": { + Type: schema.TypeString, + Computed: true, + }, + "instance_charge_type": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "ipv6_gateway_id": { + Type: schema.TypeString, + Computed: true, + }, + "ipv6_gateway_name": { + Type: schema.TypeString, + Computed: true, + }, + "spec": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "vpc_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudVpcIpv6GatewaysRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeIpv6Gateways" + request := make(map[string]interface{}) + if v, ok := d.GetOk("ipv6_gateway_name"); ok { + request["Name"] = v + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("vpc_id"); ok { + request["VpcId"] = v + } + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + var ipv6GatewayNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + ipv6GatewayNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_vpc_ipv6_gateways", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Ipv6Gateways.Ipv6Gateway", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Ipv6Gateways.Ipv6Gateway", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if ipv6GatewayNameRegex != nil && !ipv6GatewayNameRegex.MatchString(fmt.Sprint(item["Name"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["Ipv6GatewayId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["Status"].(string) { + continue + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "business_status": object["BusinessStatus"], + "create_time": object["CreationTime"], + "description": object["Description"], + "expired_time": object["ExpiredTime"], + "instance_charge_type": convertVpcIpv6GatewayInstanceChargeTypeResponse(object["InstanceChargeType"].(string)), + "id": fmt.Sprint(object["Ipv6GatewayId"]), + "ipv6_gateway_id": fmt.Sprint(object["Ipv6GatewayId"]), + "ipv6_gateway_name": object["Name"], + "spec": object["Spec"], + "status": object["Status"], + "vpc_id": object["VpcId"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["Name"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("gateways", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} + +func convertVpcIpv6GatewayInstanceChargeTypeResponse(source string) string { + switch source { + case "PostPaid": + return "PayAsYouGo" + } + return source +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_ipv6_internet_bandwidths.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_ipv6_internet_bandwidths.go new file mode 100644 index 00000000000..58660453940 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_ipv6_internet_bandwidths.go @@ -0,0 +1,215 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudVpcIpv6InternetBandwidths() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudVpcIpv6InternetBandwidthsRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "ipv6_internet_bandwidth_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "ipv6_address_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"FinacialLocked", "Normal", "SecurityLocked"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "bandwidths": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "bandwidth": { + Type: schema.TypeInt, + Computed: true, + }, + "internet_charge_type": { + Type: schema.TypeString, + Computed: true, + }, + "ipv6_address_id": { + Type: schema.TypeString, + Computed: true, + }, + "ipv6_gateway_id": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "ipv6_internet_bandwidth_id": { + Type: schema.TypeString, + Computed: true, + }, + "payment_type": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudVpcIpv6InternetBandwidthsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeIpv6Addresses" + request := make(map[string]interface{}) + if v, ok := d.GetOk("ipv6_internet_bandwidth_id"); ok { + request["Ipv6InternetBandwidthId"] = v + } + if v, ok := d.GetOk("ipv6_address_id"); ok { + request["Ipv6AddressId"] = v + } + request["RegionId"] = client.RegionId + request["PageSize"] = PageSizeLarge + request["PageNumber"] = 1 + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_vpc_ipv6_internet_bandwidths", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Ipv6Addresses.Ipv6Address", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Ipv6Addresses.Ipv6Address", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["Ipv6InternetBandwidth"].(map[string]interface{})["Ipv6InternetBandwidthId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["Ipv6InternetBandwidth"].(map[string]interface{})["BusinessStatus"].(string) { + continue + } + objects = append(objects, item) + } + if len(result) < PageSizeLarge { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "ipv6_address_id": object["Ipv6AddressId"], + "ipv6_gateway_id": object["Ipv6GatewayId"], + } + if ipv6InternetBandwidth, ok := object["Ipv6InternetBandwidth"]; ok { + if v, ok := ipv6InternetBandwidth.(map[string]interface{}); ok { + if v, ok := v["Bandwidth"]; ok { + mapping["bandwidth"] = formatInt(v) + } + if v, ok := v["BusinessStatus"]; ok { + mapping["status"] = v + } + if v, ok := v["InstanceChargeType"]; ok { + mapping["payment_type"] = convertVpcIpv6InternetBandwidthInstanceChargeTypeResponse(v.(string)) + } + if v, ok := v["InternetChargeType"]; ok { + mapping["internet_charge_type"] = v + } + if v, ok := v["Ipv6InternetBandwidthId"]; ok { + mapping["ipv6_internet_bandwidth_id"] = fmt.Sprint(v) + mapping["id"] = fmt.Sprint(v) + } + } + } + + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("bandwidths", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} + +func convertVpcIpv6InternetBandwidthInstanceChargeTypeResponse(source string) string { + switch source { + case "PostPaid": + return "PayAsYouGo" + } + return source +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_nat_ip_cidrs.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_nat_ip_cidrs.go new file mode 100644 index 00000000000..bd30918125d --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_nat_ip_cidrs.go @@ -0,0 +1,233 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudVpcNatIpCidrs() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudVpcNatIpCidrsRead, + Schema: map[string]*schema.Schema{ + "nat_gateway_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "nat_ip_cidr_name": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "nat_ip_cidrs": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Available"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "cidrs": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "is_default": { + Type: schema.TypeBool, + Computed: true, + }, + "nat_gateway_id": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "nat_ip_cidr": { + Type: schema.TypeString, + Computed: true, + }, + "nat_ip_cidr_description": { + Type: schema.TypeString, + Computed: true, + }, + "nat_ip_cidr_id": { + Type: schema.TypeString, + Computed: true, + }, + "nat_ip_cidr_name": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudVpcNatIpCidrsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListNatIpCidrs" + request := make(map[string]interface{}) + request["NatGatewayId"] = d.Get("nat_gateway_id") + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("nat_ip_cidrs"); ok { + request["NatIpCidrs"] = v + } + if v, ok := d.GetOk("nat_ip_cidr_name"); ok { + request["NatIpCidrName"] = v + } + if v, ok := d.GetOk("status"); ok { + request["NatIpCidrStatus"] = v + } + request["MaxResults"] = PageSizeLarge + var objects []map[string]interface{} + var natIpCidrNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + natIpCidrNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + request["ClientToken"] = buildClientToken("ListNatIpCidrs") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_vpc_nat_ip_cidrs", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.NatIpCidrs", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.NatIpCidrs", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if natIpCidrNameRegex != nil && !natIpCidrNameRegex.MatchString(fmt.Sprint(item["NatIpCidrName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprintf("%s:%s", item["NatGatewayId"], item["NatIpCidr"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "create_time": object["CreationTime"], + "is_default": object["IsDefault"], + "nat_gateway_id": object["NatGatewayId"], + "id": fmt.Sprintf("%s:%s", object["NatGatewayId"], object["NatIpCidr"]), + "nat_ip_cidr": fmt.Sprint(object["NatIpCidr"]), + "nat_ip_cidr_description": object["NatIpCidrDescription"], + "nat_ip_cidr_id": object["NatIpCidrId"], + "status": object["NatIpCidrStatus"], + "nat_ip_cidr_name": object["NatIpCidrName"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, mapping["nat_ip_cidr_name"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("cidrs", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_nat_ips.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_nat_ips.go new file mode 100644 index 00000000000..7db3634c115 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_nat_ips.go @@ -0,0 +1,243 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudVpcNatIps() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudVpcNatIpsRead, + Schema: map[string]*schema.Schema{ + "nat_gateway_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "nat_ip_cidr": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "nat_ip_name": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "nat_ip_ids": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Available", "Creating", "Deleting"}, false), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "ips": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "is_default": { + Type: schema.TypeBool, + Computed: true, + }, + "nat_gateway_id": { + Type: schema.TypeString, + Computed: true, + }, + "nat_ip": { + Type: schema.TypeString, + Computed: true, + }, + "nat_ip_cidr": { + Type: schema.TypeString, + Computed: true, + }, + "nat_ip_description": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "nat_ip_id": { + Type: schema.TypeString, + Computed: true, + }, + "nat_ip_name": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudVpcNatIpsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListNatIps" + request := make(map[string]interface{}) + request["NatGatewayId"] = d.Get("nat_gateway_id") + if v, ok := d.GetOk("nat_ip_cidr"); ok { + request["NatIpCidr"] = v + } + if v, ok := d.GetOk("nat_ip_name"); ok { + request["NatIpName"] = v + } + if v, ok := d.GetOk("nat_ip_ids"); ok { + request["NatIpIds"] = v + } + if v, ok := d.GetOk("status"); ok { + request["NatIpStatus"] = v + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("status"); ok { + request["NatIpStatus"] = v + } + request["MaxResults"] = PageSizeLarge + var objects []map[string]interface{} + var natIpNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + natIpNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + request["ClientToken"] = buildClientToken("ListNatIps") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_vpc_nat_ips", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.NatIps", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.NatIps", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if natIpNameRegex != nil && !natIpNameRegex.MatchString(fmt.Sprint(item["NatIpName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprintf("%s:%s", item["NatGatewayId"], item["NatIpId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "is_default": object["IsDefault"], + "nat_gateway_id": object["NatGatewayId"], + "nat_ip": object["NatIp"], + "nat_ip_cidr": object["NatIpCidr"], + "nat_ip_description": object["NatIpDescription"], + "id": fmt.Sprintf("%s:%s", object["NatGatewayId"], object["NatIpId"]), + "nat_ip_id": fmt.Sprint(object["NatIpId"]), + "nat_ip_name": object["NatIpName"], + "status": object["NatIpStatus"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["NatIpName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("ips", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_traffic_mirror_filter_egress_rules.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_traffic_mirror_filter_egress_rules.go new file mode 100644 index 00000000000..5fa941a9718 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_traffic_mirror_filter_egress_rules.go @@ -0,0 +1,197 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudVpcTrafficMirrorFilterEgressRules() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudVpcTrafficMirrorFilterEgressRulesRead, + Schema: map[string]*schema.Schema{ + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Created", "Creating", "Deleting", "Modifying"}, false), + }, + "traffic_mirror_filter_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "rules": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "destination_cidr_block": { + Type: schema.TypeString, + Computed: true, + }, + "destination_port_range": { + Type: schema.TypeString, + Computed: true, + }, + "priority": { + Type: schema.TypeInt, + Computed: true, + }, + "rule_action": { + Type: schema.TypeString, + Computed: true, + }, + "protocol": { + Type: schema.TypeString, + Computed: true, + }, + "source_cidr_block": { + Type: schema.TypeString, + Computed: true, + }, + "source_port_range": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "traffic_mirror_filter_id": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "traffic_mirror_filter_rule_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudVpcTrafficMirrorFilterEgressRulesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListTrafficMirrorFilters" + request := make(map[string]interface{}) + request["RegionId"] = client.RegionId + request["TrafficMirrorFilterIds"] = []string{fmt.Sprint(d.Get("traffic_mirror_filter_id"))} + request["MaxResults"] = PageSizeSmall + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_vpc_traffic_mirror_filter_egress_rules", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.TrafficMirrorFilters", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.TrafficMirrorFilters", response) + } + result, _ := resp.([]interface{}) + + for _, v := range result { + EgressRules := v.(map[string]interface{})["EgressRules"] + if EgressRulesMap, ok := EgressRules.([]interface{}); ok { + for _, v := range EgressRulesMap { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["TrafficMirrorFilterId"], ":", item["TrafficMirrorFilterRuleId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["TrafficMirrorFilterRuleStatus"].(string) { + continue + } + objects = append(objects, item) + } + } + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "destination_cidr_block": object["DestinationCidrBlock"], + "destination_port_range": object["DestinationPortRange"], + "priority": object["Priority"], + "rule_action": object["Action"], + "protocol": object["Protocol"], + "source_cidr_block": object["SourceCidrBlock"], + "source_port_range": object["SourcePortRange"], + "status": object["TrafficMirrorFilterRuleStatus"], + "traffic_mirror_filter_id": object["TrafficMirrorFilterId"], + "id": fmt.Sprint(object["TrafficMirrorFilterId"], ":", object["TrafficMirrorFilterRuleId"]), + "traffic_mirror_filter_rule_id": fmt.Sprint(object["TrafficMirrorFilterRuleId"]), + } + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("rules", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_traffic_mirror_filter_ingress_rules.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_traffic_mirror_filter_ingress_rules.go new file mode 100644 index 00000000000..4cde634eacd --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_traffic_mirror_filter_ingress_rules.go @@ -0,0 +1,196 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudVpcTrafficMirrorFilterIngressRules() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudVpcTrafficMirrorFilterIngressRulesRead, + Schema: map[string]*schema.Schema{ + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Created", "Creating", "Deleting", "Modifying"}, false), + }, + "traffic_mirror_filter_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "rules": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "destination_cidr_block": { + Type: schema.TypeString, + Computed: true, + }, + "destination_port_range": { + Type: schema.TypeString, + Computed: true, + }, + "priority": { + Type: schema.TypeInt, + Computed: true, + }, + "rule_action": { + Type: schema.TypeString, + Computed: true, + }, + "protocol": { + Type: schema.TypeString, + Computed: true, + }, + "source_cidr_block": { + Type: schema.TypeString, + Computed: true, + }, + "source_port_range": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "traffic_mirror_filter_id": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "traffic_mirror_filter_rule_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudVpcTrafficMirrorFilterIngressRulesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListTrafficMirrorFilters" + request := make(map[string]interface{}) + request["RegionId"] = client.RegionId + request["TrafficMirrorFilterIds"] = []string{fmt.Sprint(d.Get("traffic_mirror_filter_id"))} + request["MaxResults"] = PageSizeSmall + var objects []map[string]interface{} + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_vpc_traffic_mirror_filter_ingress_rules", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.TrafficMirrorFilters", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.TrafficMirrorFilters", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + EgressRules := v.(map[string]interface{})["IngressRules"] + if EgressRulesMap, ok := EgressRules.([]interface{}); ok { + for _, v := range EgressRulesMap { + item := v.(map[string]interface{}) + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["TrafficMirrorFilterId"], ":", item["TrafficMirrorFilterRuleId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["TrafficMirrorFilterRuleStatus"].(string) { + continue + } + objects = append(objects, item) + } + } + } + ids := make([]string, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "destination_cidr_block": object["DestinationCidrBlock"], + "destination_port_range": object["DestinationPortRange"], + "priority": formatInt(object["Priority"]), + "rule_action": object["Action"], + "protocol": object["Protocol"], + "source_cidr_block": object["SourceCidrBlock"], + "source_port_range": object["SourcePortRange"], + "status": object["TrafficMirrorFilterRuleStatus"], + "traffic_mirror_filter_id": object["TrafficMirrorFilterId"], + "id": fmt.Sprint(object["TrafficMirrorFilterId"], ":", object["TrafficMirrorFilterRuleId"]), + "traffic_mirror_filter_rule_id": fmt.Sprint(object["TrafficMirrorFilterRuleId"]), + } + ids = append(ids, fmt.Sprint(mapping["id"])) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("rules", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_traffic_mirror_filters.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_traffic_mirror_filters.go new file mode 100644 index 00000000000..35e8ce371e1 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_traffic_mirror_filters.go @@ -0,0 +1,199 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudVpcTrafficMirrorFilters() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudVpcTrafficMirrorFiltersRead, + Schema: map[string]*schema.Schema{ + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Created", "Creating", "Deleting", "Modifying"}, false), + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "traffic_mirror_filter_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(2, 128), + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "filters": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "status": { + Type: schema.TypeString, + Computed: true, + }, + "traffic_mirror_filter_description": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "traffic_mirror_filter_id": { + Type: schema.TypeString, + Computed: true, + }, + "traffic_mirror_filter_name": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudVpcTrafficMirrorFiltersRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListTrafficMirrorFilters" + request := make(map[string]interface{}) + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("traffic_mirror_filter_name"); ok { + request["TrafficMirrorFilterName"] = v + } + request["MaxResults"] = PageSizeLarge + var objects []map[string]interface{} + var trafficMirrorFilterNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + trafficMirrorFilterNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_vpc_traffic_mirror_filters", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.TrafficMirrorFilters", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.TrafficMirrorFilters", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if trafficMirrorFilterNameRegex != nil && !trafficMirrorFilterNameRegex.MatchString(fmt.Sprint(item["TrafficMirrorFilterName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["TrafficMirrorFilterId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["TrafficMirrorFilterStatus"].(string) { + continue + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "status": object["TrafficMirrorFilterStatus"], + "traffic_mirror_filter_description": object["TrafficMirrorFilterDescription"], + "id": fmt.Sprint(object["TrafficMirrorFilterId"]), + "traffic_mirror_filter_id": fmt.Sprint(object["TrafficMirrorFilterId"]), + "traffic_mirror_filter_name": object["TrafficMirrorFilterName"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["TrafficMirrorFilterName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("filters", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_traffic_mirror_service.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_traffic_mirror_service.go new file mode 100644 index 00000000000..60e4ab3a813 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_traffic_mirror_service.go @@ -0,0 +1,101 @@ +package alicloud + +import ( + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudVpcTrafficMirrorService() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudVpcTrafficMirrorServiceRead, + Schema: map[string]*schema.Schema{ + "enable": { + Type: schema.TypeString, + ValidateFunc: validation.StringInSlice([]string{"On", "Off"}, false), + Optional: true, + Default: "Off", + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} +func dataSourceAlicloudVpcTrafficMirrorServiceRead(d *schema.ResourceData, meta interface{}) error { + if v, ok := d.GetOk("enable"); !ok || v.(string) != "On" { + d.SetId("VpcTrafficMirrorServiceHasNotBeenOpened") + d.Set("status", "") + return nil + } + + client := meta.(*connectivity.AliyunClient) + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + + var response map[string]interface{} + request := map[string]interface{}{} + + action := "GetTrafficMirrorServiceStatus" + request["ClientToken"] = buildClientToken(action) + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(3*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_vpc_traffic_mirror_service", action, AlibabaCloudSdkGoERROR) + } + + if v, ok := response["Enabled"]; ok && v.(bool) { + d.SetId("VpcTrafficMirrorServiceHasBeenOpened") + d.Set("status", "Opened") + return nil + } + + action = "OpenTrafficMirrorService" + request["ClientToken"] = buildClientToken(action) + err = resource.Retry(3*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"ORDER.OPEND"}) { + d.SetId("VpcTrafficMirrorServiceHasBeenOpened") + d.Set("status", "Opened") + return nil + } + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_vpc_traffic_mirror_service", action, AlibabaCloudSdkGoERROR) + } + + d.SetId("VpcTrafficMirrorServiceHasBeenOpened") + d.Set("status", "Opened") + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_traffic_mirror_sessions.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_traffic_mirror_sessions.go new file mode 100644 index 00000000000..bc46e936fc1 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_vpc_traffic_mirror_sessions.go @@ -0,0 +1,284 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudVpcTrafficMirrorSessions() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudVpcTrafficMirrorSessionsRead, + Schema: map[string]*schema.Schema{ + "enabled": { + Type: schema.TypeBool, + Optional: true, + ForceNew: true, + }, + "priority": { + Type: schema.TypeInt, + Optional: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Created", "Creating", "Deleting", "Modifying"}, false), + }, + "traffic_mirror_filter_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "traffic_mirror_session_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "traffic_mirror_source_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "traffic_mirror_target_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "sessions": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "enabled": { + Type: schema.TypeBool, + Computed: true, + }, + "packet_length": { + Type: schema.TypeInt, + Computed: true, + }, + "priority": { + Type: schema.TypeInt, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "traffic_mirror_filter_id": { + Type: schema.TypeString, + Computed: true, + }, + "traffic_mirror_session_business_status": { + Type: schema.TypeString, + Computed: true, + }, + "traffic_mirror_session_description": { + Type: schema.TypeString, + Computed: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + "traffic_mirror_session_id": { + Type: schema.TypeString, + Computed: true, + }, + "traffic_mirror_session_name": { + Type: schema.TypeString, + Computed: true, + }, + "traffic_mirror_source_ids": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "traffic_mirror_target_id": { + Type: schema.TypeString, + Computed: true, + }, + "traffic_mirror_target_type": { + Type: schema.TypeString, + Computed: true, + }, + "virtual_network_id": { + Type: schema.TypeInt, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudVpcTrafficMirrorSessionsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "ListTrafficMirrorSessions" + request := make(map[string]interface{}) + if v, ok := d.GetOk("enabled"); ok { + request["Enabled"] = v + } + if v, ok := d.GetOk("priority"); ok { + request["Priority"] = v + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("traffic_mirror_filter_id"); ok { + request["TrafficMirrorFilterId"] = v + } + if v, ok := d.GetOk("traffic_mirror_session_name"); ok { + request["TrafficMirrorSessionName"] = v + } + if v, ok := d.GetOk("traffic_mirror_source_id"); ok { + request["TrafficMirrorSourceId"] = v + } + if v, ok := d.GetOk("traffic_mirror_target_id"); ok { + request["TrafficMirrorTargetId"] = v + } + request["MaxResults"] = PageSizeLarge + var objects []map[string]interface{} + var trafficMirrorSessionNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + trafficMirrorSessionNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + idsMap[vv.(string)] = vv.(string) + } + } + status, statusOk := d.GetOk("status") + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_vpc_traffic_mirror_sessions", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.TrafficMirrorSessions", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.TrafficMirrorSessions", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if trafficMirrorSessionNameRegex != nil && !trafficMirrorSessionNameRegex.MatchString(fmt.Sprint(item["TrafficMirrorSessionName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["TrafficMirrorSessionId"])]; !ok { + continue + } + } + if statusOk && status.(string) != "" && status.(string) != item["TrafficMirrorSessionStatus"].(string) { + continue + } + objects = append(objects, item) + } + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "enabled": object["Enabled"], + "packet_length": formatInt(object["PacketLength"]), + "priority": formatInt(object["Priority"]), + "status": object["TrafficMirrorSessionStatus"], + "traffic_mirror_filter_id": object["TrafficMirrorFilterId"], + "traffic_mirror_session_business_status": object["TrafficMirrorSessionBusinessStatus"], + "traffic_mirror_session_description": object["TrafficMirrorSessionDescription"], + "id": fmt.Sprint(object["TrafficMirrorSessionId"]), + "traffic_mirror_session_id": fmt.Sprint(object["TrafficMirrorSessionId"]), + "traffic_mirror_session_name": object["TrafficMirrorSessionName"], + "traffic_mirror_source_ids": object["TrafficMirrorSourceIds"], + "traffic_mirror_target_id": object["TrafficMirrorTargetId"], + "traffic_mirror_target_type": object["TrafficMirrorTargetType"], + "virtual_network_id": formatInt(object["VirtualNetworkId"]), + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["TrafficMirrorSessionName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("sessions", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_waf_certificates.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_waf_certificates.go new file mode 100644 index 00000000000..d6592923a71 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_waf_certificates.go @@ -0,0 +1,205 @@ +package alicloud + +import ( + "fmt" + "regexp" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func dataSourceAlicloudWafCertificates() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAlicloudWafCertificatesRead, + Schema: map[string]*schema.Schema{ + "ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.ValidateRegexp, + ForceNew: true, + }, + "names": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "domain": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "certificates": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, + "certificate_id": { + Type: schema.TypeString, + Computed: true, + }, + "certificate_name": { + Type: schema.TypeString, + Computed: true, + }, + "common_name": { + Type: schema.TypeString, + Computed: true, + }, + "domain": { + Type: schema.TypeString, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "is_using": { + Type: schema.TypeBool, + Computed: true, + }, + "sans": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + }, + }, + } +} + +func dataSourceAlicloudWafCertificatesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + action := "DescribeCertificates" + request := make(map[string]interface{}) + if v, ok := d.GetOk("domain"); ok { + request["Domain"] = v + } + request["InstanceId"] = d.Get("instance_id") + var objects []map[string]interface{} + var certificateNameRegex *regexp.Regexp + if v, ok := d.GetOk("name_regex"); ok { + r, err := regexp.Compile(v.(string)) + if err != nil { + return WrapError(err) + } + certificateNameRegex = r + } + + idsMap := make(map[string]string) + if v, ok := d.GetOk("ids"); ok { + for _, vv := range v.([]interface{}) { + if vv == nil { + continue + } + parts, err := ParseResourceId(vv.(string), 3) + if err != nil { + return WrapError(err) + } + idsMap[parts[2]] = parts[2] + } + } + var response map[string]interface{} + conn, err := client.NewWafClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-10"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_waf_certificates", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.Certificates", response) + if err != nil { + return WrapErrorf(err, FailedGetAttributeMsg, action, "$.Certificates", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + if certificateNameRegex != nil && !certificateNameRegex.MatchString(fmt.Sprint(item["CertificateName"])) { + continue + } + if len(idsMap) > 0 { + if _, ok := idsMap[fmt.Sprint(item["CertificateId"])]; !ok { + continue + } + } + objects = append(objects, item) + } + ids := make([]string, 0) + names := make([]interface{}, 0) + s := make([]map[string]interface{}, 0) + for _, object := range objects { + mapping := map[string]interface{}{ + "id": fmt.Sprint(object["CertificateId"]), + "certificate_id": fmt.Sprint(object["CertificateId"]), + "certificate_name": object["CertificateName"], + "common_name": object["CommonName"], + "domain": request["Domain"], + "instance_id": request["InstanceId"], + "is_using": object["IsUsing"], + "sans": object["Sans"], + } + ids = append(ids, fmt.Sprint(mapping["id"])) + names = append(names, object["CertificateName"]) + s = append(s, mapping) + } + + d.SetId(dataResourceIdHash(ids)) + if err := d.Set("ids", ids); err != nil { + return WrapError(err) + } + + if err := d.Set("names", names); err != nil { + return WrapError(err) + } + + if err := d.Set("certificates", s); err != nil { + return WrapError(err) + } + if output, ok := d.GetOk("output_file"); ok && output.(string) != "" { + writeToFile(output.(string), s) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_yundun_dbaudit_instances.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_yundun_dbaudit_instances.go index 48d9aaeb3e6..a52e782a6dc 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_yundun_dbaudit_instances.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_yundun_dbaudit_instances.go @@ -170,7 +170,7 @@ func dataSourceAlicloudDbauditInstancesRead(d *schema.ResourceData, meta interfa } addDebug(request.GetActionName(), raw, request.RpcRequest, request) response, _ := raw.(*yundun_dbaudit.ListTagResourcesResponse) - instanceTags = append(instanceTags, yundun_dbaudit.TagResources{response.TagResources}) + instanceTags = append(instanceTags, yundun_dbaudit.TagResources{TagResource: response.TagResources}) } return WrapError(extractDbauditInstance(d, instances, instanceTags)) } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_zones.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_zones.go index 91d0ae8b586..9ca955843c3 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_zones.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/data_source_alicloud_zones.go @@ -11,18 +11,13 @@ import ( "github.com/denverdino/aliyungo/common" - "github.com/aliyun/alibaba-cloud-sdk-go/services/gpdb" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - - "time" - "github.com/aliyun/alibaba-cloud-sdk-go/services/adb" "github.com/aliyun/alibaba-cloud-sdk-go/services/dds" "github.com/aliyun/alibaba-cloud-sdk-go/services/ecs" "github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch" + "github.com/aliyun/alibaba-cloud-sdk-go/services/gpdb" "github.com/aliyun/alibaba-cloud-sdk-go/services/polardb" r_kvstore "github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore" - "github.com/aliyun/alibaba-cloud-sdk-go/services/rds" "github.com/aliyun/alibaba-cloud-sdk-go/services/slb" "github.com/aliyun/fc-go-sdk" "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" @@ -199,44 +194,6 @@ func dataSourceAlicloudZonesRead(d *schema.ResourceData, meta interface{}) error adbZones := make(map[string]string) instanceChargeType := d.Get("instance_charge_type").(string) - if strings.ToLower(Trim(resType)) == strings.ToLower(string(ResourceTypeRds)) { - request := rds.CreateDescribeAvailableResourceRequest() - request.RegionId = client.RegionId - if instanceChargeType == string(PostPaid) { - request.InstanceChargeType = string(Postpaid) - } else { - request.InstanceChargeType = string(Prepaid) - } - var response = &rds.DescribeAvailableResourceResponse{} - err := resource.Retry(5*time.Minute, func() *resource.RetryError { - raw, err := client.WithRdsClient(func(rdsClient *rds.Client) (interface{}, error) { - return rdsClient.DescribeAvailableResource(request) - }) - if err != nil { - if IsExpectedErrors(err, []string{Throttling}) { - time.Sleep(time.Duration(5) * time.Second) - return resource.RetryableError(err) - } - return resource.NonRetryableError(err) - } - addDebug(request.GetActionName(), raw, request.RpcRequest, request) - response = raw.(*rds.DescribeAvailableResourceResponse) - return nil - }) - if err != nil { - return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_zones", request.GetActionName(), AlibabaCloudSdkGoERROR) - } - if len(response.AvailableZones.AvailableZone) <= 0 { - return WrapError(fmt.Errorf("[ERROR] There is no available zone for RDS.")) - } - for _, r := range response.AvailableZones.AvailableZone { - if multi && strings.Contains(r.ZoneId, MULTI_IZ_SYMBOL) && r.RegionId == string(client.Region) { - zoneIds = append(zoneIds, r.ZoneId) - continue - } - rdsZones[r.ZoneId] = r.RegionId - } - } if strings.ToLower(Trim(resType)) == strings.ToLower(string(ResourceTypePolarDB)) { request := polardb.CreateDescribeRegionsRequest() request.RegionId = client.RegionId @@ -623,15 +580,3 @@ func zoneIdsDescriptionAttributes(d *schema.ResourceData, zones []string) error return nil } - -func splitMultiZoneId(id string) (ids []string) { - if !(strings.Contains(id, MULTI_IZ_SYMBOL) || strings.Contains(id, "(")) { - return - } - firstIndex := strings.Index(id, MULTI_IZ_SYMBOL) - secondIndex := strings.Index(id, "(") - for _, p := range strings.Split(id[secondIndex+1:len(id)-1], COMMA_SEPARATED) { - ids = append(ids, id[:firstIndex]+string(p)) - } - return -} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/diff_suppress_funcs.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/diff_suppress_funcs.go index 04430814a7d..6e6425b9255 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/diff_suppress_funcs.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/diff_suppress_funcs.go @@ -123,31 +123,6 @@ func dnsPriorityDiffSuppressFunc(k, old, new string, d *schema.ResourceData) boo return d.Get("type").(string) != "MX" } -func slbInternetDiffSuppressFunc(k, old, new string, d *schema.ResourceData) bool { - if internet, ok := d.GetOk("address_type"); ok && internet.(string) == "internet" { - return true - } - if internet, ok := d.GetOkExists("internet"); ok && internet.(bool) { - return true - } - return false -} - -func slbInternetChargeTypeDiffSuppressFunc(k, old, new string, d *schema.ResourceData) bool { - // Uniform all internet chare type value and be compatible with previous lower value. - if strings.ToLower(old) == strings.ToLower(new) { - return true - } - return !slbInternetDiffSuppressFunc(k, old, new, d) -} - -func slbBandwidthDiffSuppressFunc(k, old, new string, d *schema.ResourceData) bool { - if slbInternetDiffSuppressFunc(k, old, new, d) && strings.ToLower(d.Get("internet_charge_type").(string)) == strings.ToLower(string(PayByBandwidth)) { - return false - } - return true -} - func slbAclDiffSuppressFunc(k, old, new string, d *schema.ResourceData) bool { if status, ok := d.GetOk("acl_status"); ok && status.(string) == string(OnFlag) { return false @@ -282,16 +257,6 @@ func PostPaidAndRenewDiffSuppressFunc(k, old, new string, d *schema.ResourceData return true } -func PostPaidAndRenewalDiffSuppressFunc(k, old, new string, d *schema.ResourceData) bool { - if PostPaidDiffSuppressFunc(k, old, new, d) { - return true - } - if v, ok := d.GetOk("renewal_status"); ok && v.(string) == "AutoRenewal" { - return false - } - return true -} - func redisPostPaidDiffSuppressFunc(k, old, new string, d *schema.ResourceData) bool { return strings.ToLower(d.Get("payment_type").(string)) == "postpaid" } @@ -416,6 +381,15 @@ func ecsSecurityGroupRulePortRangeDiffSuppressFunc(k, old, new string, d *schema return true } +func ecsSecurityGroupRulePreFixListIdDiffSuppressFunc(k, old, new string, d *schema.ResourceData) bool { + _, cidrIpExist := d.GetOk("cidr_ip") + _, SourceSecurityGroupIdExist := d.GetOk("source_security_group_id") + if cidrIpExist || SourceSecurityGroupIdExist { + return true + } + return false +} + func vpcTypeResourceDiffSuppressFunc(k, old, new string, d *schema.ResourceData) bool { if len(Trim(d.Get("vswitch_id").(string))) > 0 { return false @@ -473,13 +447,6 @@ func vpnSslConnectionsDiffSuppressFunc(k, old, new string, d *schema.ResourceDat return false } -func slbDeleteProtectionSuppressFunc(k, old, new string, d *schema.ResourceData) bool { - if PayType(d.Get("instance_charge_type").(string)) == PrePaid { - return true - } - return false -} - func slbRuleStickySessionTypeDiffSuppressFunc(k, old, new string, d *schema.ResourceData) bool { listenerSync := slbRuleListenerSyncDiffSuppressFunc(k, old, new, d) if session, ok := d.GetOk("sticky_session"); !listenerSync && ok && session.(string) == string(OnFlag) { @@ -519,13 +486,6 @@ func slbRuleListenerSyncDiffSuppressFunc(k, old, new string, d *schema.ResourceD return true } -func slbAddressDiffSuppressFunc(k, old, new string, d *schema.ResourceData) bool { - if v, ok := d.GetOk("internet"); ok && v.(bool) { - return true - } - return false -} - func kmsDiffSuppressFunc(k, old, new string, d *schema.ResourceData) bool { if v, ok := d.GetOk("password"); ok && v.(string) != "" { return true diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/errors.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/errors.go index 93203a33fba..34ce7cb5017 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/errors.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/errors.go @@ -26,6 +26,7 @@ const ( ResourceNotfound = "ResourceNotfound" ServiceUnavailable = "ServiceUnavailable" InstanceNotFound = "Instance.Notfound" + ForbiddenInstance = "Forbidden.InstanceNotFound" MessageInstanceNotFound = "instance is not found" Throttling = "Throttling" ThrottlingUser = "Throttling.User" @@ -35,13 +36,15 @@ const ( AliyunGoClientFailure = "AliyunGoClientFailure" LogClientTimeout = "Client.Timeout exceeded while awaiting headers" + + InvalidFileSystemStatus_Ordering = "InvalidFileSystemStatus.Ordering" ) var SlbIsBusy = []string{"SystemBusy", "OperationBusy", "ServiceIsStopping", "BackendServer.configuring", "ServiceIsConfiguring"} var EcsNotFound = []string{"InvalidInstanceId.NotFound", "Forbidden.InstanceNotFound"} var DiskInvalidOperation = []string{"IncorrectDiskStatus", "IncorrectInstanceStatus", "OperationConflict", "InternalError", "InvalidOperation.Conflict", "IncorrectDiskStatus.Initializing"} var NetworkInterfaceInvalidOperations = []string{"InvalidOperation.InvalidEniState", "InvalidOperation.InvalidEcsState", "OperationConflict", "ServiceUnavailable", "InternalError"} -var OperationDeniedDBStatus = []string{"OperationDenied.DBStatus", "OperationDenied.DBInstanceStatus", "OperationDenied.DBClusterStatus", "InternalError", "OperationDenied.OutofUsage", "IncorrectDBInstanceState"} +var OperationDeniedDBStatus = []string{"InstanceConnectTimeoutFault", "OperationDenied.DBStatus", "OperationDenied.DBInstanceStatus", "OperationDenied.DBClusterStatus", "InternalError", "OperationDenied.OutofUsage", "IncorrectDBInstanceState"} var DBReadInstanceNotReadyStatus = []string{"OperationDenied.ReadDBInstanceStatus", "OperationDenied.MasterDBInstanceState", "ReadDBInstance.Mismatch"} var NasNotFound = []string{"InvalidMountTarget.NotFound", "InvalidFileSystem.NotFound", "Forbidden.NasNotFound", "InvalidLBid.NotFound", "VolumeUnavailable"} var SnapshotInvalidOperations = []string{"OperationConflict", "ServiceUnavailable", "InternalError", "SnapshotCreatedDisk", "SnapshotCreatedImage"} @@ -383,5 +386,6 @@ const FailedGetAttributeMsg = "Getting resource %s attribute by path %s failed!! const DefaultDebugMsg = "\n*************** %s Response *************** \n%s\n%s******************************\n\n" const FailedToReachTargetStatus = "Failed to reach target status. Current status is %s." +const FailedToReachTargetStatusWithResponse = FailedToReachTargetStatus + " Response: %s" const FailedToReachTargetAttribute = "Failed to reach value for target attribute. Current value is %s." const RequiredWhenMsg = "attribute '%s' is required when '%s' is %v" diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/provider.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/provider.go index dcd9851d441..7439b941a19 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/provider.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/provider.go @@ -6,6 +6,7 @@ import ( "fmt" "io/ioutil" "log" + "net/http" "os" "runtime" "strconv" @@ -29,12 +30,6 @@ import ( func Provider() terraform.ResourceProvider { return &schema.Provider{ Schema: map[string]*schema.Schema{ - "source_ip": { - Type: schema.TypeString, - Optional: true, - DefaultFunc: schema.EnvDefaultFunc("ALICLOUD_SOURCE_IP", os.Getenv("ALICLOUD_SOURCE_IP")), - Description: descriptions["source_ip"], - }, "access_key": { Type: schema.TypeString, Optional: true, @@ -117,6 +112,7 @@ func Provider() terraform.ResourceProvider { Default: "", Description: descriptions["configuration_source"], ValidateFunc: validation.StringLenBetween(0, 64), + DefaultFunc: schema.EnvDefaultFunc("TF_APPEND_USER_AGENT", ""), }, "protocol": { Type: schema.TypeString, @@ -128,15 +124,39 @@ func Provider() terraform.ResourceProvider { "client_read_timeout": { Type: schema.TypeInt, Optional: true, - DefaultFunc: schema.EnvDefaultFunc("CLIENT_READ_TIMEOUT", 30000), + DefaultFunc: schema.EnvDefaultFunc("CLIENT_READ_TIMEOUT", 60000), Description: descriptions["client_read_timeout"], }, "client_connect_timeout": { Type: schema.TypeInt, Optional: true, - DefaultFunc: schema.EnvDefaultFunc("CLIENT_CONNECT_TIMEOUT", 30000), + DefaultFunc: schema.EnvDefaultFunc("CLIENT_CONNECT_TIMEOUT", 60000), Description: descriptions["client_connect_timeout"], }, + "source_ip": { + Type: schema.TypeString, + Optional: true, + DefaultFunc: schema.EnvDefaultFunc("ALICLOUD_SOURCE_IP", os.Getenv("ALICLOUD_SOURCE_IP")), + Description: descriptions["source_ip"], + }, + "security_transport": { + Type: schema.TypeString, + Optional: true, + DefaultFunc: schema.EnvDefaultFunc("ALICLOUD_SECURITY_TRANSPORT", os.Getenv("ALICLOUD_SECURITY_TRANSPORT")), + //Deprecated: "It has been deprecated from version 1.136.0 and using new field secure_transport instead.", + }, + "secure_transport": { + Type: schema.TypeString, + Optional: true, + DefaultFunc: schema.EnvDefaultFunc("ALICLOUD_SECURE_TRANSPORT", os.Getenv("ALICLOUD_SECURE_TRANSPORT")), + Description: descriptions["secure_transport"], + }, + "credentials_uri": { + Type: schema.TypeString, + Optional: true, + DefaultFunc: schema.EnvDefaultFunc("ALICLOUD_CREDENTIALS_URI", os.Getenv("ALICLOUD_CREDENTIALS_URI")), + Description: descriptions["credentials_uri"], + }, }, DataSourcesMap: map[string]*schema.Resource{ @@ -207,6 +227,7 @@ func Provider() terraform.ResourceProvider { "alicloud_db_instances": dataSourceAlicloudDBInstances(), "alicloud_db_instance_engines": dataSourceAlicloudDBInstanceEngines(), "alicloud_db_instance_classes": dataSourceAlicloudDBInstanceClasses(), + "alicloud_rds_backups": dataSourceAlicloudRdsBackups(), "alicloud_pvtz_zones": dataSourceAlicloudPvtzZones(), "alicloud_pvtz_zone_records": dataSourceAlicloudPvtzZoneRecords(), "alicloud_router_interfaces": dataSourceAlicloudRouterInterfaces(), @@ -242,6 +263,7 @@ func Provider() terraform.ResourceProvider { "alicloud_cs_edge_kubernetes_clusters": dataSourceAlicloudCSEdgeKubernetesClusters(), "alicloud_cs_serverless_kubernetes_clusters": dataSourceAlicloudCSServerlessKubernetesClusters(), "alicloud_cs_kubernetes_permissions": dataSourceAlicloudCSKubernetesPermissions(), + "alicloud_cs_kubernetes_addons": dataSourceAlicloudCSKubernetesAddons(), "alicloud_cr_namespaces": dataSourceAlicloudCRNamespaces(), "alicloud_cr_repos": dataSourceAlicloudCRRepos(), "alicloud_cr_ee_instances": dataSourceAlicloudCrEEInstances(), @@ -313,6 +335,7 @@ func Provider() terraform.ResourceProvider { "alicloud_kms_service": dataSourceAlicloudKmsService(), "alicloud_sae_service": dataSourceAlicloudSaeService(), "alicloud_dataworks_service": dataSourceAlicloudDataWorksService(), + "alicloud_data_works_service": dataSourceAlicloudDataWorksService(), "alicloud_mns_service": dataSourceAlicloudMnsService(), "alicloud_cloud_storage_gateway_service": dataSourceAlicloudCloudStorageGatewayService(), "alicloud_vs_service": dataSourceAlicloudVsService(), @@ -481,6 +504,158 @@ func Provider() terraform.ResourceProvider { "alicloud_alb_zones": dataSourceAlicloudAlbZones(), "alicloud_sddp_rules": dataSourceAlicloudSddpRules(), "alicloud_bastionhost_user_groups": dataSourceAlicloudBastionhostUserGroups(), + "alicloud_security_center_groups": dataSourceAlicloudSecurityCenterGroups(), + "alicloud_alb_acls": dataSourceAlicloudAlbAcls(), + "alicloud_hbr_snapshots": dataSourceAlicloudHbrSnapshots(), + "alicloud_bastionhost_users": dataSourceAlicloudBastionhostUsers(), + "alicloud_dfs_access_groups": dataSourceAlicloudDfsAccessGroups(), + "alicloud_ehpc_job_templates": dataSourceAlicloudEhpcJobTemplates(), + "alicloud_sddp_configs": dataSourceAlicloudSddpConfigs(), + "alicloud_hbr_restore_jobs": dataSourceAlicloudHbrRestoreJobs(), + "alicloud_alb_listeners": dataSourceAlicloudAlbListeners(), + "alicloud_ens_key_pairs": dataSourceAlicloudEnsKeyPairs(), + "alicloud_sae_applications": dataSourceAlicloudSaeApplications(), + "alicloud_alb_rules": dataSourceAlicloudAlbRules(), + "alicloud_cms_metric_rule_templates": dataSourceAlicloudCmsMetricRuleTemplates(), + "alicloud_iot_device_groups": dataSourceAlicloudIotDeviceGroups(), + "alicloud_express_connect_virtual_border_routers": dataSourceAlicloudExpressConnectVirtualBorderRouters(), + "alicloud_imm_projects": dataSourceAlicloudImmProjects(), + "alicloud_click_house_db_clusters": dataSourceAlicloudClickHouseDbClusters(), + "alicloud_direct_mail_domains": dataSourceAlicloudDirectMailDomains(), + "alicloud_bastionhost_host_groups": dataSourceAlicloudBastionhostHostGroups(), + "alicloud_vpc_dhcp_options_sets": dataSourceAlicloudVpcDhcpOptionsSets(), + "alicloud_alb_health_check_templates": dataSourceAlicloudAlbHealthCheckTemplates(), + "alicloud_cdn_real_time_log_deliveries": dataSourceAlicloudCdnRealTimeLogDeliveries(), + "alicloud_click_house_accounts": dataSourceAlicloudClickHouseAccounts(), + "alicloud_direct_mail_mail_addresses": dataSourceAlicloudDirectMailMailAddresses(), + "alicloud_database_gateway_gateways": dataSourceAlicloudDatabaseGatewayGateways(), + "alicloud_bastionhost_hosts": dataSourceAlicloudBastionhostHosts(), + "alicloud_amqp_bindings": dataSourceAlicloudAmqpBindings(), + "alicloud_slb_tls_cipher_policies": dataSourceAlicloudSlbTlsCipherPolicies(), + "alicloud_cloud_sso_directories": dataSourceAlicloudCloudSsoDirectories(), + "alicloud_bastionhost_host_accounts": dataSourceAlicloudBastionhostHostAccounts(), + "alicloud_waf_certificates": dataSourceAlicloudWafCertificates(), + "alicloud_simple_application_server_instances": dataSourceAlicloudSimpleApplicationServerInstances(), + "alicloud_simple_application_server_plans": dataSourceAlicloudSimpleApplicationServerPlans(), + "alicloud_simple_application_server_images": dataSourceAlicloudSimpleApplicationServerImages(), + "alicloud_video_surveillance_system_groups": dataSourceAlicloudVideoSurveillanceSystemGroups(), + "alicloud_msc_sub_subscriptions": dataSourceAlicloudMscSubSubscriptions(), + "alicloud_sddp_instances": dataSourceAlicloudSddpInstances(), + "alicloud_vpc_nat_ip_cidrs": dataSourceAlicloudVpcNatIpCidrs(), + "alicloud_vpc_nat_ips": dataSourceAlicloudVpcNatIps(), + "alicloud_quick_bi_users": dataSourceAlicloudQuickBiUsers(), + "alicloud_vod_domains": dataSourceAlicloudVodDomains(), + "alicloud_arms_dispatch_rules": dataSourceAlicloudArmsDispatchRules(), + "alicloud_open_search_app_groups": dataSourceAlicloudOpenSearchAppGroups(), + "alicloud_graph_database_db_instances": dataSourceAlicloudGraphDatabaseDbInstances(), + "alicloud_arms_prometheus_alert_rules": dataSourceAlicloudArmsPrometheusAlertRules(), + "alicloud_dbfs_instances": dataSourceAlicloudDbfsInstances(), + "alicloud_rdc_organizations": dataSourceAlicloudRdcOrganizations(), + "alicloud_eais_instances": dataSourceAlicloudEaisInstances(), + "alicloud_sae_ingresses": dataSourceAlicloudSaeIngresses(), + "alicloud_cloudauth_face_configs": dataSourceAlicloudCloudauthFaceConfigs(), + "alicloud_imp_app_templates": dataSourceAlicloudImpAppTemplates(), + "alicloud_mhub_products": dataSourceAlicloudMhubProducts(), + "alicloud_cloud_sso_scim_server_credentials": dataSourceAlicloudCloudSsoScimServerCredentials(), + "alicloud_dts_subscription_jobs": dataSourceAlicloudDtsSubscriptionJobs(), + "alicloud_service_mesh_service_meshes": dataSourceAlicloudServiceMeshServiceMeshes(), + "alicloud_mhub_apps": dataSourceAlicloudMhubApps(), + "alicloud_cloud_sso_groups": dataSourceAlicloudCloudSsoGroups(), + "alicloud_hbr_backup_jobs": dataSourceAlicloudHbrBackupJobs(), + "alicloud_click_house_regions": dataSourceAlicloudClickHouseRegions(), + "alicloud_dts_synchronization_jobs": dataSourceAlicloudDtsSynchronizationJobs(), + "alicloud_cloud_firewall_instances": dataSourceAlicloudCloudFirewallInstances(), + "alicloud_cr_endpoint_acl_policies": dataSourceAlicloudCrEndpointAclPolicies(), + "alicloud_cr_endpoint_acl_service": dataSourceAlicloudCrEndpointAclService(), + "alicloud_actiontrail_history_delivery_jobs": dataSourceAlicloudActiontrailHistoryDeliveryJobs(), + "alicloud_sae_instance_specifications": dataSourceAlicloudSaeInstanceSpecifications(), + "alicloud_cen_transit_router_service": dataSourceAlicloudCenTransitRouterService(), + "alicloud_ecs_deployment_sets": dataSourceAlicloudEcsDeploymentSets(), + "alicloud_cloud_sso_users": dataSourceAlicloudCloudSsoUsers(), + "alicloud_cloud_sso_access_configurations": dataSourceAlicloudCloudSsoAccessConfigurations(), + "alicloud_dfs_file_systems": dataSourceAlicloudDfsFileSystems(), + "alicloud_dfs_zones": dataSourceAlicloudDfsZones(), + "alicloud_vpc_traffic_mirror_filters": dataSourceAlicloudVpcTrafficMirrorFilters(), + "alicloud_dfs_access_rules": dataSourceAlicloudDfsAccessRules(), + "alicloud_nas_zones": dataSourceAlicloudNasZones(), + "alicloud_dfs_mount_points": dataSourceAlicloudDfsMountPoints(), + "alicloud_vpc_traffic_mirror_filter_egress_rules": dataSourceAlicloudVpcTrafficMirrorFilterEgressRules(), + "alicloud_ecd_simple_office_sites": dataSourceAlicloudEcdSimpleOfficeSites(), + "alicloud_vpc_traffic_mirror_filter_ingress_rules": dataSourceAlicloudVpcTrafficMirrorFilterIngressRules(), + "alicloud_ecd_nas_file_systems": dataSourceAlicloudEcdNasFileSystems(), + "alicloud_vpc_traffic_mirror_service": dataSourceAlicloudVpcTrafficMirrorService(), + "alicloud_msc_sub_webhooks": dataSourceAlicloudMscSubWebhooks(), + "alicloud_ecd_users": dataSourceAlicloudEcdUsers(), + "alicloud_vpc_traffic_mirror_sessions": dataSourceAlicloudVpcTrafficMirrorSessions(), + "alicloud_gpdb_accounts": dataSourceAlicloudGpdbAccounts(), + "alicloud_vpc_ipv6_gateways": dataSourceAlicloudVpcIpv6Gateways(), + "alicloud_vpc_ipv6_egress_rules": dataSourceAlicloudVpcIpv6EgressRules(), + "alicloud_vpc_ipv6_addresses": dataSourceAlicloudVpcIpv6Addresses(), + "alicloud_hbr_server_backup_plans": dataSourceAlicloudHbrServerBackupPlans(), + "alicloud_cms_dynamic_tag_groups": dataSourceAlicloudCmsDynamicTagGroups(), + "alicloud_ecd_network_packages": dataSourceAlicloudEcdNetworkPackages(), + "alicloud_cloud_storage_gateway_gateway_smb_users": dataSourceAlicloudCloudStorageGatewayGatewaySmbUsers(), + "alicloud_vpc_ipv6_internet_bandwidths": dataSourceAlicloudVpcIpv6InternetBandwidths(), + "alicloud_simple_application_server_firewall_rules": dataSourceAlicloudSimpleApplicationServerFirewallRules(), + "alicloud_pvtz_endpoints": dataSourceAlicloudPvtzEndpoints(), + "alicloud_pvtz_resolver_zones": dataSourceAlicloudPvtzResolverZones(), + "alicloud_pvtz_rules": dataSourceAlicloudPvtzRules(), + "alicloud_ecd_bundles": dataSourceAlicloudEcdBundles(), + "alicloud_simple_application_server_disks": dataSourceAlicloudSimpleApplicationServerDisks(), + "alicloud_simple_application_server_snapshots": dataSourceAlicloudSimpleApplicationServerSnapshots(), + "alicloud_simple_application_server_custom_images": dataSourceAlicloudSimpleApplicationServerCustomImages(), + "alicloud_cloud_storage_gateway_stocks": dataSourceAlicloudCloudStorageGatewayStocks(), + "alicloud_cloud_storage_gateway_gateway_cache_disks": dataSourceAlicloudCloudStorageGatewayGatewayCacheDisks(), + "alicloud_cloud_storage_gateway_gateway_block_volumes": dataSourceAlicloudCloudStorageGatewayGatewayBlockVolumes(), + "alicloud_direct_mail_tags": dataSourceAlicloudDirectMailTags(), + "alicloud_cloud_storage_gateway_gateway_file_shares": dataSourceAlicloudCloudStorageGatewayGatewayFileShares(), + "alicloud_ecd_desktops": dataSourceAlicloudEcdDesktops(), + "alicloud_cloud_storage_gateway_express_syncs": dataSourceAlicloudCloudStorageGatewayExpressSyncs(), + "alicloud_oos_applications": dataSourceAlicloudOosApplications(), + "alicloud_eci_virtual_nodes": dataSourceAlicloudEciVirtualNodes(), + "alicloud_eci_zones": dataSourceAlicloudEciZones(), + "alicloud_ros_stack_instances": dataSourceAlicloudRosStackInstances(), + "alicloud_ros_regions": dataSourceAlicloudRosRegions(), + "alicloud_ecs_dedicated_host_clusters": dataSourceAlicloudEcsDedicatedHostClusters(), + "alicloud_oos_application_groups": dataSourceAlicloudOosApplicationGroups(), + "alicloud_dts_consumer_channels": dataSourceAlicloudDtsConsumerChannels(), + "alicloud_emr_clusters": dataSourceAlicloudEmrClusters(), + "alicloud_ecd_images": dataSourceAlicloudEcdImages(), + "alicloud_oos_patch_baselines": dataSourceAlicloudOosPatchBaselines(), + "alicloud_ecd_commands": dataSourceAlicloudEcdCommands(), + "alicloud_cddc_zones": dataSourceAlicloudCddcZones(), + "alicloud_cddc_host_ecs_level_infos": dataSourceAlicloudCddcHostEcsLevelInfos(), + "alicloud_cddc_dedicated_hosts": dataSourceAlicloudCddcDedicatedHosts(), + "alicloud_oos_parameters": dataSourceAlicloudOosParameters(), + "alicloud_oos_state_configurations": dataSourceAlicloudOosStateConfigurations(), + "alicloud_oos_secret_parameters": dataSourceAlicloudOosSecretParameters(), + "alicloud_click_house_backup_policies": dataSourceAlicloudClickHouseBackupPolicies(), + "alicloud_cloud_sso_service": dataSourceAlicloudCloudSsoService(), + "alicloud_mongodb_audit_policies": dataSourceAlicloudMongodbAuditPolicies(), + "alicloud_mongodb_accounts": dataSourceAlicloudMongodbAccounts(), + "alicloud_mongodb_serverless_instances": dataSourceAlicloudMongodbServerlessInstances(), + "alicloud_cddc_dedicated_host_accounts": dataSourceAlicloudCddcDedicatedHostAccounts(), + "alicloud_cr_chart_namespaces": dataSourceAlicloudCrChartNamespaces(), + "alicloud_fnf_executions": dataSourceAlicloudFnFExecutions(), + "alicloud_cr_chart_repositories": dataSourceAlicloudCrChartRepositories(), + "alicloud_mongodb_sharding_network_public_addresses": dataSourceAlicloudMongodbShardingNetworkPublicAddresses(), + "alicloud_ga_acls": dataSourceAlicloudGaAcls(), + "alicloud_ga_additional_certificates": dataSourceAlicloudGaAdditionalCertificates(), + "alicloud_alidns_custom_lines": dataSourceAlicloudAlidnsCustomLines(), + "alicloud_ros_template_scratches": dataSourceAlicloudRosTemplateScratches(), + "alicloud_alidns_gtm_instances": dataSourceAlicloudAlidnsGtmInstances(), + "alicloud_vpc_bgp_groups": dataSourceAlicloudVpcBgpGroups(), + "alicloud_nas_snapshots": dataSourceAlicloudNasSnapshots(), + "alicloud_hbr_replication_vault_regions": dataSourceAlicloudHbrReplicationVaultRegions(), + "alicloud_alidns_address_pools": dataSourceAlicloudAlidnsAddressPools(), + "alicloud_ecs_prefix_lists": dataSourceAlicloudEcsPrefixLists(), + "alicloud_alidns_access_strategies": dataSourceAlicloudAlidnsAccessStrategies(), + "alicloud_vpc_bgp_peers": dataSourceAlicloudVpcBgpPeers(), + "alicloud_nas_filesets": dataSourceAlicloudNasFilesets(), + "alicloud_cdn_ip_info": dataSourceAlicloudCdnIpInfo(), + "alicloud_nas_auto_snapshot_policies": dataSourceAlicloudNasAutoSnapshotPolicies(), + "alicloud_nas_lifecycle_policies": dataSourceAlicloudNasLifecyclePolicies(), + "alicloud_vpc_bgp_networks": dataSourceAlicloudVpcBgpNetworks(), }, ResourcesMap: map[string]*schema.Resource{ "alicloud_instance": resourceAliyunInstance(), @@ -508,6 +683,9 @@ func Provider() terraform.ResourceProvider { "alicloud_db_connection": resourceAlicloudDBConnection(), "alicloud_db_read_write_splitting_connection": resourceAlicloudDBReadWriteSplittingConnection(), "alicloud_db_instance": resourceAlicloudDBInstance(), + "alicloud_rds_backup": resourceAlicloudRdsBackup(), + "alicloud_rds_clone_db_instance": resourceAlicloudRdsCloneDbInstance(), + "alicloud_rds_upgrade_db_instance": resourceAlicloudRdsUpgradeDbInstance(), "alicloud_mongodb_instance": resourceAlicloudMongoDBInstance(), "alicloud_mongodb_sharding_instance": resourceAlicloudMongoDBShardingInstance(), "alicloud_gpdb_instance": resourceAlicloudGpdbInstance(), @@ -577,293 +755,448 @@ func Provider() terraform.ResourceProvider { "alicloud_ram_role": resourceAlicloudRamRole(), "alicloud_ram_policy": resourceAlicloudRamPolicy(), // alicloud_ram_alias has been deprecated - "alicloud_ram_alias": resourceAlicloudRamAccountAlias(), - "alicloud_ram_account_alias": resourceAlicloudRamAccountAlias(), - "alicloud_ram_group_membership": resourceAlicloudRamGroupMembership(), - "alicloud_ram_user_policy_attachment": resourceAlicloudRamUserPolicyAtatchment(), - "alicloud_ram_role_policy_attachment": resourceAlicloudRamRolePolicyAttachment(), - "alicloud_ram_group_policy_attachment": resourceAlicloudRamGroupPolicyAtatchment(), - "alicloud_container_cluster": resourceAlicloudCSSwarm(), - "alicloud_cs_application": resourceAlicloudCSApplication(), - "alicloud_cs_swarm": resourceAlicloudCSSwarm(), - "alicloud_cs_kubernetes": resourceAlicloudCSKubernetes(), - "alicloud_cs_managed_kubernetes": resourceAlicloudCSManagedKubernetes(), - "alicloud_cs_edge_kubernetes": resourceAlicloudCSEdgeKubernetes(), - "alicloud_cs_serverless_kubernetes": resourceAlicloudCSServerlessKubernetes(), - "alicloud_cs_kubernetes_autoscaler": resourceAlicloudCSKubernetesAutoscaler(), - "alicloud_cs_kubernetes_node_pool": resourceAlicloudCSKubernetesNodePool(), - "alicloud_cs_kubernetes_permissions": resourceAlicloudCSKubernetesPermissions(), - "alicloud_cs_autoscaling_config": resourceAlicloudCSAutoscalingConfig(), - "alicloud_cr_namespace": resourceAlicloudCRNamespace(), - "alicloud_cr_repo": resourceAlicloudCRRepo(), - "alicloud_cr_ee_instance": resourceAlicloudCrEEInstance(), - "alicloud_cr_ee_namespace": resourceAlicloudCrEENamespace(), - "alicloud_cr_ee_repo": resourceAlicloudCrEERepo(), - "alicloud_cr_ee_sync_rule": resourceAlicloudCrEESyncRule(), - "alicloud_cdn_domain": resourceAlicloudCdnDomain(), - "alicloud_cdn_domain_new": resourceAlicloudCdnDomainNew(), - "alicloud_cdn_domain_config": resourceAlicloudCdnDomainConfig(), - "alicloud_router_interface": resourceAlicloudRouterInterface(), - "alicloud_router_interface_connection": resourceAlicloudRouterInterfaceConnection(), - "alicloud_ots_table": resourceAlicloudOtsTable(), - "alicloud_ots_instance": resourceAlicloudOtsInstance(), - "alicloud_ots_instance_attachment": resourceAlicloudOtsInstanceAttachment(), - "alicloud_cms_alarm": resourceAlicloudCmsAlarm(), - "alicloud_cms_site_monitor": resourceAlicloudCmsSiteMonitor(), - "alicloud_pvtz_zone": resourceAlicloudPvtzZone(), - "alicloud_pvtz_zone_attachment": resourceAlicloudPvtzZoneAttachment(), - "alicloud_pvtz_zone_record": resourceAlicloudPvtzZoneRecord(), - "alicloud_log_alert": resourceAlicloudLogAlert(), - "alicloud_log_audit": resourceAlicloudLogAudit(), - "alicloud_log_dashboard": resourceAlicloudLogDashboard(), - "alicloud_log_etl": resourceAlicloudLogETL(), - "alicloud_log_machine_group": resourceAlicloudLogMachineGroup(), - "alicloud_log_oss_shipper": resourceAlicloudLogOssShipper(), - "alicloud_log_project": resourceAlicloudLogProject(), - "alicloud_log_store": resourceAlicloudLogStore(), - "alicloud_log_store_index": resourceAlicloudLogStoreIndex(), - "alicloud_logtail_config": resourceAlicloudLogtailConfig(), - "alicloud_logtail_attachment": resourceAlicloudLogtailAttachment(), - "alicloud_fc_service": resourceAlicloudFCService(), - "alicloud_fc_function": resourceAlicloudFCFunction(), - "alicloud_fc_trigger": resourceAlicloudFCTrigger(), - "alicloud_fc_alias": resourceAlicloudFCAlias(), - "alicloud_fc_custom_domain": resourceAlicloudFCCustomDomain(), - "alicloud_fc_function_async_invoke_config": resourceAlicloudFCFunctionAsyncInvokeConfig(), - "alicloud_vpn_gateway": resourceAliyunVpnGateway(), - "alicloud_vpn_customer_gateway": resourceAliyunVpnCustomerGateway(), - "alicloud_vpn_route_entry": resourceAliyunVpnRouteEntry(), - "alicloud_vpn_connection": resourceAliyunVpnConnection(), - "alicloud_ssl_vpn_server": resourceAliyunSslVpnServer(), - "alicloud_ssl_vpn_client_cert": resourceAliyunSslVpnClientCert(), - "alicloud_cen_instance": resourceAlicloudCenInstance(), - "alicloud_cen_instance_attachment": resourceAlicloudCenInstanceAttachment(), - "alicloud_cen_bandwidth_package": resourceAlicloudCenBandwidthPackage(), - "alicloud_cen_bandwidth_package_attachment": resourceAlicloudCenBandwidthPackageAttachment(), - "alicloud_cen_bandwidth_limit": resourceAlicloudCenBandwidthLimit(), - "alicloud_cen_route_entry": resourceAlicloudCenRouteEntry(), - "alicloud_cen_instance_grant": resourceAlicloudCenInstanceGrant(), - "alicloud_cen_transit_router": resourceAlicloudCenTransitRouter(), - "alicloud_cen_transit_router_route_entry": resourceAlicloudCenTransitRouterRouteEntry(), - "alicloud_cen_transit_router_route_table": resourceAlicloudCenTransitRouterRouteTable(), - "alicloud_cen_transit_router_route_table_association": resourceAlicloudCenTransitRouterRouteTableAssociation(), - "alicloud_cen_transit_router_route_table_propagation": resourceAlicloudCenTransitRouterRouteTablePropagation(), - "alicloud_cen_transit_router_vbr_attachment": resourceAlicloudCenTransitRouterVbrAttachment(), - "alicloud_cen_transit_router_vpc_attachment": resourceAlicloudCenTransitRouterVpcAttachment(), - "alicloud_kvstore_instance": resourceAlicloudKvstoreInstance(), - "alicloud_kvstore_backup_policy": resourceAlicloudKVStoreBackupPolicy(), - "alicloud_kvstore_account": resourceAlicloudKvstoreAccount(), - "alicloud_datahub_project": resourceAlicloudDatahubProject(), - "alicloud_datahub_subscription": resourceAlicloudDatahubSubscription(), - "alicloud_datahub_topic": resourceAlicloudDatahubTopic(), - "alicloud_mns_queue": resourceAlicloudMNSQueue(), - "alicloud_mns_topic": resourceAlicloudMNSTopic(), - "alicloud_havip": resourceAlicloudHavip(), - "alicloud_mns_topic_subscription": resourceAlicloudMNSSubscription(), - "alicloud_havip_attachment": resourceAliyunHaVipAttachment(), - "alicloud_api_gateway_api": resourceAliyunApigatewayApi(), - "alicloud_api_gateway_group": resourceAliyunApigatewayGroup(), - "alicloud_api_gateway_app": resourceAliyunApigatewayApp(), - "alicloud_api_gateway_app_attachment": resourceAliyunApigatewayAppAttachment(), - "alicloud_api_gateway_vpc_access": resourceAliyunApigatewayVpc(), - "alicloud_common_bandwidth_package": resourceAlicloudCommonBandwidthPackage(), - "alicloud_common_bandwidth_package_attachment": resourceAliyunCommonBandwidthPackageAttachment(), - "alicloud_drds_instance": resourceAlicloudDRDSInstance(), - "alicloud_elasticsearch_instance": resourceAlicloudElasticsearch(), - "alicloud_cas_certificate": resourceAlicloudSslCertificatesServiceCertificate(), - "alicloud_ddoscoo_instance": resourceAlicloudDdoscooInstance(), - "alicloud_ddosbgp_instance": resourceAlicloudDdosbgpInstance(), - "alicloud_network_acl": resourceAlicloudNetworkAcl(), - "alicloud_network_acl_attachment": resourceAliyunNetworkAclAttachment(), - "alicloud_network_acl_entries": resourceAliyunNetworkAclEntries(), - "alicloud_emr_cluster": resourceAlicloudEmrCluster(), - "alicloud_cloud_connect_network": resourceAlicloudCloudConnectNetwork(), - "alicloud_cloud_connect_network_attachment": resourceAlicloudCloudConnectNetworkAttachment(), - "alicloud_cloud_connect_network_grant": resourceAlicloudCloudConnectNetworkGrant(), - "alicloud_sag_acl": resourceAlicloudSagAcl(), - "alicloud_sag_acl_rule": resourceAlicloudSagAclRule(), - "alicloud_sag_qos": resourceAlicloudSagQos(), - "alicloud_sag_qos_policy": resourceAlicloudSagQosPolicy(), - "alicloud_sag_qos_car": resourceAlicloudSagQosCar(), - "alicloud_sag_snat_entry": resourceAlicloudSagSnatEntry(), - "alicloud_sag_dnat_entry": resourceAlicloudSagDnatEntry(), - "alicloud_sag_client_user": resourceAlicloudSagClientUser(), - "alicloud_yundun_dbaudit_instance": resourceAlicloudDbauditInstance(), - "alicloud_yundun_bastionhost_instance": resourceAlicloudBastionhostInstance(), - "alicloud_bastionhost_instance": resourceAlicloudBastionhostInstance(), - "alicloud_polardb_cluster": resourceAlicloudPolarDBCluster(), - "alicloud_polardb_backup_policy": resourceAlicloudPolarDBBackupPolicy(), - "alicloud_polardb_database": resourceAlicloudPolarDBDatabase(), - "alicloud_polardb_account": resourceAlicloudPolarDBAccount(), - "alicloud_polardb_account_privilege": resourceAlicloudPolarDBAccountPrivilege(), - "alicloud_polardb_endpoint": resourceAlicloudPolarDBEndpoint(), - "alicloud_polardb_endpoint_address": resourceAlicloudPolarDBEndpointAddress(), - "alicloud_hbase_instance": resourceAlicloudHBaseInstance(), - "alicloud_market_order": resourceAlicloudMarketOrder(), - "alicloud_adb_cluster": resourceAlicloudAdbDbCluster(), - "alicloud_adb_backup_policy": resourceAlicloudAdbBackupPolicy(), - "alicloud_adb_account": resourceAlicloudAdbAccount(), - "alicloud_adb_connection": resourceAlicloudAdbConnection(), - "alicloud_cen_flowlog": resourceAlicloudCenFlowlog(), - "alicloud_kms_secret": resourceAlicloudKmsSecret(), - "alicloud_maxcompute_project": resourceAlicloudMaxcomputeProject(), - "alicloud_kms_alias": resourceAlicloudKmsAlias(), - "alicloud_dns_instance": resourceAlicloudAlidnsInstance(), - "alicloud_dns_domain_attachment": resourceAlicloudAlidnsDomainAttachment(), - "alicloud_alidns_domain_attachment": resourceAlicloudAlidnsDomainAttachment(), - "alicloud_edas_application": resourceAlicloudEdasApplication(), - "alicloud_edas_deploy_group": resourceAlicloudEdasDeployGroup(), - "alicloud_edas_application_scale": resourceAlicloudEdasInstanceApplicationAttachment(), - "alicloud_edas_slb_attachment": resourceAlicloudEdasSlbAttachment(), - "alicloud_edas_cluster": resourceAlicloudEdasCluster(), - "alicloud_edas_instance_cluster_attachment": resourceAlicloudEdasInstanceClusterAttachment(), - "alicloud_edas_application_deployment": resourceAlicloudEdasApplicationPackageAttachment(), - "alicloud_dns_domain": resourceAlicloudAlidnsDomain(), - "alicloud_dms_enterprise_instance": resourceAlicloudDmsEnterpriseInstance(), - "alicloud_waf_domain": resourceAlicloudWafDomain(), - "alicloud_cen_route_map": resourceAlicloudCenRouteMap(), - "alicloud_resource_manager_role": resourceAlicloudResourceManagerRole(), - "alicloud_resource_manager_resource_group": resourceAlicloudResourceManagerResourceGroup(), - "alicloud_resource_manager_folder": resourceAlicloudResourceManagerFolder(), - "alicloud_resource_manager_handshake": resourceAlicloudResourceManagerHandshake(), - "alicloud_cen_private_zone": resourceAlicloudCenPrivateZone(), - "alicloud_resource_manager_policy": resourceAlicloudResourceManagerPolicy(), - "alicloud_resource_manager_account": resourceAlicloudResourceManagerAccount(), - "alicloud_waf_instance": resourceAlicloudWafInstance(), - "alicloud_resource_manager_resource_directory": resourceAlicloudResourceManagerResourceDirectory(), - "alicloud_alidns_domain_group": resourceAlicloudAlidnsDomainGroup(), - "alicloud_resource_manager_policy_version": resourceAlicloudResourceManagerPolicyVersion(), - "alicloud_kms_key_version": resourceAlicloudKmsKeyVersion(), - "alicloud_alidns_record": resourceAlicloudAlidnsRecord(), - "alicloud_ddoscoo_scheduler_rule": resourceAlicloudDdoscooSchedulerRule(), - "alicloud_cassandra_cluster": resourceAlicloudCassandraCluster(), - "alicloud_cassandra_data_center": resourceAlicloudCassandraDataCenter(), - "alicloud_cen_vbr_health_check": resourceAlicloudCenVbrHealthCheck(), - "alicloud_eci_openapi_image_cache": resourceAlicloudEciImageCache(), - "alicloud_eci_image_cache": resourceAlicloudEciImageCache(), - "alicloud_dms_enterprise_user": resourceAlicloudDmsEnterpriseUser(), - "alicloud_ecs_dedicated_host": resourceAlicloudEcsDedicatedHost(), - "alicloud_oos_template": resourceAlicloudOosTemplate(), - "alicloud_edas_k8s_cluster": resourceAlicloudEdasK8sCluster(), - "alicloud_oos_execution": resourceAlicloudOosExecution(), - "alicloud_resource_manager_policy_attachment": resourceAlicloudResourceManagerPolicyAttachment(), - "alicloud_dcdn_domain": resourceAlicloudDcdnDomain(), - "alicloud_mse_cluster": resourceAlicloudMseCluster(), - "alicloud_actiontrail_trail": resourceAlicloudActiontrailTrail(), - "alicloud_actiontrail": resourceAlicloudActiontrailTrail(), - "alicloud_alidns_domain": resourceAlicloudAlidnsDomain(), - "alicloud_alidns_instance": resourceAlicloudAlidnsInstance(), - "alicloud_edas_k8s_application": resourceAlicloudEdasK8sApplication(), - "alicloud_config_rule": resourceAlicloudConfigRule(), - "alicloud_config_configuration_recorder": resourceAlicloudConfigConfigurationRecorder(), - "alicloud_config_delivery_channel": resourceAlicloudConfigDeliveryChannel(), - "alicloud_cms_alarm_contact": resourceAlicloudCmsAlarmContact(), - "alicloud_cen_route_service": resourceAlicloudCenRouteService(), - "alicloud_kvstore_connection": resourceAlicloudKvstoreConnection(), - "alicloud_cms_alarm_contact_group": resourceAlicloudCmsAlarmContactGroup(), - "alicloud_cms_group_metric_rule": resourceAlicloudCmsGroupMetricRule(), - "alicloud_fnf_flow": resourceAlicloudFnfFlow(), - "alicloud_fnf_schedule": resourceAlicloudFnfSchedule(), - "alicloud_ros_change_set": resourceAlicloudRosChangeSet(), - "alicloud_ros_stack": resourceAlicloudRosStack(), - "alicloud_ros_stack_group": resourceAlicloudRosStackGroup(), - "alicloud_ros_template": resourceAlicloudRosTemplate(), - "alicloud_privatelink_vpc_endpoint_service": resourceAlicloudPrivatelinkVpcEndpointService(), - "alicloud_privatelink_vpc_endpoint": resourceAlicloudPrivatelinkVpcEndpoint(), - "alicloud_privatelink_vpc_endpoint_connection": resourceAlicloudPrivatelinkVpcEndpointConnection(), - "alicloud_privatelink_vpc_endpoint_service_resource": resourceAlicloudPrivatelinkVpcEndpointServiceResource(), - "alicloud_privatelink_vpc_endpoint_service_user": resourceAlicloudPrivatelinkVpcEndpointServiceUser(), - "alicloud_resource_manager_resource_share": resourceAlicloudResourceManagerResourceShare(), - "alicloud_privatelink_vpc_endpoint_zone": resourceAlicloudPrivatelinkVpcEndpointZone(), - "alicloud_ga_accelerator": resourceAlicloudGaAccelerator(), - "alicloud_eci_container_group": resourceAlicloudEciContainerGroup(), - "alicloud_resource_manager_shared_resource": resourceAlicloudResourceManagerSharedResource(), - "alicloud_resource_manager_shared_target": resourceAlicloudResourceManagerSharedTarget(), - "alicloud_ga_listener": resourceAlicloudGaListener(), - "alicloud_tsdb_instance": resourceAlicloudTsdbInstance(), - "alicloud_ga_bandwidth_package": resourceAlicloudGaBandwidthPackage(), - "alicloud_ga_endpoint_group": resourceAlicloudGaEndpointGroup(), - "alicloud_brain_industrial_pid_organization": resourceAlicloudBrainIndustrialPidOrganization(), - "alicloud_ga_bandwidth_package_attachment": resourceAlicloudGaBandwidthPackageAttachment(), - "alicloud_ga_ip_set": resourceAlicloudGaIpSet(), - "alicloud_ga_forwarding_rule": resourceAlicloudGaForwardingRule(), - "alicloud_eipanycast_anycast_eip_address": resourceAlicloudEipanycastAnycastEipAddress(), - "alicloud_brain_industrial_pid_project": resourceAlicloudBrainIndustrialPidProject(), - "alicloud_cms_monitor_group": resourceAlicloudCmsMonitorGroup(), - "alicloud_eipanycast_anycast_eip_address_attachment": resourceAlicloudEipanycastAnycastEipAddressAttachment(), - "alicloud_ram_saml_provider": resourceAlicloudRamSamlProvider(), - "alicloud_quotas_application_info": resourceAlicloudQuotasQuotaApplication(), - "alicloud_cms_monitor_group_instances": resourceAlicloudCmsMonitorGroupInstances(), - "alicloud_quotas_quota_alarm": resourceAlicloudQuotasQuotaAlarm(), - "alicloud_ecs_command": resourceAlicloudEcsCommand(), - "alicloud_cloud_storage_gateway_storage_bundle": resourceAlicloudCloudStorageGatewayStorageBundle(), - "alicloud_ecs_hpc_cluster": resourceAlicloudEcsHpcCluster(), - "alicloud_vpc_flow_log": resourceAlicloudVpcFlowLog(), - "alicloud_brain_industrial_pid_loop": resourceAlicloudBrainIndustrialPidLoop(), - "alicloud_quotas_quota_application": resourceAlicloudQuotasQuotaApplication(), - "alicloud_ecs_auto_snapshot_policy": resourceAlicloudEcsAutoSnapshotPolicy(), - "alicloud_rds_parameter_group": resourceAlicloudRdsParameterGroup(), - "alicloud_ecs_launch_template": resourceAlicloudEcsLaunchTemplate(), - "alicloud_resource_manager_control_policy": resourceAlicloudResourceManagerControlPolicy(), - "alicloud_resource_manager_control_policy_attachment": resourceAlicloudResourceManagerControlPolicyAttachment(), - "alicloud_rds_account": resourceAlicloudRdsAccount(), - "alicloud_ecs_snapshot": resourceAlicloudEcsSnapshot(), - "alicloud_ecs_key_pair": resourceAlicloudEcsKeyPair(), - "alicloud_ecs_key_pair_attachment": resourceAlicloudEcsKeyPairAttachment(), - "alicloud_adb_db_cluster": resourceAlicloudAdbDbCluster(), - "alicloud_ecs_disk": resourceAlicloudEcsDisk(), - "alicloud_ecs_disk_attachment": resourceAlicloudEcsDiskAttachment(), - "alicloud_ecs_auto_snapshot_policy_attachment": resourceAlicloudEcsAutoSnapshotPolicyAttachment(), - "alicloud_ddoscoo_domain_resource": resourceAlicloudDdoscooDomainResource(), - "alicloud_ddoscoo_port": resourceAlicloudDdoscooPort(), - "alicloud_slb_load_balancer": resourceAlicloudSlbLoadBalancer(), - "alicloud_ecs_network_interface": resourceAlicloudEcsNetworkInterface(), - "alicloud_ecs_network_interface_attachment": resourceAlicloudEcsNetworkInterfaceAttachment(), - "alicloud_config_aggregator": resourceAlicloudConfigAggregator(), - "alicloud_config_aggregate_config_rule": resourceAlicloudConfigAggregateConfigRule(), - "alicloud_config_aggregate_compliance_pack": resourceAlicloudConfigAggregateCompliancePack(), - "alicloud_config_compliance_pack": resourceAlicloudConfigCompliancePack(), - "alicloud_direct_mail_receivers": resourceAlicloudDirectMailReceivers(), - "alicloud_eip_address": resourceAlicloudEipAddress(), - "alicloud_event_bridge_event_bus": resourceAlicloudEventBridgeEventBus(), - "alicloud_amqp_virtual_host": resourceAlicloudAmqpVirtualHost(), - "alicloud_amqp_queue": resourceAlicloudAmqpQueue(), - "alicloud_amqp_exchange": resourceAlicloudAmqpExchange(), - "alicloud_cassandra_backup_plan": resourceAlicloudCassandraBackupPlan(), - "alicloud_cen_transit_router_peer_attachment": resourceAlicloudCenTransitRouterPeerAttachment(), - "alicloud_amqp_instance": resourceAlicloudAmqpInstance(), - "alicloud_hbr_vault": resourceAlicloudHbrVault(), - "alicloud_ssl_certificates_service_certificate": resourceAlicloudSslCertificatesServiceCertificate(), - "alicloud_arms_alert_contact": resourceAlicloudArmsAlertContact(), - "alicloud_event_bridge_slr": resourceAlicloudEventBridgeSlr(), - "alicloud_event_bridge_rule": resourceAlicloudEventBridgeRule(), - "alicloud_cloud_firewall_control_policy": resourceAlicloudCloudFirewallControlPolicy(), - "alicloud_sae_namespace": resourceAlicloudSaeNamespace(), - "alicloud_sae_config_map": resourceAlicloudSaeConfigMap(), - "alicloud_alb_security_policy": resourceAlicloudAlbSecurityPolicy(), - "alicloud_kvstore_audit_log_config": resourceAlicloudKvstoreAuditLogConfig(), - "alicloud_event_bridge_event_source": resourceAlicloudEventBridgeEventSource(), - "alicloud_cloud_firewall_control_policy_order": resourceAlicloudCloudFirewallControlPolicyOrder(), - "alicloud_ecd_policy_group": resourceAlicloudEcdPolicyGroup(), - "alicloud_ecp_key_pair": resourceAlicloudEcpKeyPair(), - "alicloud_hbr_ecs_backup_plan": resourceAlicloudHbrEcsBackupPlan(), - "alicloud_hbr_nas_backup_plan": resourceAlicloudHbrNasBackupPlan(), - "alicloud_hbr_oss_backup_plan": resourceAlicloudHbrOssBackupPlan(), - "alicloud_scdn_domain": resourceAlicloudScdnDomain(), - "alicloud_alb_server_group": resourceAlicloudAlbServerGroup(), - "alicloud_data_works_folder": resourceAlicloudDataWorksFolder(), - "alicloud_arms_alert_contact_group": resourceAlicloudArmsAlertContactGroup(), - "alicloud_dcdn_domain_config": resourceAlicloudDcdnDomainConfig(), - "alicloud_scdn_domain_config": resourceAlicloudScdnDomainConfig(), - "alicloud_cloud_storage_gateway_gateway": resourceAlicloudCloudStorageGatewayGateway(), - "alicloud_lindorm_instance": resourceAlicloudLindormInstance(), - "alicloud_cddc_dedicated_host_group": resourceAlicloudCddcDedicatedHostGroup(), - "alicloud_hbr_ecs_backup_client": resourceAlicloudHbrEcsBackupClient(), - "alicloud_msc_sub_contact": resourceAlicloudMscSubContact(), - "alicloud_express_connect_physical_connection": resourceAlicloudExpressConnectPhysicalConnection(), - "alicloud_alb_load_balancer": resourceAlicloudAlbLoadBalancer(), - "alicloud_sddp_rule": resourceAlicloudSddpRule(), - "alicloud_bastionhost_user_group": resourceAlicloudBastionhostUserGroup(), + "alicloud_ram_alias": resourceAlicloudRamAccountAlias(), + "alicloud_ram_account_alias": resourceAlicloudRamAccountAlias(), + "alicloud_ram_group_membership": resourceAlicloudRamGroupMembership(), + "alicloud_ram_user_policy_attachment": resourceAlicloudRamUserPolicyAtatchment(), + "alicloud_ram_role_policy_attachment": resourceAlicloudRamRolePolicyAttachment(), + "alicloud_ram_group_policy_attachment": resourceAlicloudRamGroupPolicyAtatchment(), + "alicloud_container_cluster": resourceAlicloudCSSwarm(), + "alicloud_cs_application": resourceAlicloudCSApplication(), + "alicloud_cs_swarm": resourceAlicloudCSSwarm(), + "alicloud_cs_kubernetes": resourceAlicloudCSKubernetes(), + "alicloud_cs_kubernetes_addon": resourceAlicloudCSKubernetesAddon(), + "alicloud_cs_managed_kubernetes": resourceAlicloudCSManagedKubernetes(), + "alicloud_cs_edge_kubernetes": resourceAlicloudCSEdgeKubernetes(), + "alicloud_cs_serverless_kubernetes": resourceAlicloudCSServerlessKubernetes(), + "alicloud_cs_kubernetes_autoscaler": resourceAlicloudCSKubernetesAutoscaler(), + "alicloud_cs_kubernetes_node_pool": resourceAlicloudCSKubernetesNodePool(), + "alicloud_cs_kubernetes_permissions": resourceAlicloudCSKubernetesPermissions(), + "alicloud_cs_autoscaling_config": resourceAlicloudCSAutoscalingConfig(), + "alicloud_cr_namespace": resourceAlicloudCRNamespace(), + "alicloud_cr_repo": resourceAlicloudCRRepo(), + "alicloud_cr_ee_instance": resourceAlicloudCrEEInstance(), + "alicloud_cr_ee_namespace": resourceAlicloudCrEENamespace(), + "alicloud_cr_ee_repo": resourceAlicloudCrEERepo(), + "alicloud_cr_ee_sync_rule": resourceAlicloudCrEESyncRule(), + "alicloud_cdn_domain": resourceAlicloudCdnDomain(), + "alicloud_cdn_domain_new": resourceAlicloudCdnDomainNew(), + "alicloud_cdn_domain_config": resourceAlicloudCdnDomainConfig(), + "alicloud_router_interface": resourceAlicloudRouterInterface(), + "alicloud_router_interface_connection": resourceAlicloudRouterInterfaceConnection(), + "alicloud_ots_table": resourceAlicloudOtsTable(), + "alicloud_ots_instance": resourceAlicloudOtsInstance(), + "alicloud_ots_instance_attachment": resourceAlicloudOtsInstanceAttachment(), + "alicloud_cms_alarm": resourceAlicloudCmsAlarm(), + "alicloud_cms_site_monitor": resourceAlicloudCmsSiteMonitor(), + "alicloud_pvtz_zone": resourceAlicloudPvtzZone(), + "alicloud_pvtz_zone_attachment": resourceAlicloudPvtzZoneAttachment(), + "alicloud_pvtz_zone_record": resourceAlicloudPvtzZoneRecord(), + "alicloud_log_alert": resourceAlicloudLogAlert(), + "alicloud_log_audit": resourceAlicloudLogAudit(), + "alicloud_log_dashboard": resourceAlicloudLogDashboard(), + "alicloud_log_etl": resourceAlicloudLogETL(), + "alicloud_log_machine_group": resourceAlicloudLogMachineGroup(), + "alicloud_log_oss_shipper": resourceAlicloudLogOssShipper(), + "alicloud_log_project": resourceAlicloudLogProject(), + "alicloud_log_store": resourceAlicloudLogStore(), + "alicloud_log_store_index": resourceAlicloudLogStoreIndex(), + "alicloud_logtail_config": resourceAlicloudLogtailConfig(), + "alicloud_logtail_attachment": resourceAlicloudLogtailAttachment(), + "alicloud_fc_service": resourceAlicloudFCService(), + "alicloud_fc_function": resourceAlicloudFCFunction(), + "alicloud_fc_trigger": resourceAlicloudFCTrigger(), + "alicloud_fc_alias": resourceAlicloudFCAlias(), + "alicloud_fc_custom_domain": resourceAlicloudFCCustomDomain(), + "alicloud_fc_function_async_invoke_config": resourceAlicloudFCFunctionAsyncInvokeConfig(), + "alicloud_vpn_gateway": resourceAliyunVpnGateway(), + "alicloud_vpn_customer_gateway": resourceAliyunVpnCustomerGateway(), + "alicloud_vpn_route_entry": resourceAliyunVpnRouteEntry(), + "alicloud_vpn_connection": resourceAliyunVpnConnection(), + "alicloud_ssl_vpn_server": resourceAliyunSslVpnServer(), + "alicloud_ssl_vpn_client_cert": resourceAliyunSslVpnClientCert(), + "alicloud_cen_instance": resourceAlicloudCenInstance(), + "alicloud_cen_instance_attachment": resourceAlicloudCenInstanceAttachment(), + "alicloud_cen_bandwidth_package": resourceAlicloudCenBandwidthPackage(), + "alicloud_cen_bandwidth_package_attachment": resourceAlicloudCenBandwidthPackageAttachment(), + "alicloud_cen_bandwidth_limit": resourceAlicloudCenBandwidthLimit(), + "alicloud_cen_route_entry": resourceAlicloudCenRouteEntry(), + "alicloud_cen_instance_grant": resourceAlicloudCenInstanceGrant(), + "alicloud_cen_transit_router": resourceAlicloudCenTransitRouter(), + "alicloud_cen_transit_router_route_entry": resourceAlicloudCenTransitRouterRouteEntry(), + "alicloud_cen_transit_router_route_table": resourceAlicloudCenTransitRouterRouteTable(), + "alicloud_cen_transit_router_route_table_association": resourceAlicloudCenTransitRouterRouteTableAssociation(), + "alicloud_cen_transit_router_route_table_propagation": resourceAlicloudCenTransitRouterRouteTablePropagation(), + "alicloud_cen_transit_router_vbr_attachment": resourceAlicloudCenTransitRouterVbrAttachment(), + "alicloud_cen_transit_router_vpc_attachment": resourceAlicloudCenTransitRouterVpcAttachment(), + "alicloud_kvstore_instance": resourceAlicloudKvstoreInstance(), + "alicloud_kvstore_backup_policy": resourceAlicloudKVStoreBackupPolicy(), + "alicloud_kvstore_account": resourceAlicloudKvstoreAccount(), + "alicloud_datahub_project": resourceAlicloudDatahubProject(), + "alicloud_datahub_subscription": resourceAlicloudDatahubSubscription(), + "alicloud_datahub_topic": resourceAlicloudDatahubTopic(), + "alicloud_mns_queue": resourceAlicloudMNSQueue(), + "alicloud_mns_topic": resourceAlicloudMNSTopic(), + "alicloud_havip": resourceAlicloudHavip(), + "alicloud_mns_topic_subscription": resourceAlicloudMNSSubscription(), + "alicloud_havip_attachment": resourceAliyunHaVipAttachment(), + "alicloud_api_gateway_api": resourceAliyunApigatewayApi(), + "alicloud_api_gateway_group": resourceAliyunApigatewayGroup(), + "alicloud_api_gateway_app": resourceAliyunApigatewayApp(), + "alicloud_api_gateway_app_attachment": resourceAliyunApigatewayAppAttachment(), + "alicloud_api_gateway_vpc_access": resourceAliyunApigatewayVpc(), + "alicloud_common_bandwidth_package": resourceAlicloudCommonBandwidthPackage(), + "alicloud_common_bandwidth_package_attachment": resourceAliyunCommonBandwidthPackageAttachment(), + "alicloud_drds_instance": resourceAlicloudDRDSInstance(), + "alicloud_elasticsearch_instance": resourceAlicloudElasticsearch(), + "alicloud_cas_certificate": resourceAlicloudSslCertificatesServiceCertificate(), + "alicloud_ddoscoo_instance": resourceAlicloudDdoscooInstance(), + "alicloud_ddosbgp_instance": resourceAlicloudDdosbgpInstance(), + "alicloud_network_acl": resourceAlicloudNetworkAcl(), + "alicloud_network_acl_attachment": resourceAliyunNetworkAclAttachment(), + "alicloud_network_acl_entries": resourceAliyunNetworkAclEntries(), + "alicloud_emr_cluster": resourceAlicloudEmrCluster(), + "alicloud_cloud_connect_network": resourceAlicloudCloudConnectNetwork(), + "alicloud_cloud_connect_network_attachment": resourceAlicloudCloudConnectNetworkAttachment(), + "alicloud_cloud_connect_network_grant": resourceAlicloudCloudConnectNetworkGrant(), + "alicloud_sag_acl": resourceAlicloudSagAcl(), + "alicloud_sag_acl_rule": resourceAlicloudSagAclRule(), + "alicloud_sag_qos": resourceAlicloudSagQos(), + "alicloud_sag_qos_policy": resourceAlicloudSagQosPolicy(), + "alicloud_sag_qos_car": resourceAlicloudSagQosCar(), + "alicloud_sag_snat_entry": resourceAlicloudSagSnatEntry(), + "alicloud_sag_dnat_entry": resourceAlicloudSagDnatEntry(), + "alicloud_sag_client_user": resourceAlicloudSagClientUser(), + "alicloud_yundun_dbaudit_instance": resourceAlicloudDbauditInstance(), + "alicloud_yundun_bastionhost_instance": resourceAlicloudBastionhostInstance(), + "alicloud_bastionhost_instance": resourceAlicloudBastionhostInstance(), + "alicloud_polardb_cluster": resourceAlicloudPolarDBCluster(), + "alicloud_polardb_backup_policy": resourceAlicloudPolarDBBackupPolicy(), + "alicloud_polardb_database": resourceAlicloudPolarDBDatabase(), + "alicloud_polardb_account": resourceAlicloudPolarDBAccount(), + "alicloud_polardb_account_privilege": resourceAlicloudPolarDBAccountPrivilege(), + "alicloud_polardb_endpoint": resourceAlicloudPolarDBEndpoint(), + "alicloud_polardb_endpoint_address": resourceAlicloudPolarDBEndpointAddress(), + "alicloud_hbase_instance": resourceAlicloudHBaseInstance(), + "alicloud_market_order": resourceAlicloudMarketOrder(), + "alicloud_adb_cluster": resourceAlicloudAdbDbCluster(), + "alicloud_adb_backup_policy": resourceAlicloudAdbBackupPolicy(), + "alicloud_adb_account": resourceAlicloudAdbAccount(), + "alicloud_adb_connection": resourceAlicloudAdbConnection(), + "alicloud_cen_flowlog": resourceAlicloudCenFlowlog(), + "alicloud_kms_secret": resourceAlicloudKmsSecret(), + "alicloud_maxcompute_project": resourceAlicloudMaxcomputeProject(), + "alicloud_kms_alias": resourceAlicloudKmsAlias(), + "alicloud_dns_instance": resourceAlicloudAlidnsInstance(), + "alicloud_dns_domain_attachment": resourceAlicloudAlidnsDomainAttachment(), + "alicloud_alidns_domain_attachment": resourceAlicloudAlidnsDomainAttachment(), + "alicloud_edas_application": resourceAlicloudEdasApplication(), + "alicloud_edas_deploy_group": resourceAlicloudEdasDeployGroup(), + "alicloud_edas_application_scale": resourceAlicloudEdasInstanceApplicationAttachment(), + "alicloud_edas_slb_attachment": resourceAlicloudEdasSlbAttachment(), + "alicloud_edas_cluster": resourceAlicloudEdasCluster(), + "alicloud_edas_instance_cluster_attachment": resourceAlicloudEdasInstanceClusterAttachment(), + "alicloud_edas_application_deployment": resourceAlicloudEdasApplicationPackageAttachment(), + "alicloud_dns_domain": resourceAlicloudAlidnsDomain(), + "alicloud_dms_enterprise_instance": resourceAlicloudDmsEnterpriseInstance(), + "alicloud_waf_domain": resourceAlicloudWafDomain(), + "alicloud_cen_route_map": resourceAlicloudCenRouteMap(), + "alicloud_resource_manager_role": resourceAlicloudResourceManagerRole(), + "alicloud_resource_manager_resource_group": resourceAlicloudResourceManagerResourceGroup(), + "alicloud_resource_manager_folder": resourceAlicloudResourceManagerFolder(), + "alicloud_resource_manager_handshake": resourceAlicloudResourceManagerHandshake(), + "alicloud_cen_private_zone": resourceAlicloudCenPrivateZone(), + "alicloud_resource_manager_policy": resourceAlicloudResourceManagerPolicy(), + "alicloud_resource_manager_account": resourceAlicloudResourceManagerAccount(), + "alicloud_waf_instance": resourceAlicloudWafInstance(), + "alicloud_resource_manager_resource_directory": resourceAlicloudResourceManagerResourceDirectory(), + "alicloud_alidns_domain_group": resourceAlicloudAlidnsDomainGroup(), + "alicloud_resource_manager_policy_version": resourceAlicloudResourceManagerPolicyVersion(), + "alicloud_kms_key_version": resourceAlicloudKmsKeyVersion(), + "alicloud_alidns_record": resourceAlicloudAlidnsRecord(), + "alicloud_ddoscoo_scheduler_rule": resourceAlicloudDdoscooSchedulerRule(), + "alicloud_cassandra_cluster": resourceAlicloudCassandraCluster(), + "alicloud_cassandra_data_center": resourceAlicloudCassandraDataCenter(), + "alicloud_cen_vbr_health_check": resourceAlicloudCenVbrHealthCheck(), + "alicloud_eci_openapi_image_cache": resourceAlicloudEciImageCache(), + "alicloud_eci_image_cache": resourceAlicloudEciImageCache(), + "alicloud_dms_enterprise_user": resourceAlicloudDmsEnterpriseUser(), + "alicloud_ecs_dedicated_host": resourceAlicloudEcsDedicatedHost(), + "alicloud_oos_template": resourceAlicloudOosTemplate(), + "alicloud_edas_k8s_cluster": resourceAlicloudEdasK8sCluster(), + "alicloud_oos_execution": resourceAlicloudOosExecution(), + "alicloud_resource_manager_policy_attachment": resourceAlicloudResourceManagerPolicyAttachment(), + "alicloud_dcdn_domain": resourceAlicloudDcdnDomain(), + "alicloud_mse_cluster": resourceAlicloudMseCluster(), + "alicloud_actiontrail_trail": resourceAlicloudActiontrailTrail(), + "alicloud_actiontrail": resourceAlicloudActiontrailTrail(), + "alicloud_alidns_domain": resourceAlicloudAlidnsDomain(), + "alicloud_alidns_instance": resourceAlicloudAlidnsInstance(), + "alicloud_edas_k8s_application": resourceAlicloudEdasK8sApplication(), + "alicloud_config_rule": resourceAlicloudConfigRule(), + "alicloud_config_configuration_recorder": resourceAlicloudConfigConfigurationRecorder(), + "alicloud_config_delivery_channel": resourceAlicloudConfigDeliveryChannel(), + "alicloud_cms_alarm_contact": resourceAlicloudCmsAlarmContact(), + "alicloud_cen_route_service": resourceAlicloudCenRouteService(), + "alicloud_kvstore_connection": resourceAlicloudKvstoreConnection(), + "alicloud_cms_alarm_contact_group": resourceAlicloudCmsAlarmContactGroup(), + "alicloud_cms_group_metric_rule": resourceAlicloudCmsGroupMetricRule(), + "alicloud_fnf_flow": resourceAlicloudFnfFlow(), + "alicloud_fnf_schedule": resourceAlicloudFnfSchedule(), + "alicloud_ros_change_set": resourceAlicloudRosChangeSet(), + "alicloud_ros_stack": resourceAlicloudRosStack(), + "alicloud_ros_stack_group": resourceAlicloudRosStackGroup(), + "alicloud_ros_template": resourceAlicloudRosTemplate(), + "alicloud_privatelink_vpc_endpoint_service": resourceAlicloudPrivatelinkVpcEndpointService(), + "alicloud_privatelink_vpc_endpoint": resourceAlicloudPrivatelinkVpcEndpoint(), + "alicloud_privatelink_vpc_endpoint_connection": resourceAlicloudPrivatelinkVpcEndpointConnection(), + "alicloud_privatelink_vpc_endpoint_service_resource": resourceAlicloudPrivatelinkVpcEndpointServiceResource(), + "alicloud_privatelink_vpc_endpoint_service_user": resourceAlicloudPrivatelinkVpcEndpointServiceUser(), + "alicloud_resource_manager_resource_share": resourceAlicloudResourceManagerResourceShare(), + "alicloud_privatelink_vpc_endpoint_zone": resourceAlicloudPrivatelinkVpcEndpointZone(), + "alicloud_ga_accelerator": resourceAlicloudGaAccelerator(), + "alicloud_eci_container_group": resourceAlicloudEciContainerGroup(), + "alicloud_resource_manager_shared_resource": resourceAlicloudResourceManagerSharedResource(), + "alicloud_resource_manager_shared_target": resourceAlicloudResourceManagerSharedTarget(), + "alicloud_ga_listener": resourceAlicloudGaListener(), + "alicloud_tsdb_instance": resourceAlicloudTsdbInstance(), + "alicloud_ga_bandwidth_package": resourceAlicloudGaBandwidthPackage(), + "alicloud_ga_endpoint_group": resourceAlicloudGaEndpointGroup(), + "alicloud_brain_industrial_pid_organization": resourceAlicloudBrainIndustrialPidOrganization(), + "alicloud_ga_bandwidth_package_attachment": resourceAlicloudGaBandwidthPackageAttachment(), + "alicloud_ga_ip_set": resourceAlicloudGaIpSet(), + "alicloud_ga_forwarding_rule": resourceAlicloudGaForwardingRule(), + "alicloud_eipanycast_anycast_eip_address": resourceAlicloudEipanycastAnycastEipAddress(), + "alicloud_brain_industrial_pid_project": resourceAlicloudBrainIndustrialPidProject(), + "alicloud_cms_monitor_group": resourceAlicloudCmsMonitorGroup(), + "alicloud_eipanycast_anycast_eip_address_attachment": resourceAlicloudEipanycastAnycastEipAddressAttachment(), + "alicloud_ram_saml_provider": resourceAlicloudRamSamlProvider(), + "alicloud_quotas_application_info": resourceAlicloudQuotasQuotaApplication(), + "alicloud_cms_monitor_group_instances": resourceAlicloudCmsMonitorGroupInstances(), + "alicloud_quotas_quota_alarm": resourceAlicloudQuotasQuotaAlarm(), + "alicloud_ecs_command": resourceAlicloudEcsCommand(), + "alicloud_cloud_storage_gateway_storage_bundle": resourceAlicloudCloudStorageGatewayStorageBundle(), + "alicloud_ecs_hpc_cluster": resourceAlicloudEcsHpcCluster(), + "alicloud_vpc_flow_log": resourceAlicloudVpcFlowLog(), + "alicloud_brain_industrial_pid_loop": resourceAlicloudBrainIndustrialPidLoop(), + "alicloud_quotas_quota_application": resourceAlicloudQuotasQuotaApplication(), + "alicloud_ecs_auto_snapshot_policy": resourceAlicloudEcsAutoSnapshotPolicy(), + "alicloud_rds_parameter_group": resourceAlicloudRdsParameterGroup(), + "alicloud_ecs_launch_template": resourceAlicloudEcsLaunchTemplate(), + "alicloud_resource_manager_control_policy": resourceAlicloudResourceManagerControlPolicy(), + "alicloud_resource_manager_control_policy_attachment": resourceAlicloudResourceManagerControlPolicyAttachment(), + "alicloud_rds_account": resourceAlicloudRdsAccount(), + "alicloud_ecs_snapshot": resourceAlicloudEcsSnapshot(), + "alicloud_ecs_key_pair": resourceAlicloudEcsKeyPair(), + "alicloud_ecs_key_pair_attachment": resourceAlicloudEcsKeyPairAttachment(), + "alicloud_adb_db_cluster": resourceAlicloudAdbDbCluster(), + "alicloud_ecs_disk": resourceAlicloudEcsDisk(), + "alicloud_ecs_disk_attachment": resourceAlicloudEcsDiskAttachment(), + "alicloud_ecs_auto_snapshot_policy_attachment": resourceAlicloudEcsAutoSnapshotPolicyAttachment(), + "alicloud_ddoscoo_domain_resource": resourceAlicloudDdoscooDomainResource(), + "alicloud_ddoscoo_port": resourceAlicloudDdoscooPort(), + "alicloud_slb_load_balancer": resourceAlicloudSlbLoadBalancer(), + "alicloud_ecs_network_interface": resourceAlicloudEcsNetworkInterface(), + "alicloud_ecs_network_interface_attachment": resourceAlicloudEcsNetworkInterfaceAttachment(), + "alicloud_config_aggregator": resourceAlicloudConfigAggregator(), + "alicloud_config_aggregate_config_rule": resourceAlicloudConfigAggregateConfigRule(), + "alicloud_config_aggregate_compliance_pack": resourceAlicloudConfigAggregateCompliancePack(), + "alicloud_config_compliance_pack": resourceAlicloudConfigCompliancePack(), + "alicloud_direct_mail_receivers": resourceAlicloudDirectMailReceivers(), + "alicloud_eip_address": resourceAlicloudEipAddress(), + "alicloud_event_bridge_event_bus": resourceAlicloudEventBridgeEventBus(), + "alicloud_amqp_virtual_host": resourceAlicloudAmqpVirtualHost(), + "alicloud_amqp_queue": resourceAlicloudAmqpQueue(), + "alicloud_amqp_exchange": resourceAlicloudAmqpExchange(), + "alicloud_cassandra_backup_plan": resourceAlicloudCassandraBackupPlan(), + "alicloud_cen_transit_router_peer_attachment": resourceAlicloudCenTransitRouterPeerAttachment(), + "alicloud_amqp_instance": resourceAlicloudAmqpInstance(), + "alicloud_hbr_vault": resourceAlicloudHbrVault(), + "alicloud_ssl_certificates_service_certificate": resourceAlicloudSslCertificatesServiceCertificate(), + "alicloud_arms_alert_contact": resourceAlicloudArmsAlertContact(), + "alicloud_event_bridge_slr": resourceAlicloudEventBridgeServiceLinkedRole(), + "alicloud_event_bridge_rule": resourceAlicloudEventBridgeRule(), + "alicloud_cloud_firewall_control_policy": resourceAlicloudCloudFirewallControlPolicy(), + "alicloud_sae_namespace": resourceAlicloudSaeNamespace(), + "alicloud_sae_config_map": resourceAlicloudSaeConfigMap(), + "alicloud_alb_security_policy": resourceAlicloudAlbSecurityPolicy(), + "alicloud_kvstore_audit_log_config": resourceAlicloudKvstoreAuditLogConfig(), + "alicloud_event_bridge_event_source": resourceAlicloudEventBridgeEventSource(), + "alicloud_cloud_firewall_control_policy_order": resourceAlicloudCloudFirewallControlPolicyOrder(), + "alicloud_ecd_policy_group": resourceAlicloudEcdPolicyGroup(), + "alicloud_ecp_key_pair": resourceAlicloudEcpKeyPair(), + "alicloud_hbr_ecs_backup_plan": resourceAlicloudHbrEcsBackupPlan(), + "alicloud_hbr_nas_backup_plan": resourceAlicloudHbrNasBackupPlan(), + "alicloud_hbr_oss_backup_plan": resourceAlicloudHbrOssBackupPlan(), + "alicloud_scdn_domain": resourceAlicloudScdnDomain(), + "alicloud_alb_server_group": resourceAlicloudAlbServerGroup(), + "alicloud_data_works_folder": resourceAlicloudDataWorksFolder(), + "alicloud_arms_alert_contact_group": resourceAlicloudArmsAlertContactGroup(), + "alicloud_dcdn_domain_config": resourceAlicloudDcdnDomainConfig(), + "alicloud_scdn_domain_config": resourceAlicloudScdnDomainConfig(), + "alicloud_cloud_storage_gateway_gateway": resourceAlicloudCloudStorageGatewayGateway(), + "alicloud_lindorm_instance": resourceAlicloudLindormInstance(), + "alicloud_cddc_dedicated_host_group": resourceAlicloudCddcDedicatedHostGroup(), + "alicloud_hbr_ecs_backup_client": resourceAlicloudHbrEcsBackupClient(), + "alicloud_msc_sub_contact": resourceAlicloudMscSubContact(), + "alicloud_express_connect_physical_connection": resourceAlicloudExpressConnectPhysicalConnection(), + "alicloud_alb_load_balancer": resourceAlicloudAlbLoadBalancer(), + "alicloud_sddp_rule": resourceAlicloudSddpRule(), + "alicloud_bastionhost_user_group": resourceAlicloudBastionhostUserGroup(), + "alicloud_security_center_group": resourceAlicloudSecurityCenterGroup(), + "alicloud_alb_acl": resourceAlicloudAlbAcl(), + "alicloud_bastionhost_user": resourceAlicloudBastionhostUser(), + "alicloud_dfs_access_group": resourceAlicloudDfsAccessGroup(), + "alicloud_ehpc_job_template": resourceAlicloudEhpcJobTemplate(), + "alicloud_sddp_config": resourceAlicloudSddpConfig(), + "alicloud_hbr_restore_job": resourceAlicloudHbrRestoreJob(), + "alicloud_alb_listener": resourceAlicloudAlbListener(), + "alicloud_ens_key_pair": resourceAlicloudEnsKeyPair(), + "alicloud_sae_application": resourceAlicloudSaeApplication(), + "alicloud_alb_rule": resourceAlicloudAlbRule(), + "alicloud_cms_metric_rule_template": resourceAlicloudCmsMetricRuleTemplate(), + "alicloud_iot_device_group": resourceAlicloudIotDeviceGroup(), + "alicloud_express_connect_virtual_border_router": resourceAlicloudExpressConnectVirtualBorderRouter(), + "alicloud_imm_project": resourceAlicloudImmProject(), + "alicloud_click_house_db_cluster": resourceAlicloudClickHouseDbCluster(), + "alicloud_direct_mail_domain": resourceAlicloudDirectMailDomain(), + "alicloud_bastionhost_host_group": resourceAlicloudBastionhostHostGroup(), + "alicloud_vpc_dhcp_options_set": resourceAlicloudVpcDhcpOptionsSet(), + "alicloud_alb_health_check_template": resourceAlicloudAlbHealthCheckTemplate(), + "alicloud_cdn_real_time_log_delivery": resourceAlicloudCdnRealTimeLogDelivery(), + "alicloud_click_house_account": resourceAlicloudClickHouseAccount(), + "alicloud_bastionhost_user_attachment": resourceAlicloudBastionhostUserAttachment(), + "alicloud_direct_mail_mail_address": resourceAlicloudDirectMailMailAddress(), + "alicloud_dts_job_monitor_rule": resourceAlicloudDtsJobMonitorRule(), + "alicloud_database_gateway_gateway": resourceAlicloudDatabaseGatewayGateway(), + "alicloud_bastionhost_host": resourceAlicloudBastionhostHost(), + "alicloud_amqp_binding": resourceAlicloudAmqpBinding(), + "alicloud_slb_tls_cipher_policy": resourceAlicloudSlbTlsCipherPolicy(), + "alicloud_cloud_sso_directory": resourceAlicloudCloudSsoDirectory(), + "alicloud_bastionhost_host_account": resourceAlicloudBastionhostHostAccount(), + "alicloud_bastionhost_host_attachment": resourceAlicloudBastionhostHostAttachment(), + "alicloud_bastionhost_host_account_user_group_attachment": resourceAlicloudBastionhostHostAccountUserGroupAttachment(), + "alicloud_bastionhost_host_account_user_attachment": resourceAlicloudBastionhostHostAccountUserAttachment(), + "alicloud_bastionhost_host_group_account_user_attachment": resourceAlicloudBastionhostHostGroupAccountUserAttachment(), + "alicloud_bastionhost_host_group_account_user_group_attachment": resourceAlicloudBastionhostHostGroupAccountUserGroupAttachment(), + "alicloud_waf_certificate": resourceAlicloudWafCertificate(), + "alicloud_simple_application_server_instance": resourceAlicloudSimpleApplicationServerInstance(), + "alicloud_video_surveillance_system_group": resourceAlicloudVideoSurveillanceSystemGroup(), + "alicloud_msc_sub_subscription": resourceAlicloudMscSubSubscription(), + "alicloud_sddp_instance": resourceAlicloudSddpInstance(), + "alicloud_vpc_nat_ip_cidr": resourceAlicloudVpcNatIpCidr(), + "alicloud_vpc_nat_ip": resourceAlicloudVpcNatIp(), + "alicloud_quick_bi_user": resourceAlicloudQuickBiUser(), + "alicloud_vod_domain": resourceAlicloudVodDomain(), + "alicloud_arms_dispatch_rule": resourceAlicloudArmsDispatchRule(), + "alicloud_open_search_app_group": resourceAlicloudOpenSearchAppGroup(), + "alicloud_graph_database_db_instance": resourceAlicloudGraphDatabaseDbInstance(), + "alicloud_arms_prometheus_alert_rule": resourceAlicloudArmsPrometheusAlertRule(), + "alicloud_dbfs_instance": resourceAlicloudDbfsInstance(), + "alicloud_rdc_organization": resourceAlicloudRdcOrganization(), + "alicloud_eais_instance": resourceAlicloudEaisInstance(), + "alicloud_sae_ingress": resourceAlicloudSaeIngress(), + "alicloud_cloudauth_face_config": resourceAlicloudCloudauthFaceConfig(), + "alicloud_imp_app_template": resourceAlicloudImpAppTemplate(), + "alicloud_pvtz_user_vpc_authorization": resourceAlicloudPvtzUserVpcAuthorization(), + "alicloud_mhub_product": resourceAlicloudMhubProduct(), + "alicloud_cloud_sso_scim_server_credential": resourceAlicloudCloudSsoScimServerCredential(), + "alicloud_dts_subscription_job": resourceAlicloudDtsSubscriptionJob(), + "alicloud_service_mesh_service_mesh": resourceAlicloudServiceMeshServiceMesh(), + "alicloud_mhub_app": resourceAlicloudMhubApp(), + "alicloud_cloud_sso_group": resourceAlicloudCloudSsoGroup(), + "alicloud_dts_synchronization_instance": resourceAlicloudDtsSynchronizationInstance(), + "alicloud_dts_synchronization_job": resourceAlicloudDtsSynchronizationJob(), + "alicloud_cloud_firewall_instance": resourceAlicloudCloudFirewallInstance(), + "alicloud_cr_endpoint_acl_policy": resourceAlicloudCrEndpointAclPolicy(), + "alicloud_actiontrail_history_delivery_job": resourceAlicloudActiontrailHistoryDeliveryJob(), + "alicloud_ecs_deployment_set": resourceAlicloudEcsDeploymentSet(), + "alicloud_cloud_sso_user": resourceAlicloudCloudSsoUser(), + "alicloud_cloud_sso_access_configuration": resourceAlicloudCloudSsoAccessConfiguration(), + "alicloud_dfs_file_system": resourceAlicloudDfsFileSystem(), + "alicloud_vpc_traffic_mirror_filter": resourceAlicloudVpcTrafficMirrorFilter(), + "alicloud_dfs_access_rule": resourceAlicloudDfsAccessRule(), + "alicloud_vpc_traffic_mirror_filter_egress_rule": resourceAlicloudVpcTrafficMirrorFilterEgressRule(), + "alicloud_dfs_mount_point": resourceAlicloudDfsMountPoint(), + "alicloud_ecd_simple_office_site": resourceAlicloudEcdSimpleOfficeSite(), + "alicloud_vpc_traffic_mirror_filter_ingress_rule": resourceAlicloudVpcTrafficMirrorFilterIngressRule(), + "alicloud_ecd_nas_file_system": resourceAlicloudEcdNasFileSystem(), + "alicloud_cloud_sso_user_attachment": resourceAlicloudCloudSsoUserAttachment(), + "alicloud_cloud_sso_access_assignment": resourceAlicloudCloudSsoAccessAssignment(), + "alicloud_msc_sub_webhook": resourceAlicloudMscSubWebhook(), + "alicloud_waf_protection_module": resourceAlicloudWafProtectionModule(), + "alicloud_ecd_user": resourceAlicloudEcdUser(), + "alicloud_vpc_traffic_mirror_session": resourceAlicloudVpcTrafficMirrorSession(), + "alicloud_gpdb_account": resourceAlicloudGpdbAccount(), + "alicloud_security_center_service_linked_role": resourceAlicloudSecurityCenterServiceLinkedRole(), + "alicloud_event_bridge_service_linked_role": resourceAlicloudEventBridgeServiceLinkedRole(), + "alicloud_vpc_ipv6_gateway": resourceAlicloudVpcIpv6Gateway(), + "alicloud_vpc_ipv6_egress_rule": resourceAlicloudVpcIpv6EgressRule(), + "alicloud_hbr_server_backup_plan": resourceAlicloudHbrServerBackupPlan(), + "alicloud_cms_dynamic_tag_group": resourceAlicloudCmsDynamicTagGroup(), + "alicloud_ecd_network_package": resourceAlicloudEcdNetworkPackage(), + "alicloud_cloud_storage_gateway_gateway_smb_user": resourceAlicloudCloudStorageGatewayGatewaySmbUser(), + "alicloud_vpc_ipv6_internet_bandwidth": resourceAlicloudVpcIpv6InternetBandwidth(), + "alicloud_simple_application_server_firewall_rule": resourceAlicloudSimpleApplicationServerFirewallRule(), + "alicloud_pvtz_endpoint": resourceAlicloudPvtzEndpoint(), + "alicloud_pvtz_rule": resourceAlicloudPvtzRule(), + "alicloud_pvtz_rule_attachment": resourceAlicloudPvtzRuleAttachment(), + "alicloud_simple_application_server_snapshot": resourceAlicloudSimpleApplicationServerSnapshot(), + "alicloud_simple_application_server_custom_image": resourceAlicloudSimpleApplicationServerCustomImage(), + "alicloud_cloud_storage_gateway_gateway_cache_disk": resourceAlicloudCloudStorageGatewayGatewayCacheDisk(), + "alicloud_cloud_storage_gateway_gateway_logging": resourceAlicloudCloudStorageGatewayGatewayLogging(), + "alicloud_cloud_storage_gateway_gateway_block_volume": resourceAlicloudCloudStorageGatewayGatewayBlockVolume(), + "alicloud_direct_mail_tag": resourceAlicloudDirectMailTag(), + "alicloud_cloud_storage_gateway_gateway_file_share": resourceAlicloudCloudStorageGatewayGatewayFileShare(), + "alicloud_ecd_desktop": resourceAlicloudEcdDesktop(), + "alicloud_cloud_storage_gateway_express_sync": resourceAlicloudCloudStorageGatewayExpressSync(), + "alicloud_cloud_storage_gateway_express_sync_share_attachment": resourceAlicloudCloudStorageGatewayExpressSyncShareAttachment(), + "alicloud_oos_application": resourceAlicloudOosApplication(), + "alicloud_eci_virtual_node": resourceAlicloudEciVirtualNode(), + "alicloud_ros_stack_instance": resourceAlicloudRosStackInstance(), + "alicloud_ecs_dedicated_host_cluster": resourceAlicloudEcsDedicatedHostCluster(), + "alicloud_oos_application_group": resourceAlicloudOosApplicationGroup(), + "alicloud_dts_consumer_channel": resourceAlicloudDtsConsumerChannel(), + "alicloud_ecd_image": resourceAlicloudEcdImage(), + "alicloud_oos_patch_baseline": resourceAlicloudOosPatchBaseline(), + "alicloud_ecd_command": resourceAlicloudEcdCommand(), + "alicloud_cddc_dedicated_host": resourceAlicloudCddcDedicatedHost(), + "alicloud_oos_service_setting": resourceAlicloudOosServiceSetting(), + "alicloud_oos_parameter": resourceAlicloudOosParameter(), + "alicloud_oos_state_configuration": resourceAlicloudOosStateConfiguration(), + "alicloud_oos_secret_parameter": resourceAlicloudOosSecretParameter(), + "alicloud_click_house_backup_policy": resourceAlicloudClickHouseBackupPolicy(), + "alicloud_mongodb_audit_policy": resourceAlicloudMongodbAuditPolicy(), + "alicloud_cloud_sso_access_configuration_provisioning": resourceAlicloudCloudSsoAccessConfigurationProvisioning(), + "alicloud_mongodb_account": resourceAlicloudMongodbAccount(), + "alicloud_mongodb_serverless_instance": resourceAlicloudMongodbServerlessInstance(), + "alicloud_ecs_session_manager_status": resourceAlicloudEcsSessionManagerStatus(), + "alicloud_cddc_dedicated_host_account": resourceAlicloudCddcDedicatedHostAccount(), + "alicloud_cr_chart_namespace": resourceAlicloudCrChartNamespace(), + "alicloud_fnf_execution": resourceAlicloudFnFExecution(), + "alicloud_cr_chart_repository": resourceAlicloudCrChartRepository(), + "alicloud_mongodb_sharding_network_public_address": resourceAlicloudMongodbShardingNetworkPublicAddress(), + "alicloud_ga_acl": resourceAlicloudGaAcl(), + "alicloud_ga_acl_attachment": resourceAlicloudGaAclAttachment(), + "alicloud_ga_additional_certificate": resourceAlicloudGaAdditionalCertificate(), + "alicloud_alidns_custom_line": resourceAlicloudAlidnsCustomLine(), + "alicloud_vpc_vbr_ha": resourceAlicloudVpcVbrHa(), + "alicloud_ros_template_scratch": resourceAlicloudRosTemplateScratch(), + "alicloud_alidns_gtm_instance": resourceAlicloudAlidnsGtmInstance(), + "alicloud_vpc_bgp_group": resourceAlicloudVpcBgpGroup(), + "alicloud_ram_security_preference": resourceAlicloudRamSecurityPreference(), + "alicloud_nas_snapshot": resourceAlicloudNasSnapshot(), + "alicloud_hbr_replication_vault": resourceAlicloudHbrReplicationVault(), + "alicloud_alidns_address_pool": resourceAlicloudAlidnsAddressPool(), + "alicloud_ecs_prefix_list": resourceAlicloudEcsPrefixList(), + "alicloud_alidns_access_strategy": resourceAlicloudAlidnsAccessStrategy(), + "alicloud_alidns_monitor_config": resourceAlicloudAlidnsMonitorConfig(), + "alicloud_vpc_dhcp_options_set_attachment": resourceAlicloudVpcDhcpOptionsSetAttachement(), + "alicloud_vpc_bgp_peer": resourceAlicloudVpcBgpPeer(), + "alicloud_nas_fileset": resourceAlicloudNasFileset(), + "alicloud_nas_auto_snapshot_policy": resourceAlicloudNasAutoSnapshotPolicy(), + "alicloud_nas_lifecycle_policy": resourceAlicloudNasLifecyclePolicy(), + "alicloud_vpc_bgp_network": resourceAlicloudVpcBgpNetwork(), }, ConfigureFunc: providerConfigure, @@ -890,11 +1223,23 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) { if region == "" { region = DEFAULT_REGION } + securityToken := getProviderConfig(d.Get("security_token").(string), "sts_token") ecsRoleName := getProviderConfig(d.Get("ecs_role_name").(string), "ram_role_name") + if accessKey == "" || secretKey == "" { + if v, ok := d.GetOk("credentials_uri"); ok && v.(string) != "" { + credentialsURIResp, err := getClientByCredentialsURI(v.(string)) + if err != nil { + return nil, err + } + accessKey = credentialsURIResp.AccessKeyId + secretKey = credentialsURIResp.AccessKeySecret + securityToken = credentialsURIResp.SecurityToken + } + } + config := &connectivity.Config{ - SourceIp: strings.TrimSpace(d.Get("source_ip").(string)), AccessKey: strings.TrimSpace(accessKey), SecretKey: strings.TrimSpace(secretKey), EcsRoleName: strings.TrimSpace(ecsRoleName), @@ -905,9 +1250,13 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) { Protocol: d.Get("protocol").(string), ClientReadTimeout: d.Get("client_read_timeout").(int), ClientConnectTimeout: d.Get("client_connect_timeout").(int), + SourceIp: strings.TrimSpace(d.Get("source_ip").(string)), + SecureTransport: strings.TrimSpace(d.Get("secure_transport").(string)), + } + if v, ok := d.GetOk("security_transport"); config.SecureTransport == "" && ok && v.(string) != "" { + config.SecureTransport = v.(string) } - token := getProviderConfig(d.Get("security_token").(string), "sts_token") - config.SecurityToken = strings.TrimSpace(token) + config.SecurityToken = strings.TrimSpace(securityToken) config.RamRoleArn = getProviderConfig("", "ram_role_arn") config.RamRoleSessionName = getProviderConfig("", "ram_session_name") @@ -1035,8 +1384,34 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) { config.CddcEndpoint = strings.TrimSpace(endpoints["cddc"].(string)) config.MscopensubscriptionEndpoint = strings.TrimSpace(endpoints["mscopensubscription"].(string)) config.SddpEndpoint = strings.TrimSpace(endpoints["sddp"].(string)) - config.BastionhostEndpoint = strings.TrimSpace(endpoints["bastionhost"].(string)) + config.SasEndpoint = strings.TrimSpace(endpoints["sas"].(string)) + config.AlidfsEndpoint = strings.TrimSpace(endpoints["alidfs"].(string)) + config.EhpcEndpoint = strings.TrimSpace(endpoints["ehpc"].(string)) + config.EnsEndpoint = strings.TrimSpace(endpoints["ens"].(string)) + config.IotEndpoint = strings.TrimSpace(endpoints["iot"].(string)) + config.ImmEndpoint = strings.TrimSpace(endpoints["imm"].(string)) + config.ClickhouseEndpoint = strings.TrimSpace(endpoints["clickhouse"].(string)) + config.DtsEndpoint = strings.TrimSpace(endpoints["dts"].(string)) + config.DgEndpoint = strings.TrimSpace(endpoints["dg"].(string)) + config.CloudssoEndpoint = strings.TrimSpace(endpoints["cloudsso"].(string)) + config.WafEndpoint = strings.TrimSpace(endpoints["waf"].(string)) + config.SwasEndpoint = strings.TrimSpace(endpoints["swas"].(string)) + config.VsEndpoint = strings.TrimSpace(endpoints["vs"].(string)) + config.QuickbiEndpoint = strings.TrimSpace(endpoints["quickbi"].(string)) + config.VodEndpoint = strings.TrimSpace(endpoints["vod"].(string)) + config.OpensearchEndpoint = strings.TrimSpace(endpoints["opensearch"].(string)) + config.GdsEndpoint = strings.TrimSpace(endpoints["gds"].(string)) + config.DbfsEndpoint = strings.TrimSpace(endpoints["dbfs"].(string)) + config.DevopsrdcEndpoint = strings.TrimSpace(endpoints["devopsrdc"].(string)) + config.EaisEndpoint = strings.TrimSpace(endpoints["eais"].(string)) + config.CloudauthEndpoint = strings.TrimSpace(endpoints["cloudauth"].(string)) + config.ImpEndpoint = strings.TrimSpace(endpoints["imp"].(string)) + config.MhubEndpoint = strings.TrimSpace(endpoints["mhub"].(string)) + config.ServicemeshEndpoint = strings.TrimSpace(endpoints["servicemesh"].(string)) + config.AcrEndpoint = strings.TrimSpace(endpoints["acr"].(string)) + config.EdsuserEndpoint = strings.TrimSpace(endpoints["edsuser"].(string)) + config.GaplusEndpoint = strings.TrimSpace(endpoints["gaplus"].(string)) if endpoint, ok := endpoints["alidns"]; ok { config.AlidnsEndpoint = strings.TrimSpace(endpoint.(string)) } else { @@ -1072,7 +1447,11 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) { } if config.ConfigurationSource == "" { - sourceName := fmt.Sprintf("Default/%s:%s", config.AccessKey, strings.Trim(uuid.New().String(), "-")) + sourceAccessKey := config.AccessKey + if len(sourceAccessKey) > 25 { + sourceAccessKey = sourceAccessKey[:25] + } + sourceName := fmt.Sprintf("Default/%s:%s", sourceAccessKey, strings.Trim(uuid.New().String(), "-")) if len(sourceName) > 64 { sourceName = sourceName[:64] } @@ -1093,8 +1472,6 @@ var descriptions map[string]string func init() { descriptions = map[string]string{ - "source_ip": "The access key for API operations. You can retrieve this from the 'Security Management' section of the Alibaba Cloud console.", - "access_key": "The access key for API operations. You can retrieve this from the 'Security Management' section of the Alibaba Cloud console.", "secret_key": "The secret key for API operations. You can retrieve this from the 'Security Management' section of the Alibaba Cloud console.", @@ -1125,7 +1502,11 @@ func init() { "client_read_timeout": "The maximum timeout of the client read request.", "client_connect_timeout": "The maximum timeout of the client connection server.", - "ecs_endpoint": "Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to custom ECS endpoints.", + "source_ip": "The source ip for the assume role invoking.", + "secure_transport": "The security transport for the assume role invoking.", + "credentials_uri": "The URI of sidecar credentials service.", + + "ecs_endpoint": "Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to custom ECS endpoints.", "rds_endpoint": "Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to custom RDS endpoints.", @@ -1287,6 +1668,60 @@ func init() { "sddp_endpoint": "Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to custom sddp endpoints.", "bastionhost_endpoint": "Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to custom bastionhost endpoints.", + + "sas_endpoint": "Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to custom sas endpoints.", + + "alidfs_endpoint": "Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to custom alidfs endpoints.", + + "ehpc_endpoint": "Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to custom ehpc endpoints.", + + "ens_endpoint": "Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to custom ens endpoints.", + + "iot_endpoint": "Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to custom iot endpoints.", + + "imm_endpoint": "Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to custom imm endpoints.", + + "clickhouse_endpoint": "Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to custom clickhouse endpoints.", + + "dts_endpoint": "Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to custom dts endpoints.", + + "dg_endpoint": "Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to custom dg endpoints.", + + "cloudsso_endpoint": "Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to custom cloudsso endpoints.", + + "waf_endpoint": "Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to custom waf endpoints.", + + "swas_endpoint": "Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to custom swas endpoints.", + + "vs_endpoint": "Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to custom vs endpoints.", + + "quickbi_endpoint": "Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to custom quickbi endpoints.", + + "vod_endpoint": "Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to custom vod endpoints.", + + "opensearch_endpoint": "Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to custom opensearch endpoints.", + + "gds_endpoint": "Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to custom gds endpoints.", + + "dbfs_endpoint": "Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to custom dbfs endpoints.", + + "devopsrdc_endpoint": "Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to custom devopsrdc endpoints.", + + "eais_endpoint": "Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to custom eais endpoints.", + + "cloudauth_endpoint": "Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to custom cloudauth endpoints.", + + "imp_endpoint": "Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to custom imp endpoints.", + + "mhub_endpoint": "Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to custom mhub endpoints.", + + "servicemesh_endpoint": "Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to custom servicemesh endpoints.", + + "acr_endpoint": "Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to custom acr endpoints.", + + "edsuser_endpoint": "Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to custom edsuser endpoints.", + + "gaplus_endpoint": "Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to custom gaplus endpoints.", } } @@ -1331,13 +1766,171 @@ func endpointsSchema() *schema.Schema { Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ + "gaplus": { + Type: schema.TypeString, + Optional: true, + Default: "", + Description: descriptions["gaplus_endpoint"], + }, + + "edsuser": { + Type: schema.TypeString, + Optional: true, + Default: "", + Description: descriptions["edsuser_endpoint"], + }, + + "acr": { + Type: schema.TypeString, + Optional: true, + Default: "", + Description: descriptions["acr_endpoint"], + }, + + "imp": { + Type: schema.TypeString, + Optional: true, + Default: "", + Description: descriptions["imp_endpoint"], + }, + "eais": { + Type: schema.TypeString, + Optional: true, + Default: "", + Description: descriptions["eais_endpoint"], + }, + "cloudauth": { + Type: schema.TypeString, + Optional: true, + Default: "", + Description: descriptions["cloudauth_endpoint"], + }, + + "mhub": { + Type: schema.TypeString, + Optional: true, + Default: "", + Description: descriptions["mhub_endpoint"], + }, + "servicemesh": { + Type: schema.TypeString, + Optional: true, + Default: "", + Description: descriptions["servicemesh_endpoint"], + }, + "quickbi": { + Type: schema.TypeString, + Optional: true, + Default: "", + Description: descriptions["quickbi_endpoint"], + }, + "vod": { + Type: schema.TypeString, + Optional: true, + Default: "", + Description: descriptions["vod_endpoint"], + }, + "opensearch": { + Type: schema.TypeString, + Optional: true, + Default: "", + Description: descriptions["opensearch_endpoint"], + }, + "gds": { + Type: schema.TypeString, + Optional: true, + Default: "", + Description: descriptions["gds_endpoint"], + }, + "dbfs": { + Type: schema.TypeString, + Optional: true, + Default: "", + Description: descriptions["dbfs_endpoint"], + }, + "devopsrdc": { + Type: schema.TypeString, + Optional: true, + Default: "", + Description: descriptions["devopsrdc_endpoint"], + }, + "dg": { + Type: schema.TypeString, + Optional: true, + Default: "", + Description: descriptions["dg_endpoint"], + }, + "waf": { + Type: schema.TypeString, + Optional: true, + Default: "", + Description: descriptions["waf_endpoint"], + }, + "vs": { + Type: schema.TypeString, + Optional: true, + Default: "", + Description: descriptions["vs_endpoint"], + }, + "dts": { + Type: schema.TypeString, + Optional: true, + Default: "", + Description: descriptions["dts_endpoint"], + }, + "cloudsso": { + Type: schema.TypeString, + Optional: true, + Default: "", + Description: descriptions["cloudsso_endpoint"], + }, + + "iot": { + Type: schema.TypeString, + Optional: true, + Default: "", + Description: descriptions["iot_endpoint"], + }, + "swas": { + Type: schema.TypeString, + Optional: true, + Default: "", + Description: descriptions["swas_endpoint"], + }, + + "imm": { + Type: schema.TypeString, + Optional: true, + Default: "", + Description: descriptions["imm_endpoint"], + }, + "clickhouse": { + Type: schema.TypeString, + Optional: true, + Default: "", + Description: descriptions["clickhouse_endpoint"], + }, + + "alidfs": { + Type: schema.TypeString, + Optional: true, + Default: "", + Description: descriptions["alidfs_endpoint"], + }, + + "ens": { + Type: schema.TypeString, + Optional: true, + Default: "", + Description: descriptions["ens_endpoint"], + }, + "bastionhost": { Type: schema.TypeString, Optional: true, Default: "", Description: descriptions["bastionhost_endpoint"], }, - "cddc": { Type: schema.TypeString, Optional: true, @@ -1358,6 +1951,20 @@ func endpointsSchema() *schema.Schema { Description: descriptions["mscopensubscription_endpoint"], }, + "sas": { + Type: schema.TypeString, + Optional: true, + Default: "", + Description: descriptions["sas_endpoint"], + }, + + "ehpc": { + Type: schema.TypeString, + Optional: true, + Default: "", + Description: descriptions["ehpc_endpoint"], + }, + "dataworkspublic": { Type: schema.TypeString, Optional: true, @@ -1947,6 +2554,33 @@ func endpointsToHash(v interface{}) int { buf.WriteString(fmt.Sprintf("%s-", m["mscopensubscription"].(string))) buf.WriteString(fmt.Sprintf("%s-", m["sddp"].(string))) buf.WriteString(fmt.Sprintf("%s-", m["bastionhost"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m["sas"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m["alidfs"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m["ehpc"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m["ens"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m["iot"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m["imm"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m["clickhouse"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m["dts"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m["dg"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m["cloudsso"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m["waf"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m["swas"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m["vs"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m["quickbi"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m["vod"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m["opensearch"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m["gds"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m["dbfs"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m["devopsrdc"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m["eais"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m["cloudauth"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m["imp"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m["mhub"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m["servicemesh"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m["acr"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m["edsuser"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m["gaplus"].(string))) return hashcode.String(buf.String()) } @@ -2048,3 +2682,40 @@ func getAssumeRoleAK(accessKey, secretKey, stsToken, region, roleArn, sessionNam return response.Credentials.AccessKeyId, response.Credentials.AccessKeySecret, response.Credentials.SecurityToken, nil } + +type CredentialsURIResponse struct { + Code string + AccessKeyId string + AccessKeySecret string + SecurityToken string + Expiration string +} + +func getClientByCredentialsURI(credentialsURI string) (*CredentialsURIResponse, error) { + res, err := http.Get(credentialsURI) + if err != nil { + return nil, err + } + + if res.StatusCode != 200 { + return nil, fmt.Errorf("get Credentials from %s failed, status code %d", credentialsURI, res.StatusCode) + } + + body, err := ioutil.ReadAll(res.Body) + res.Body.Close() + if err != nil { + return nil, err + } + + var response CredentialsURIResponse + err = json.Unmarshal(body, &response) + if err != nil { + return nil, fmt.Errorf("unmarshal credentials failed, the body %s", string(body)) + } + + if response.Code != "Success" { + return nil, fmt.Errorf("fetching sts token from %s got an error and its Code is not Success", credentialsURI) + } + + return &response, nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_actiontrail_history_delivery_job.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_actiontrail_history_delivery_job.go new file mode 100644 index 00000000000..594b651f69f --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_actiontrail_history_delivery_job.go @@ -0,0 +1,125 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudActiontrailHistoryDeliveryJob() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudActiontrailHistoryDeliveryJobCreate, + Read: resourceAlicloudActiontrailHistoryDeliveryJobRead, + Delete: resourceAlicloudActiontrailHistoryDeliveryJobDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(30 * time.Minute), + Delete: schema.DefaultTimeout(2 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "status": { + Type: schema.TypeInt, + Computed: true, + }, + "trail_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudActiontrailHistoryDeliveryJobCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateDeliveryHistoryJob" + request := make(map[string]interface{}) + conn, err := client.NewActiontrailClient() + if err != nil { + return WrapError(err) + } + request["TrailName"] = d.Get("trail_name") + request["ClientToken"] = buildClientToken("CreateDeliveryHistoryJob") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-07-06"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_actiontrail_history_delivery_job", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(formatInt(response["JobId"]))) + actiontrailService := ActiontrailService{client} + stateConf := BuildStateConf([]string{}, []string{"2", "3"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, actiontrailService.ActiontrailHistoryDeliveryJobStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudActiontrailHistoryDeliveryJobRead(d, meta) +} +func resourceAlicloudActiontrailHistoryDeliveryJobRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + actiontrailService := ActiontrailService{client} + object, err := actiontrailService.DescribeActiontrailHistoryDeliveryJob(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_actiontrail_history_delivery_job actiontrailService.DescribeActiontrailHistoryDeliveryJob Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("status", formatInt(object["JobStatus"])) + d.Set("trail_name", object["TrailName"]) + return nil +} +func resourceAlicloudActiontrailHistoryDeliveryJobDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteDeliveryHistoryJob" + var response map[string]interface{} + conn, err := client.NewActiontrailClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "JobId": d.Id(), + } + + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-07-06"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_alb_acl.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_alb_acl.go new file mode 100644 index 00000000000..026562e8c0a --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_alb_acl.go @@ -0,0 +1,400 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudAlbAcl() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudAlbAclCreate, + Read: resourceAlicloudAlbAclRead, + Update: resourceAlicloudAlbAclUpdate, + Delete: resourceAlicloudAlbAclDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(16 * time.Minute), + Delete: schema.DefaultTimeout(16 * time.Minute), + Update: schema.DefaultTimeout(16 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "acl_entries": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "description": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(1, 256), + }, + "entry": { + Type: schema.TypeString, + Optional: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "acl_name": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-zA-Z][A-Za-z0-9._-]{2,128}$`), "The name must be `2` to `128` characters in length, and can contain letters, digits, hyphens (-) and underscores (_). It must start with a letter."), + }, + "dry_run": { + Type: schema.TypeBool, + Optional: true, + }, + "resource_group_id": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "tags": tagsSchema(), + }, + } +} + +func resourceAlicloudAlbAclCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateAcl" + request := make(map[string]interface{}) + conn, err := client.NewAlbClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("acl_name"); ok { + request["AclName"] = v + } + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + if v, ok := d.GetOk("resource_group_id"); ok { + request["ResourceGroupId"] = v + } + request["ClientToken"] = buildClientToken("CreateAcl") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-16"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if IsExpectedErrors(err, []string{"OperationFailed.ResourceGroupStatusCheckFail", "SystemBusy", "Throttling"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_alb_acl", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["AclId"])) + albService := AlbService{client} + stateConf := BuildStateConf([]string{}, []string{"Available"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, albService.AlbAclStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudAlbAclUpdate(d, meta) +} + +func resourceAlicloudAlbAclRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + albService := AlbService{client} + object, err := albService.DescribeAlbAcl(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_alb_acl albService.DescribeAlbAcl Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("acl_name", object["AclName"]) + d.Set("resource_group_id", object["ResourceGroupId"]) + d.Set("status", object["AclStatus"]) + listAclEntriesObject, err := albService.ListAclEntries(d.Id()) + if err != nil { + return WrapError(err) + } + aclEntriesMaps := make([]map[string]interface{}, 0) + for _, aclEntriesListItem := range listAclEntriesObject { + aclEntriesArg := make(map[string]interface{}, 0) + aclEntriesArg["description"] = aclEntriesListItem["Description"] + aclEntriesArg["entry"] = aclEntriesListItem["Entry"] + aclEntriesArg["status"] = aclEntriesListItem["Status"] + aclEntriesMaps = append(aclEntriesMaps, aclEntriesArg) + } + d.Set("acl_entries", aclEntriesMaps) + + listTagResourcesObject, err := albService.ListTagResources(d.Id(), "acl") + d.Set("tags", tagsToMap(listTagResourcesObject)) + return nil +} + +func resourceAlicloudAlbAclUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + albService := AlbService{client} + var response map[string]interface{} + d.Partial(true) + + if d.HasChange("tags") { + if err := albService.SetResourceTags(d, "acl"); err != nil { + return WrapError(err) + } + d.SetPartial("tags") + } + update := false + request := map[string]interface{}{ + "ResourceId": d.Id(), + } + if !d.IsNewResource() && d.HasChange("resource_group_id") { + update = true + } + if v, ok := d.GetOk("resource_group_id"); ok { + request["NewResourceGroupId"] = v + } + request["ResourceType"] = "acl" + if update { + action := "MoveResourceGroup" + conn, err := client.NewAlbClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-16"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"NotExist.ResourceGroup"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("resource_group_id") + } + update = false + updateAclAttributeReq := map[string]interface{}{ + "AclId": d.Id(), + } + if !d.IsNewResource() && d.HasChange("acl_name") { + update = true + } + if v, ok := d.GetOk("acl_name"); ok { + updateAclAttributeReq["AclName"] = v + } + if update { + if v, ok := d.GetOkExists("dry_run"); ok { + updateAclAttributeReq["DryRun"] = v + } + action := "UpdateAclAttribute" + conn, err := client.NewAlbClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("UpdateAclAttribute") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-16"), StringPointer("AK"), nil, updateAclAttributeReq, &runtime) + if err != nil { + if IsExpectedErrors(err, []string{"OperationFailed.ResourceGroupStatusCheckFail", "SystemBusy", "Throttling"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, updateAclAttributeReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Available"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, albService.AlbAclStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + d.SetPartial("acl_name") + } + update = false + + if d.HasChange("acl_entries") { + + oraw, nraw := d.GetChange("acl_entries") + remove := oraw.(*schema.Set).Difference(nraw.(*schema.Set)).List() + create := nraw.(*schema.Set).Difference(oraw.(*schema.Set)).List() + + if len(remove) > 0 { + removeList := SplitSlice(remove, 20) + for _, item := range removeList { + removeEntriesFromAclReq := map[string]interface{}{ + "AclId": d.Id(), + } + + aclEntriesMaps := make([]string, 0) + for _, aclEntries := range item { + aclEntriesArg := aclEntries.(map[string]interface{}) + aclEntriesMaps = append(aclEntriesMaps, aclEntriesArg["entry"].(string)) + } + removeEntriesFromAclReq["Entries"] = aclEntriesMaps + + if v, ok := d.GetOkExists("dry_run"); ok { + removeEntriesFromAclReq["DryRun"] = v + } + action := "RemoveEntriesFromAcl" + conn, err := client.NewAlbClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("RemoveEntriesFromAcl") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-16"), StringPointer("AK"), nil, removeEntriesFromAclReq, &runtime) + if err != nil { + if IsExpectedErrors(err, []string{"IncorrectStatus.Acl", "OperationFailed.ResourceGroupStatusCheckFail", "SystemBusy", "Throttling"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, removeEntriesFromAclReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Available"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, albService.AlbAclStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + } + + if len(create) > 0 { + createList := SplitSlice(create, 20) + for _, item := range createList { + addEntriesToAclReq := map[string]interface{}{ + "AclId": d.Id(), + } + aclEntriesMaps := make([]map[string]interface{}, 0) + for _, aclEntries := range item { + aclEntriesArg := aclEntries.(map[string]interface{}) + aclEntriesMap := map[string]interface{}{} + aclEntriesMap["Description"] = aclEntriesArg["description"] + aclEntriesMap["Entry"] = aclEntriesArg["entry"] + aclEntriesMaps = append(aclEntriesMaps, aclEntriesMap) + } + addEntriesToAclReq["AclEntries"] = aclEntriesMaps + + if v, ok := d.GetOkExists("dry_run"); ok { + addEntriesToAclReq["DryRun"] = v + } + action := "AddEntriesToAcl" + conn, err := client.NewAlbClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("AddEntriesToAcl") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-16"), StringPointer("AK"), nil, addEntriesToAclReq, &runtime) + if err != nil { + if IsExpectedErrors(err, []string{"OperationFailed.ResourceGroupStatusCheckFail", "SystemBusy", "Throttling"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, addEntriesToAclReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Available"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, albService.AlbAclStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + } + + d.SetPartial("acl_entries") + } + d.Partial(false) + return resourceAlicloudAlbAclRead(d, meta) +} + +func resourceAlicloudAlbAclDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteAcl" + var response map[string]interface{} + conn, err := client.NewAlbClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "AclId": d.Id(), + } + + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + request["ClientToken"] = buildClientToken("DeleteAcl") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-16"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if IsExpectedErrors(err, []string{"OperationFailed.ResourceGroupStatusCheckFail", "SystemBusy", "ResourceInUse.Acl", "IncorrectStatus.Acl"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"ResourceNotFound.Acl"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_alb_health_check_template.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_alb_health_check_template.go new file mode 100644 index 00000000000..e7648a054f7 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_alb_health_check_template.go @@ -0,0 +1,397 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudAlbHealthCheckTemplate() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudAlbHealthCheckTemplateCreate, + Read: resourceAlicloudAlbHealthCheckTemplateRead, + Update: resourceAlicloudAlbHealthCheckTemplateUpdate, + Delete: resourceAlicloudAlbHealthCheckTemplateDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(2 * time.Minute), + Delete: schema.DefaultTimeout(2 * time.Minute), + Update: schema.DefaultTimeout(2 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "dry_run": { + Type: schema.TypeBool, + Optional: true, + }, + "health_check_codes": { + Type: schema.TypeList, + Optional: true, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("health_check_protocol"); ok && v.(string) == "HTTP" { + return false + } + return true + }, + }, + "health_check_connect_port": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + ValidateFunc: validation.IntBetween(0, 65535), + }, + "health_check_host": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringLenBetween(1, 80), + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("health_check_protocol"); ok && v.(string) == "HTTP" { + return false + } + return true + }, + }, + "health_check_http_version": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"HTTP1.0", "HTTP1.1"}, false), + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("health_check_protocol"); ok && v.(string) == "HTTP" { + return false + } + return true + }, + }, + "health_check_interval": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + ValidateFunc: validation.IntBetween(1, 50), + }, + "health_check_method": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"GET", "HEAD"}, false), + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("health_check_protocol"); ok && v.(string) == "HTTP" { + return false + } + return true + }, + }, + "health_check_path": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^\/[A-Za-z0-9\$\-_\.\+\/\&\~\@\:\$\^\'\,]{1,79}$`), "The URL must be 1 to 80 characters in length, and can contain letters, digits, hyphens (-), forward slashes (/), periods (.), percent signs (%), question marks (?), number signs (#), and ampersands (&). "), + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("health_check_protocol"); ok && v.(string) == "HTTP" { + return false + } + return true + }, + }, + "health_check_protocol": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"HTTP", "TCP"}, false), + }, + "health_check_template_name": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[A-Za-z][A-Za-z0-9\\_\\.\\-]{1,127}$`), "The name must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter."), + }, + "health_check_timeout": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + ValidateFunc: validation.IntBetween(1, 300), + }, + "healthy_threshold": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + ValidateFunc: validation.IntBetween(2, 10), + }, + "unhealthy_threshold": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + ValidateFunc: validation.IntBetween(2, 10), + }, + }, + } +} + +func resourceAlicloudAlbHealthCheckTemplateCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateHealthCheckTemplate" + request := make(map[string]interface{}) + conn, err := client.NewAlbClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + if m, ok := d.GetOk("health_check_codes"); ok { + for k, v := range m.([]interface{}) { + request[fmt.Sprintf("HealthCheckCodes.%d", k+1)] = v.(string) + } + } + if v, ok := d.GetOk("health_check_connect_port"); ok { + request["HealthCheckConnectPort"] = v + } + if v, ok := d.GetOk("health_check_host"); ok { + request["HealthCheckHost"] = v + } + if v, ok := d.GetOk("health_check_http_version"); ok { + request["HealthCheckHttpVersion"] = v + } + if v, ok := d.GetOk("health_check_interval"); ok { + request["HealthCheckInterval"] = v + } + if v, ok := d.GetOk("health_check_method"); ok { + request["HealthCheckMethod"] = v + } + if v, ok := d.GetOk("health_check_path"); ok { + request["HealthCheckPath"] = v + } + if v, ok := d.GetOk("health_check_protocol"); ok { + request["HealthCheckProtocol"] = v + } + request["HealthCheckTemplateName"] = d.Get("health_check_template_name") + if v, ok := d.GetOk("health_check_timeout"); ok { + request["HealthCheckTimeout"] = v + } + if v, ok := d.GetOk("healthy_threshold"); ok { + request["HealthyThreshold"] = v + } + if v, ok := d.GetOk("unhealthy_threshold"); ok { + request["UnhealthyThreshold"] = v + } + request["ClientToken"] = buildClientToken("CreateHealthCheckTemplate") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-16"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if IsExpectedErrors(err, []string{"IdempotenceProcessing", "QuotaExceeded.HealthCheckTemplatesNum", "SystemBusy"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_alb_health_check_template", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["HealthCheckTemplateId"])) + + return resourceAlicloudAlbHealthCheckTemplateRead(d, meta) +} +func resourceAlicloudAlbHealthCheckTemplateRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + albService := AlbService{client} + object, err := albService.DescribeAlbHealthCheckTemplate(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_alb_health_check_template albService.DescribeAlbHealthCheckTemplate Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + if healthCheckCodes, ok := object["HealthCheckCodes"]; ok { + d.Set("health_check_codes", healthCheckCodes) + } + if v, ok := object["HealthCheckConnectPort"]; ok { + d.Set("health_check_connect_port", formatInt(v)) + } + if v, ok := object["HealthCheckInterval"]; ok && fmt.Sprint(v) != "0" { + d.Set("health_check_interval", formatInt(v)) + } + d.Set("health_check_protocol", object["HealthCheckProtocol"]) + if v, ok := object["HealthCheckProtocol"]; ok && fmt.Sprint(v) == "HTTP" { + d.Set("health_check_method", object["HealthCheckMethod"]) + d.Set("health_check_path", object["HealthCheckPath"]) + d.Set("health_check_host", object["HealthCheckHost"]) + d.Set("health_check_http_version", object["HealthCheckHttpVersion"]) + } + d.Set("health_check_template_name", object["HealthCheckTemplateName"]) + if v, ok := object["HealthCheckTimeout"]; ok && fmt.Sprint(v) != "0" { + d.Set("health_check_timeout", formatInt(v)) + } + if v, ok := object["HealthyThreshold"]; ok && fmt.Sprint(v) != "0" { + d.Set("healthy_threshold", formatInt(v)) + } + if v, ok := object["UnhealthyThreshold"]; ok && fmt.Sprint(v) != "0" { + d.Set("unhealthy_threshold", formatInt(v)) + } + return nil +} +func resourceAlicloudAlbHealthCheckTemplateUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "HealthCheckTemplateId": d.Id(), + } + if d.HasChange("health_check_codes") { + update = true + if m, ok := d.GetOk("health_check_codes"); ok { + for k, v := range m.([]interface{}) { + request[fmt.Sprintf("HealthCheckCodes.%d", k+1)] = v.(string) + } + } + } + if d.HasChange("health_check_connect_port") { + update = true + if v, ok := d.GetOkExists("health_check_connect_port"); ok { + request["HealthCheckConnectPort"] = v + } + } + if d.HasChange("health_check_host") { + update = true + if v, ok := d.GetOk("health_check_host"); ok { + request["HealthCheckHost"] = v + } + } + if d.HasChange("health_check_http_version") { + update = true + if v, ok := d.GetOk("health_check_http_version"); ok { + request["HealthCheckHttpVersion"] = v + } + } + if d.HasChange("health_check_interval") { + update = true + if v, ok := d.GetOk("health_check_interval"); ok { + request["HealthCheckInterval"] = v + } + } + if d.HasChange("health_check_method") { + update = true + if v, ok := d.GetOk("health_check_method"); ok { + request["HealthCheckMethod"] = v + } + } + if d.HasChange("health_check_path") { + update = true + if v, ok := d.GetOk("health_check_path"); ok { + request["HealthCheckPath"] = v + } + } + if d.HasChange("health_check_protocol") { + update = true + if v, ok := d.GetOk("health_check_protocol"); ok { + request["HealthCheckProtocol"] = v + } + } + if d.HasChange("health_check_template_name") { + update = true + request["HealthCheckTemplateName"] = d.Get("health_check_template_name") + } + if d.HasChange("health_check_timeout") { + update = true + if v, ok := d.GetOk("health_check_timeout"); ok { + request["HealthCheckTimeout"] = v + } + } + if d.HasChange("healthy_threshold") { + update = true + if v, ok := d.GetOk("healthy_threshold"); ok { + request["HealthyThreshold"] = v + } + } + if d.HasChange("unhealthy_threshold") { + update = true + if v, ok := d.GetOk("unhealthy_threshold"); ok { + request["UnhealthyThreshold"] = v + } + } + if update { + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + action := "UpdateHealthCheckTemplateAttribute" + conn, err := client.NewAlbClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("UpdateHealthCheckTemplateAttribute") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-16"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if IsExpectedErrors(err, []string{"IdempotenceProcessing", "IncorrectStatus.HealthCheckTemplate", "SystemBusy"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudAlbHealthCheckTemplateRead(d, meta) +} +func resourceAlicloudAlbHealthCheckTemplateDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteHealthCheckTemplates" + var response map[string]interface{} + conn, err := client.NewAlbClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "HealthCheckTemplateIds.1": d.Id(), + } + + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + request["ClientToken"] = buildClientToken("DeleteHealthCheckTemplates") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-16"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if IsExpectedErrors(err, []string{"IdempotenceProcessing", "IncorrectStatus.HealthCheckTemplate", "SystemBusy"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_alb_listener.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_alb_listener.go new file mode 100644 index 00000000000..8d4e6bffbf5 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_alb_listener.go @@ -0,0 +1,1012 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudAlbListener() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudAlbListenerCreate, + Read: resourceAlicloudAlbListenerRead, + Update: resourceAlicloudAlbListenerUpdate, + Delete: resourceAlicloudAlbListenerDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(2 * time.Minute), + Delete: schema.DefaultTimeout(2 * time.Minute), + Update: schema.DefaultTimeout(2 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "access_log_record_customized_headers_enabled": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "certificates": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "certificate_id": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "access_log_tracing_config": { + Type: schema.TypeSet, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "tracing_enabled": { + Type: schema.TypeBool, + Optional: true, + }, + "tracing_sample": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validation.IntBetween(1, 10000), + }, + "tracing_type": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "acl_config": { + Type: schema.TypeSet, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "acl_relations": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "acl_id": { + Type: schema.TypeString, + Optional: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "acl_type": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"White", "Black"}, false), + }, + }, + }, + }, + "default_actions": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "type": { + Type: schema.TypeString, + Required: true, + }, + "forward_group_config": { + Type: schema.TypeSet, + Required: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "server_group_tuples": { + Type: schema.TypeSet, + Required: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "server_group_id": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + "dry_run": { + Type: schema.TypeBool, + Optional: true, + }, + "gzip_enabled": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "http2_enabled": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("listener_protocol"); ok && v.(string) == "HTTPS" { + return false + } + return true + }, + }, + "idle_timeout": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + ValidateFunc: validation.IntBetween(1, 60), + }, + "listener_description": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^([^\x00-\xff]|[\w.,;/@-]){2,256}$`), "\t\nThe description of the listener.\n\nThe description must be 2 to 256 characters in length. The name can contain only the characters in the following string: /^([^\\x00-\\xff]|[\\w.,;/@-]){2,256}$/."), + }, + "listener_port": { + Type: schema.TypeInt, + Required: true, + ForceNew: true, + ValidateFunc: validation.IntBetween(1, 65535), + }, + "listener_protocol": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"HTTP", "HTTPS", "QUIC"}, false), + }, + "load_balancer_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "quic_config": { + Type: schema.TypeSet, + Optional: true, + Computed: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "quic_listener_id": { + Type: schema.TypeString, + Optional: true, + }, + "quic_upgrade_enabled": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("listener_protocol"); ok && v.(string) == "HTTPS" { + return false + } + return true + }, + }, + }, + }, + }, + "request_timeout": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + ValidateFunc: validation.IntBetween(1, 180), + }, + "security_policy_id": { + Type: schema.TypeString, + Optional: true, + Computed: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("listener_protocol"); ok && v.(string) == "HTTPS" { + return false + } + return true + }, + }, + "status": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"Running", "Stopped"}, false), + }, + "xforwarded_for_config": { + Type: schema.TypeSet, + Optional: true, + Computed: true, + MaxItems: 1, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("listener_protocol"); ok && v.(string) == "HTTPS" { + return false + } + return true + }, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "xforwardedforclientcert_issuerdnalias": { + Type: schema.TypeString, + Optional: true, + }, + "xforwardedforclientcert_issuerdnenabled": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "xforwardedforclientcertclientverifyalias": { + Type: schema.TypeString, + Optional: true, + }, + "xforwardedforclientcertclientverifyenabled": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "xforwardedforclientcertfingerprintalias": { + Type: schema.TypeString, + Optional: true, + }, + "xforwardedforclientcertfingerprintenabled": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "xforwardedforclientcertsubjectdnalias": { + Type: schema.TypeString, + Optional: true, + }, + "xforwardedforclientcertsubjectdnenabled": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "xforwardedforclientsrcportenabled": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "xforwardedforenabled": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "xforwardedforprotoenabled": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "xforwardedforslbidenabled": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "xforwardedforslbportenabled": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func resourceAlicloudAlbListenerCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateListener" + request := make(map[string]interface{}) + conn, err := client.NewAlbClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("certificates"); ok { + certificatesMaps := make([]map[string]interface{}, 0) + for _, certificates := range v.(*schema.Set).List() { + certificatesArg := certificates.(map[string]interface{}) + certificatesMap := map[string]interface{}{} + certificatesMap["CertificateId"] = certificatesArg["certificate_id"] + certificatesMaps = append(certificatesMaps, certificatesMap) + } + request["Certificates"] = certificatesMaps + } + defaultActionsMaps := make([]map[string]interface{}, 0) + for _, defaultActions := range d.Get("default_actions").(*schema.Set).List() { + defaultActionsArg := defaultActions.(map[string]interface{}) + defaultActionsMap := map[string]interface{}{} + defaultActionsMap["Type"] = defaultActionsArg["type"] + forwardGroupConfigMap := map[string]interface{}{} + for _, forwardGroupConfig := range defaultActionsArg["forward_group_config"].(*schema.Set).List() { + forwardGroupConfigArg := forwardGroupConfig.(map[string]interface{}) + serverGroupTuplesMaps := make([]map[string]interface{}, 0) + for _, serverGroupTuples := range forwardGroupConfigArg["server_group_tuples"].(*schema.Set).List() { + serverGroupTuplesArg := serverGroupTuples.(map[string]interface{}) + serverGroupTuplesMap := map[string]interface{}{} + serverGroupTuplesMap["ServerGroupId"] = serverGroupTuplesArg["server_group_id"] + serverGroupTuplesMaps = append(serverGroupTuplesMaps, serverGroupTuplesMap) + } + forwardGroupConfigMap["ServerGroupTuples"] = serverGroupTuplesMaps + } + + defaultActionsMap["ForwardGroupConfig"] = forwardGroupConfigMap + defaultActionsMaps = append(defaultActionsMaps, defaultActionsMap) + } + + request["DefaultActions"] = defaultActionsMaps + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + if v, ok := d.GetOkExists("gzip_enabled"); ok { + request["GzipEnabled"] = v + } + if v, ok := d.GetOkExists("http2_enabled"); ok { + request["Http2Enabled"] = v + } + if v, ok := d.GetOk("idle_timeout"); ok { + request["IdleTimeout"] = v + } + if v, ok := d.GetOk("listener_description"); ok { + request["ListenerDescription"] = v + } + request["ListenerPort"] = d.Get("listener_port") + request["ListenerProtocol"] = d.Get("listener_protocol") + request["LoadBalancerId"] = d.Get("load_balancer_id") + if v, ok := d.GetOk("request_timeout"); ok { + request["RequestTimeout"] = v + } + if v, ok := d.GetOk("security_policy_id"); ok { + request["SecurityPolicyId"] = v + } + if v, ok := d.GetOk("xforwarded_for_config"); ok { + xforwardedForConfigMap := map[string]interface{}{} + for _, xforwardedForConfig := range v.(*schema.Set).List() { + xforwardedForConfigArg := xforwardedForConfig.(map[string]interface{}) + xforwardedForConfigMap["XForwardedForClientCertIssuerDNAlias"] = xforwardedForConfigArg["xforwardedforclientcert_issuerdnalias"] + xforwardedForConfigMap["XForwardedForClientCertIssuerDNEnabled"] = xforwardedForConfigArg["xforwardedforclientcert_issuerdnenabled"] + xforwardedForConfigMap["XForwardedForClientCertClientVerifyAlias"] = xforwardedForConfigArg["xforwardedforclientcertclientverifyalias"] + xforwardedForConfigMap["XForwardedForClientCertClientVerifyEnabled"] = xforwardedForConfigArg["xforwardedforclientcertclientverifyenabled"] + xforwardedForConfigMap["XForwardedForClientCertFingerprintAlias"] = xforwardedForConfigArg["xforwardedforclientcertfingerprintalias"] + xforwardedForConfigMap["XForwardedForClientCertFingerprintEnabled"] = xforwardedForConfigArg["xforwardedforclientcertfingerprintenabled"] + xforwardedForConfigMap["XForwardedForClientCertSubjectDNAlias"] = xforwardedForConfigArg["xforwardedforclientcertsubjectdnalias"] + xforwardedForConfigMap["XForwardedForClientCertSubjectDNEnabled"] = xforwardedForConfigArg["xforwardedforclientcertsubjectdnenabled"] + xforwardedForConfigMap["XForwardedForClientSrcPortEnabled"] = xforwardedForConfigArg["xforwardedforclientsrcportenabled"] + xforwardedForConfigMap["XForwardedForEnabled"] = xforwardedForConfigArg["xforwardedforenabled"] + xforwardedForConfigMap["XForwardedForProtoEnabled"] = xforwardedForConfigArg["xforwardedforprotoenabled"] + xforwardedForConfigMap["XForwardedForSLBIdEnabled"] = xforwardedForConfigArg["xforwardedforslbidenabled"] + xforwardedForConfigMap["XForwardedForSLBPortEnabled"] = xforwardedForConfigArg["xforwardedforslbportenabled"] + } + + request["XForwardedForConfig"] = xforwardedForConfigMap + } + request["ClientToken"] = buildClientToken("CreateListener") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-16"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if IsExpectedErrors(err, []string{"IdempotenceProcessing", "IncorrectBusinessStatus.LoadBalancer", "SystemBusy", "Throttling"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_alb_listener", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["ListenerId"])) + albService := AlbService{client} + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, albService.AlbListenerStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudAlbListenerUpdate(d, meta) +} + +func resourceAlicloudAlbListenerRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + albService := AlbService{client} + object, err := albService.DescribeAlbListener(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_alb_listener albService.DescribeAlbListener Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + + d.Set("access_log_record_customized_headers_enabled", object["LogConfig"].(map[string]interface{})["AccessLogRecordCustomizedHeadersEnabled"]) + + accessLogTracingConfigSli := make([]map[string]interface{}, 0) + if accessLogTracingConfig, ok := object["LogConfig"].(map[string]interface{})["AccessLogTracingConfig"]; ok && len(accessLogTracingConfig.(map[string]interface{})) > 0 { + accessLogTracingConfigMap := make(map[string]interface{}) + accessLogTracingConfigMap["tracing_enabled"] = accessLogTracingConfig.(map[string]interface{})["TracingEnabled"] + accessLogTracingConfigMap["tracing_sample"] = accessLogTracingConfig.(map[string]interface{})["TracingSample"] + accessLogTracingConfigMap["tracing_type"] = accessLogTracingConfig.(map[string]interface{})["TracingType"] + accessLogTracingConfigSli = append(accessLogTracingConfigSli, accessLogTracingConfigMap) + } + d.Set("access_log_tracing_config", accessLogTracingConfigSli) + + aclConfigSli := make([]map[string]interface{}, 0) + if aclConfig, ok := object["AclConfig"]; ok && len(aclConfig.(map[string]interface{})) > 0 { + aclConfigMap := make(map[string]interface{}) + + aclRelationsSli := make([]map[string]interface{}, 0) + if v, ok := aclConfig.(map[string]interface{})["AclRelations"]; ok && len(v.([]interface{})) > 0 { + for _, aclRelations := range v.([]interface{}) { + aclRelationsMap := make(map[string]interface{}) + aclRelationsMap["acl_id"] = aclRelations.(map[string]interface{})["AclId"] + aclRelationsMap["status"] = aclRelations.(map[string]interface{})["Status"] + aclRelationsSli = append(aclRelationsSli, aclRelationsMap) + } + } + aclConfigMap["acl_relations"] = aclRelationsSli + aclConfigMap["acl_type"] = aclConfig.(map[string]interface{})["AclType"] + aclConfigSli = append(aclConfigSli, aclConfigMap) + } + d.Set("acl_config", aclConfigSli) + if certificatesList, ok := object["Certificates"]; ok && certificatesList != nil { + certificatesMaps := make([]map[string]interface{}, 0) + for _, certificatesListItem := range certificatesList.([]interface{}) { + if certificatesListItemArg, ok := certificatesListItem.(map[string]interface{}); ok { + certificatesListItemMap := map[string]interface{}{} + certificatesListItemMap["certificate_id"] = certificatesListItemArg["CertificateId"] + certificatesMaps = append(certificatesMaps, certificatesListItemMap) + } + } + + d.Set("certificates", certificatesMaps) + } + + if defaultActionsList, ok := object["DefaultActions"]; ok && defaultActionsList != nil { + defaultActionsMaps := make([]map[string]interface{}, 0) + for _, defaultActions := range defaultActionsList.([]interface{}) { + defaultActionsArg := defaultActions.(map[string]interface{}) + defaultActionsMap := map[string]interface{}{} + defaultActionsMap["type"] = defaultActionsArg["Type"] + forwardGroupConfig := defaultActionsArg["ForwardGroupConfig"] + forwardGroupConfigArg := forwardGroupConfig.(map[string]interface{}) + serverGroupTuplesMaps := make([]map[string]interface{}, 0) + for _, serverGroupTuples := range forwardGroupConfigArg["ServerGroupTuples"].([]interface{}) { + serverGroupTuplesArg := serverGroupTuples.(map[string]interface{}) + serverGroupTuplesMap := map[string]interface{}{} + serverGroupTuplesMap["server_group_id"] = serverGroupTuplesArg["ServerGroupId"] + serverGroupTuplesMaps = append(serverGroupTuplesMaps, serverGroupTuplesMap) + } + forwardGroupConfigMaps := make([]map[string]interface{}, 0) + forwardGroupConfigMap := map[string]interface{}{} + forwardGroupConfigMap["server_group_tuples"] = serverGroupTuplesMaps + forwardGroupConfigMaps = append(forwardGroupConfigMaps, forwardGroupConfigMap) + defaultActionsMap["forward_group_config"] = forwardGroupConfigMaps + defaultActionsMaps = append(defaultActionsMaps, defaultActionsMap) + } + + d.Set("default_actions", defaultActionsMaps) + } + + d.Set("gzip_enabled", object["GzipEnabled"]) + d.Set("http2_enabled", object["Http2Enabled"]) + if v, ok := object["IdleTimeout"]; ok && fmt.Sprint(v) != "0" { + d.Set("idle_timeout", formatInt(v)) + } + d.Set("listener_description", object["ListenerDescription"]) + if v, ok := object["ListenerPort"]; ok && fmt.Sprint(v) != "0" { + d.Set("listener_port", formatInt(v)) + } + d.Set("listener_protocol", object["ListenerProtocol"]) + d.Set("load_balancer_id", object["LoadBalancerId"]) + d.Set("status", object["ListenerStatus"]) + + if quicConfig, ok := object["QuicConfig"]; ok { + quicConfigSli := make([]map[string]interface{}, 0) + if len(quicConfig.(map[string]interface{})) > 0 { + quicConfigMap := make(map[string]interface{}) + quicConfigMap["quic_listener_id"] = quicConfig.(map[string]interface{})["QuicListenerId"] + quicConfigMap["quic_upgrade_enabled"] = quicConfig.(map[string]interface{})["QuicUpgradeEnabled"] + quicConfigSli = append(quicConfigSli, quicConfigMap) + } + d.Set("quic_config", quicConfigSli) + } + + if v, ok := object["RequestTimeout"]; ok && fmt.Sprint(v) != "0" { + d.Set("request_timeout", formatInt(v)) + } + d.Set("security_policy_id", object["SecurityPolicyId"]) + + if xforwardedForConfig, ok := object["XForwardedForConfig"]; ok && len(xforwardedForConfig.(map[string]interface{})) > 0 { + xforwardedForConfigSli := make([]map[string]interface{}, 0) + xforwardedForConfigMap := make(map[string]interface{}) + xforwardedForConfigMap["xforwardedforclientcert_issuerdnalias"] = xforwardedForConfig.(map[string]interface{})["XForwardedForClientCertIssuerDNAlias"] + xforwardedForConfigMap["xforwardedforclientcert_issuerdnenabled"] = xforwardedForConfig.(map[string]interface{})["XForwardedForClientCertIssuerDNEnabled"] + xforwardedForConfigMap["xforwardedforclientcertclientverifyalias"] = xforwardedForConfig.(map[string]interface{})["XForwardedForClientCertClientVerifyAlias"] + xforwardedForConfigMap["xforwardedforclientcertclientverifyenabled"] = xforwardedForConfig.(map[string]interface{})["XForwardedForClientCertClientVerifyEnabled"] + xforwardedForConfigMap["xforwardedforclientcertfingerprintalias"] = xforwardedForConfig.(map[string]interface{})["XForwardedForClientCertFingerprintAlias"] + xforwardedForConfigMap["xforwardedforclientcertfingerprintenabled"] = xforwardedForConfig.(map[string]interface{})["XForwardedForClientCertFingerprintEnabled"] + xforwardedForConfigMap["xforwardedforclientcertsubjectdnalias"] = xforwardedForConfig.(map[string]interface{})["XForwardedForClientCertSubjectDNAlias"] + xforwardedForConfigMap["xforwardedforclientcertsubjectdnenabled"] = xforwardedForConfig.(map[string]interface{})["XForwardedForClientCertSubjectDNEnabled"] + xforwardedForConfigMap["xforwardedforclientsrcportenabled"] = xforwardedForConfig.(map[string]interface{})["XForwardedForClientSrcPortEnabled"] + xforwardedForConfigMap["xforwardedforenabled"] = xforwardedForConfig.(map[string]interface{})["XForwardedForEnabled"] + xforwardedForConfigMap["xforwardedforprotoenabled"] = xforwardedForConfig.(map[string]interface{})["XForwardedForProtoEnabled"] + xforwardedForConfigMap["xforwardedforslbidenabled"] = xforwardedForConfig.(map[string]interface{})["XForwardedForSLBIdEnabled"] + xforwardedForConfigMap["xforwardedforslbportenabled"] = xforwardedForConfig.(map[string]interface{})["XForwardedForSLBPortEnabled"] + xforwardedForConfigSli = append(xforwardedForConfigSli, xforwardedForConfigMap) + d.Set("xforwarded_for_config", xforwardedForConfigSli) + } + return nil +} + +func resourceAlicloudAlbListenerUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + albService := AlbService{client} + var response map[string]interface{} + d.Partial(true) + + update := false + request := map[string]interface{}{ + "ListenerId": d.Id(), + } + if d.HasChange("access_log_record_customized_headers_enabled") || d.IsNewResource() { + if v, ok := d.GetOkExists("access_log_record_customized_headers_enabled"); ok { + update = true + request["AccessLogRecordCustomizedHeadersEnabled"] = v + } + } + if d.HasChange("access_log_tracing_config") { + if v, ok := d.GetOk("access_log_tracing_config"); ok { + update = true + accessLogTracingConfigMap := map[string]interface{}{} + for _, certificates := range v.(*schema.Set).List() { + certificatesArg := certificates.(map[string]interface{}) + accessLogTracingConfigMap["TracingEnabled"] = certificatesArg["tracing_enabled"] + accessLogTracingConfigMap["TracingSample"] = certificatesArg["tracing_sample"] + accessLogTracingConfigMap["TracingType"] = certificatesArg["tracing_type"] + } + request["AccessLogTracingConfig"] = accessLogTracingConfigMap + } + } + if update { + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + action := "UpdateListenerLogConfig" + conn, err := client.NewAlbClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("UpdateListenerLogConfig") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-16"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if IsExpectedErrors(err, []string{"IdempotenceProcessing", "IncorrectBusinessStatus.LoadBalancer", "SystemBusy", "Throttling"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, albService.AlbListenerStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + d.SetPartial("access_log_record_customized_headers_enabled") + d.SetPartial("access_log_tracing_config") + } + update = false + + updateListenerAttributeReq := map[string]interface{}{ + "ListenerId": d.Id(), + } + if d.HasChange("certificates") { + update = true + if v, ok := d.GetOk("certificates"); ok { + certificatesMaps := make([]map[string]interface{}, 0) + for _, certificates := range v.(*schema.Set).List() { + certificatesArg := certificates.(map[string]interface{}) + certificatesMap := map[string]interface{}{} + certificatesMap["CertificateId"] = certificatesArg["certificate_id"] + certificatesMaps = append(certificatesMaps, certificatesMap) + } + updateListenerAttributeReq["Certificates"] = certificatesMaps + } + } + if !d.IsNewResource() && d.HasChange("default_actions") { + update = true + defaultActionsMaps := make([]map[string]interface{}, 0) + for _, defaultActions := range d.Get("default_actions").(*schema.Set).List() { + defaultActionsArg := defaultActions.(map[string]interface{}) + defaultActionsMap := map[string]interface{}{} + defaultActionsMap["Type"] = defaultActionsArg["type"] + forwardGroupConfigMap := map[string]interface{}{} + for _, forwardGroupConfig := range defaultActionsArg["forward_group_config"].(*schema.Set).List() { + forwardGroupConfigArg := forwardGroupConfig.(map[string]interface{}) + serverGroupTuplesMaps := make([]map[string]interface{}, 0) + for _, serverGroupTuples := range forwardGroupConfigArg["server_group_tuples"].(*schema.Set).List() { + serverGroupTuplesArg := serverGroupTuples.(map[string]interface{}) + serverGroupTuplesMap := map[string]interface{}{} + serverGroupTuplesMap["ServerGroupId"] = serverGroupTuplesArg["server_group_id"] + serverGroupTuplesMaps = append(serverGroupTuplesMaps, serverGroupTuplesMap) + } + forwardGroupConfigMap["ServerGroupTuples"] = serverGroupTuplesMaps + } + + defaultActionsMap["ForwardGroupConfig"] = forwardGroupConfigMap + defaultActionsMaps = append(defaultActionsMaps, defaultActionsMap) + } + updateListenerAttributeReq["DefaultActions"] = defaultActionsMaps + } + if !d.IsNewResource() && d.HasChange("server_group_id") { + update = true + updateListenerAttributeReq["DefaultActions.*.ForwardGroupConfig.ServerGroupTuples.*.ServerGroupId"] = d.Get("server_group_id") + } + if !d.IsNewResource() && d.HasChange("type") { + update = true + updateListenerAttributeReq["DefaultActions.*.Type"] = d.Get("type") + } + if !d.IsNewResource() && d.HasChange("gzip_enabled") { + update = true + if v, ok := d.GetOkExists("gzip_enabled"); ok { + updateListenerAttributeReq["GzipEnabled"] = v + } + } + if !d.IsNewResource() && d.HasChange("http2_enabled") { + update = true + if v, ok := d.GetOkExists("http2_enabled"); ok { + updateListenerAttributeReq["Http2Enabled"] = v + } + } + if !d.IsNewResource() && d.HasChange("idle_timeout") { + update = true + if v, ok := d.GetOk("idle_timeout"); ok { + updateListenerAttributeReq["IdleTimeout"] = v + } + } + if !d.IsNewResource() && d.HasChange("listener_description") { + update = true + if v, ok := d.GetOk("listener_description"); ok { + updateListenerAttributeReq["ListenerDescription"] = v + } + } + if d.HasChange("quic_config") { + if v, ok := d.GetOk("quic_config"); ok { + update = true + quicConfigMap := map[string]interface{}{} + + for _, quicConfig := range v.(*schema.Set).List() { + quicConfigArg := quicConfig.(map[string]interface{}) + quicConfigMap["QuicListenerId"] = quicConfigArg["quic_listener_id"] + quicConfigMap["QuicUpgradeEnabled"] = quicConfigArg["quic_upgrade_enabled"] + } + + updateListenerAttributeReq["QuicConfig"] = quicConfigMap + } + } + if !d.IsNewResource() && d.HasChange("request_timeout") { + update = true + if v, ok := d.GetOk("request_timeout"); ok { + updateListenerAttributeReq["RequestTimeout"] = v + } + } + if !d.IsNewResource() && d.HasChange("security_policy_id") { + update = true + if v, ok := d.GetOk("security_policy_id"); ok { + updateListenerAttributeReq["SecurityPolicyId"] = v + } + } + + if !d.IsNewResource() && d.HasChange("xforwarded_for_config") { + update = true + if v, ok := d.GetOk("xforwarded_for_config"); ok { + xforwardedForConfigMap := map[string]interface{}{} + for _, xforwardedForConfig := range v.(*schema.Set).List() { + xforwardedForConfigArg := xforwardedForConfig.(map[string]interface{}) + xforwardedForConfigMap["XForwardedForClientCertIssuerDNAlias"] = xforwardedForConfigArg["xforwardedforclientcert_issuerdnalias"] + xforwardedForConfigMap["XForwardedForClientCertIssuerDNEnabled"] = xforwardedForConfigArg["xforwardedforclientcert_issuerdnenabled"] + xforwardedForConfigMap["XForwardedForClientCertClientVerifyAlias"] = xforwardedForConfigArg["xforwardedforclientcertclientverifyalias"] + xforwardedForConfigMap["XForwardedForClientCertClientVerifyEnabled"] = xforwardedForConfigArg["xforwardedforclientcertclientverifyenabled"] + xforwardedForConfigMap["XForwardedForClientCertFingerprintAlias"] = xforwardedForConfigArg["xforwardedforclientcertfingerprintalias"] + xforwardedForConfigMap["XForwardedForClientCertFingerprintEnabled"] = xforwardedForConfigArg["xforwardedforclientcertfingerprintenabled"] + xforwardedForConfigMap["XForwardedForClientCertSubjectDNAlias"] = xforwardedForConfigArg["xforwardedforclientcertsubjectdnalias"] + xforwardedForConfigMap["XForwardedForClientCertSubjectDNEnabled"] = xforwardedForConfigArg["xforwardedforclientcertsubjectdnenabled"] + xforwardedForConfigMap["XForwardedForClientSrcPortEnabled"] = xforwardedForConfigArg["xforwardedforclientsrcportenabled"] + xforwardedForConfigMap["XForwardedForEnabled"] = xforwardedForConfigArg["xforwardedforenabled"] + xforwardedForConfigMap["XForwardedForProtoEnabled"] = xforwardedForConfigArg["xforwardedforprotoenabled"] + xforwardedForConfigMap["XForwardedForSLBIdEnabled"] = xforwardedForConfigArg["xforwardedforslbidenabled"] + xforwardedForConfigMap["XForwardedForSLBPortEnabled"] = xforwardedForConfigArg["xforwardedforslbportenabled"] + } + + updateListenerAttributeReq["XForwardedForConfig"] = xforwardedForConfigMap + } + } + + if update { + if v, ok := d.GetOkExists("dry_run"); ok { + updateListenerAttributeReq["DryRun"] = v + } + action := "UpdateListenerAttribute" + conn, err := client.NewAlbClient() + if err != nil { + return WrapError(err) + } + updateListenerAttributeReq["ClientToken"] = buildClientToken("UpdateListenerAttribute") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-16"), StringPointer("AK"), nil, updateListenerAttributeReq, &runtime) + if err != nil { + if IsExpectedErrors(err, []string{"IdempotenceProcessing", "IncorrectBusinessStatus.LoadBalancer", "SystemBusy", "Throttling"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, updateListenerAttributeReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Running", "Stopped"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, albService.AlbListenerStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + d.SetPartial("certificates") + d.SetPartial("default_actions") + d.SetPartial("server_group_id") + d.SetPartial("type") + d.SetPartial("gzip_enabled") + d.SetPartial("http2_enabled") + d.SetPartial("idle_timeout") + d.SetPartial("listener_description") + d.SetPartial("quic_config") + d.SetPartial("request_timeout") + d.SetPartial("security_policy_id") + d.SetPartial("xforwarded_for_config") + } + if d.HasChange("status") { + object, err := albService.DescribeAlbListener(d.Id()) + if err != nil { + return WrapError(err) + } + target := d.Get("status").(string) + if object["ListenerStatus"].(string) != target { + if target == "Running" { + request := map[string]interface{}{ + "ListenerId": d.Id(), + } + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + action := "StartListener" + conn, err := client.NewAlbClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("StartListener") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-16"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if IsExpectedErrors(err, []string{"IdempotenceProcessing", "IncorrectBusinessStatus.LoadBalancer", "SystemBusy", "Throttling"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, albService.AlbListenerStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + if target == "Stopped" { + request := map[string]interface{}{ + "ListenerId": d.Id(), + } + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + action := "StopListener" + conn, err := client.NewAlbClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("StopListener") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-16"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if IsExpectedErrors(err, []string{"IdempotenceProcessing", "IncorrectBusinessStatus.LoadBalancer", "SystemBusy", "Throttling"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Stopped"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, albService.AlbListenerStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + d.SetPartial("status") + } + } + d.Partial(false) + if d.HasChange("acl_config") { + oldAssociateAcls, newAssociateVpcs := d.GetChange("acl_config") + oldAssociateAclsSet := oldAssociateAcls.(*schema.Set) + newAssociateAclsSet := newAssociateVpcs.(*schema.Set) + removed := oldAssociateAclsSet.Difference(newAssociateAclsSet) + added := newAssociateAclsSet.Difference(oldAssociateAclsSet) + if removed.Len() > 0 { + action := "DissociateAclsFromListener" + dissociateAclsFromListenerReq := map[string]interface{}{ + "ListenerId": d.Id(), + } + dissociateAclsFromListenerReq["ClientToken"] = buildClientToken("DissociateAclsFromListener") + associateAclIds := make([]string, 0) + for _, aclConfig := range removed.List() { + if aclRelationsMaps, ok := aclConfig.(map[string]interface{})["acl_relations"]; ok { + for _, aclRelationsMap := range aclRelationsMaps.(*schema.Set).List() { + associateAclIds = append(associateAclIds, aclRelationsMap.(map[string]interface{})["acl_id"].(string)) + } + } + } + dissociateAclsFromListenerReq["AclIds"] = associateAclIds + conn, err := client.NewAlbClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-16"), StringPointer("AK"), nil, dissociateAclsFromListenerReq, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, dissociateAclsFromListenerReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, albService.AlbListenerStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + if added.Len() > 0 { + action := "AssociateAclsWithListener" + associateAclsWithListenerReq := map[string]interface{}{ + "ListenerId": d.Id(), + } + associateAclsWithListenerReq["ClientToken"] = buildClientToken("AssociateAclsWithListener") + associateAclIds := make([]string, 0) + for _, aclConfig := range added.List() { + if aclRelationsMaps, ok := aclConfig.(map[string]interface{})["acl_relations"]; ok { + for _, aclRelationsMap := range aclRelationsMaps.(*schema.Set).List() { + associateAclIds = append(associateAclIds, aclRelationsMap.(map[string]interface{})["acl_id"].(string)) + } + } + associateAclsWithListenerReq["AclType"] = aclConfig.(map[string]interface{})["acl_type"] + } + associateAclsWithListenerReq["AclIds"] = associateAclIds + conn, err := client.NewAlbClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-16"), StringPointer("AK"), nil, associateAclsWithListenerReq, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, associateAclsWithListenerReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, albService.AlbListenerStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + } + return resourceAlicloudAlbListenerRead(d, meta) +} + +func resourceAlicloudAlbListenerDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteListener" + var response map[string]interface{} + conn, err := client.NewAlbClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "ListenerId": d.Id(), + } + + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + request["ClientToken"] = buildClientToken("DeleteListener") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-16"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if IsExpectedErrors(err, []string{"IdempotenceProcessing", "ResourceInConfiguring.Listener", "IncorrectBusinessStatus.LoadBalancer", "SystemBusy", "Throttling", "-22031"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"ResourceNotFound.Listener", "ResourceNotFound.LoadBalancer"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_alb_rule.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_alb_rule.go new file mode 100644 index 00000000000..def5814ec9b --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_alb_rule.go @@ -0,0 +1,963 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudAlbRule() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudAlbRuleCreate, + Read: resourceAlicloudAlbRuleRead, + Update: resourceAlicloudAlbRuleUpdate, + Delete: resourceAlicloudAlbRuleDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(2 * time.Minute), + Delete: schema.DefaultTimeout(2 * time.Minute), + Update: schema.DefaultTimeout(2 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "dry_run": { + Type: schema.TypeBool, + Optional: true, + }, + "listener_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "priority": { + Type: schema.TypeInt, + Required: true, + }, + "rule_actions": { + Type: schema.TypeSet, + Required: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "fixed_response_config": { + Type: schema.TypeSet, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "content": { + Type: schema.TypeString, + Required: true, + }, + "content_type": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"text/plain", "text/css", "text/html", "application/javascript", "application/json"}, false), + }, + "http_code": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[2-5][0-9]{2}$`), "The http code must be an HTTP_2xx,HTTP_4xx or HTTP_5xx.x is a digit."), + }, + }, + }, + }, + "forward_group_config": { + Type: schema.TypeSet, + Optional: true, + MaxItems: 1, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "server_group_tuples": { + Type: schema.TypeSet, + Optional: true, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "server_group_id": { + Type: schema.TypeString, + Computed: true, + Optional: true, + }, + }, + }, + }, + }, + }, + }, + "insert_header_config": { + Type: schema.TypeSet, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[A-Za-z0-9_-]{1,40}$`), "The name of the header. The name must be 1 to 40 characters in length and can contain letters, digits, underscores (_), and hyphens (-)."), + }, + "value": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"ClientSrcPort", "ClientSrcIp", "Protocol", "SLBId", "SLBPort", "UserDefined"}, false), + }, + "value_type": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"UserDefined", "ReferenceHeader", "SystemDefined"}, false), + }, + }, + }, + }, + "order": { + Type: schema.TypeInt, + Required: true, + ValidateFunc: validation.IntBetween(1, 50000), + }, + "redirect_config": { + Type: schema.TypeSet, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "host": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-z0-9\-\.\*\?]{3,128}$`), "The host name must be 3 to128 characters in length, and can contain lowercase letters, digits, hyphens (-), periods (.), asterisks (*), and question marks (?)."), + }, + "http_code": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"301", "302", "303", "307", "308"}, false), + }, + "path": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^\/[A-Za-z0-9\$\-_\.\+\/\&\~\@\:]{1,127}$`), "The value must be 1 to 128 characters in length and must start with a forward slash (/). The value can contain letters, digits, and the following special characters: $ - _ .+ / & ~ @ :. It cannot contain the following special characters: \" % # ; ! ( ) [ ]^ , \". The value is case-sensitive and can contain asterisks (*) and question marks (?)."), + }, + "port": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: intBetween(1, 63335), + }, + "protocol": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"HTTP", "HTTPS"}, false), + }, + "query": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(1, 128), + }, + }, + }, + }, + "rewrite_config": { + Type: schema.TypeSet, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "host": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-z0-9\-\.\*\?]{3,128}$`), "The host name must be 3 to128 characters in length, and can contain lowercase letters, digits, hyphens (-), periods (.), asterisks (*), and question marks (?)."), + }, + "path": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^\/[A-Za-z0-9\$\-_\.\+\/\&\~\@\:]{1,127}$`), "The value must be 1 to 128 characters in length and must start with a forward slash (/). The value can contain letters, digits, and the following special characters: $ - _ .+ / & ~ @ :. It cannot contain the following special characters: \" % # ; ! ( ) [ ]^ , \". The value is case-sensitive and can contain asterisks (*) and question marks (?)."), + }, + "query": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(1, 128), + }, + }, + }, + }, + "type": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"ForwardGroup", "Redirect", "FixedResponse", "Rewrite", "InsertHeader"}, false), + }, + }, + }, + }, + "rule_conditions": { + Type: schema.TypeSet, + Required: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "cookie_config": { + Type: schema.TypeSet, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "values": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(1, 100), + }, + "value": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(1, 128), + }, + }, + }, + }, + }, + }, + }, + "header_config": { + Type: schema.TypeSet, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[A-Za-z0-9_-]{1,40}$`), "The name of the header. The name must be 1 to 40 characters in length and can contain letters, digits, underscores (_), and hyphens (-)."), + }, + "values": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + }, + "host_config": { + Type: schema.TypeSet, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "values": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + }, + "method_config": { + Type: schema.TypeSet, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "values": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + }, + "path_config": { + Type: schema.TypeSet, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "values": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + }, + "query_string_config": { + Type: schema.TypeSet, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "values": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(1, 100), + }, + "value": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(1, 128), + }, + }, + }, + }, + }, + }, + }, + "type": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"Host", "Path", "Header", "HTTP", "QueryString", "Method", "Cookie"}, false), + }, + }, + }, + }, + "rule_name": { + Type: schema.TypeString, + Required: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudAlbRuleCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateRule" + request := make(map[string]interface{}) + conn, err := client.NewAlbClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + request["ListenerId"] = d.Get("listener_id") + request["Priority"] = d.Get("priority") + ruleActionsMaps := make([]map[string]interface{}, 0) + for _, ruleActions := range d.Get("rule_actions").(*schema.Set).List() { + ruleActionsArg := ruleActions.(map[string]interface{}) + ruleActionsMap := map[string]interface{}{} + ruleActionsMap["Order"] = ruleActionsArg["order"] + ruleActionsMap["Type"] = ruleActionsArg["type"] + + if ruleActionsMap["Type"] == "" { + continue + } + + fixedResponseConfigMap := map[string]interface{}{} + for _, fixedResponseConfig := range ruleActionsArg["fixed_response_config"].(*schema.Set).List() { + fixedResponseConfigArg := fixedResponseConfig.(map[string]interface{}) + fixedResponseConfigMap["Content"] = fixedResponseConfigArg["content"] + fixedResponseConfigMap["ContentType"] = fixedResponseConfigArg["content_type"] + fixedResponseConfigMap["HttpCode"] = fixedResponseConfigArg["http_code"] + ruleActionsMap["FixedResponseConfig"] = fixedResponseConfigMap + } + + forwardGroupConfigMap := map[string]interface{}{} + for _, forwardGroupConfig := range ruleActionsArg["forward_group_config"].(*schema.Set).List() { + forwardGroupConfigArg := forwardGroupConfig.(map[string]interface{}) + serverGroupTuplesMaps := make([]map[string]interface{}, 0) + for _, serverGroupTuples := range forwardGroupConfigArg["server_group_tuples"].(*schema.Set).List() { + serverGroupTuplesArg := serverGroupTuples.(map[string]interface{}) + serverGroupTuplesMap := map[string]interface{}{} + serverGroupTuplesMap["ServerGroupId"] = serverGroupTuplesArg["server_group_id"] + serverGroupTuplesMaps = append(serverGroupTuplesMaps, serverGroupTuplesMap) + } + forwardGroupConfigMap["ServerGroupTuples"] = serverGroupTuplesMaps + ruleActionsMap["ForwardGroupConfig"] = forwardGroupConfigMap + } + + insertHeaderConfigMap := map[string]interface{}{} + for _, insertHeaderConfig := range ruleActionsArg["insert_header_config"].(*schema.Set).List() { + insertHeaderConfigArg := insertHeaderConfig.(map[string]interface{}) + insertHeaderConfigMap["Key"] = insertHeaderConfigArg["key"] + insertHeaderConfigMap["Value"] = insertHeaderConfigArg["value"] + insertHeaderConfigMap["ValueType"] = insertHeaderConfigArg["value_type"] + ruleActionsMap["InsertHeaderConfig"] = insertHeaderConfigMap + } + + redirectConfigMap := map[string]interface{}{} + for _, redirectConfig := range ruleActionsArg["redirect_config"].(*schema.Set).List() { + redirectConfigArg := redirectConfig.(map[string]interface{}) + redirectConfigMap["Host"] = redirectConfigArg["host"] + redirectConfigMap["HttpCode"] = redirectConfigArg["http_code"] + redirectConfigMap["Path"] = redirectConfigArg["path"] + redirectConfigMap["Port"] = redirectConfigArg["port"] + redirectConfigMap["Protocol"] = redirectConfigArg["protocol"] + redirectConfigMap["Query"] = redirectConfigArg["query"] + ruleActionsMap["RedirectConfig"] = redirectConfigMap + } + + rewriteConfigMap := map[string]interface{}{} + for _, rewriteConfig := range ruleActionsArg["rewrite_config"].(*schema.Set).List() { + rewriteConfigArg := rewriteConfig.(map[string]interface{}) + rewriteConfigMap["Host"] = rewriteConfigArg["host"] + rewriteConfigMap["Path"] = rewriteConfigArg["path"] + rewriteConfigMap["Query"] = rewriteConfigArg["query"] + ruleActionsMap["RewriteConfig"] = rewriteConfigMap + } + + ruleActionsMaps = append(ruleActionsMaps, ruleActionsMap) + } + request["RuleActions"] = ruleActionsMaps + + ruleConditionsMaps := make([]map[string]interface{}, 0) + for _, ruleConditions := range d.Get("rule_conditions").(*schema.Set).List() { + ruleConditionsArg := ruleConditions.(map[string]interface{}) + ruleConditionsMap := map[string]interface{}{} + ruleConditionsMap["Type"] = ruleConditionsArg["type"] + + cookieConfigMap := map[string]interface{}{} + for _, cookieConfig := range ruleConditionsArg["cookie_config"].(*schema.Set).List() { + cookieConfigArg := cookieConfig.(map[string]interface{}) + valuesMaps := make([]map[string]interface{}, 0) + for _, values := range cookieConfigArg["values"].(*schema.Set).List() { + valuesArg := values.(map[string]interface{}) + valuesMap := map[string]interface{}{} + valuesMap["Key"] = valuesArg["key"] + valuesMap["Value"] = valuesArg["value"] + valuesMaps = append(valuesMaps, valuesMap) + } + cookieConfigMap["Values"] = valuesMaps + ruleConditionsMap["CookieConfig"] = cookieConfigMap + } + + headerConfigMap := map[string]interface{}{} + for _, headerConfig := range ruleConditionsArg["header_config"].(*schema.Set).List() { + headerConfigArg := headerConfig.(map[string]interface{}) + headerConfigMap["Key"] = headerConfigArg["key"] + headerConfigMap["Values"] = headerConfigArg["values"].(*schema.Set).List() + ruleConditionsMap["HeaderConfig"] = headerConfigMap + } + + hostConfigMap := map[string]interface{}{} + for _, hostConfig := range ruleConditionsArg["host_config"].(*schema.Set).List() { + hostConfigArg := hostConfig.(map[string]interface{}) + hostConfigMap["Values"] = hostConfigArg["values"].(*schema.Set).List() + ruleConditionsMap["HostConfig"] = hostConfigMap + } + + methodConfigMap := map[string]interface{}{} + for _, methodConfig := range ruleConditionsArg["method_config"].(*schema.Set).List() { + methodConfigArg := methodConfig.(map[string]interface{}) + methodConfigMap["Values"] = methodConfigArg["values"].(*schema.Set).List() + ruleConditionsMap["MethodConfig"] = methodConfigMap + } + + pathConfigMap := map[string]interface{}{} + for _, pathConfig := range ruleConditionsArg["path_config"].(*schema.Set).List() { + pathConfigArg := pathConfig.(map[string]interface{}) + pathConfigMap["Values"] = pathConfigArg["values"].(*schema.Set).List() + ruleConditionsMap["PathConfig"] = pathConfigMap + } + + queryStringConfigMap := map[string]interface{}{} + for _, queryStringConfig := range ruleConditionsArg["query_string_config"].(*schema.Set).List() { + queryStringConfigArg := queryStringConfig.(map[string]interface{}) + valuesMaps := make([]map[string]interface{}, 0) + for _, values := range queryStringConfigArg["values"].(*schema.Set).List() { + valuesArg := values.(map[string]interface{}) + valuesMap := map[string]interface{}{} + valuesMap["Key"] = valuesArg["key"] + valuesMap["Value"] = valuesArg["value"] + valuesMaps = append(valuesMaps, valuesMap) + } + queryStringConfigMap["Values"] = valuesMaps + ruleConditionsMap["QueryStringConfig"] = queryStringConfigMap + } + + ruleConditionsMaps = append(ruleConditionsMaps, ruleConditionsMap) + } + request["RuleConditions"] = ruleConditionsMaps + + request["RuleName"] = d.Get("rule_name") + request["ClientToken"] = buildClientToken("CreateRule") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-16"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if IsExpectedErrors(err, []string{"IdempotenceProcessing", "IncorrectStatus.Listener", "SystemBusy", "Throttling"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_alb_rule", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["RuleId"])) + albService := AlbService{client} + stateConf := BuildStateConf([]string{}, []string{"Available"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, albService.AlbRuleStateRefreshFunc(d.Id(), []string{"CreateFailed"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return resourceAlicloudAlbRuleRead(d, meta) +} +func resourceAlicloudAlbRuleRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + albService := AlbService{client} + object, err := albService.DescribeAlbRule(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_alb_rule albService.DescribeAlbRule Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("listener_id", object["ListenerId"]) + if v, ok := object["Priority"]; ok && fmt.Sprint(v) != "0" { + d.Set("priority", formatInt(v)) + } + + if ruleActionsList, ok := object["RuleActions"]; ok { + ruleActionsMaps := make([]map[string]interface{}, 0) + for _, ruleActions := range ruleActionsList.([]interface{}) { + ruleActionsArg := ruleActions.(map[string]interface{}) + ruleActionsMap := map[string]interface{}{} + ruleActionsMap["type"] = ruleActionsArg["Type"] + ruleActionsMap["order"] = formatInt(ruleActionsArg["Order"]) + + if forwardGroupConfig, ok := ruleActionsArg["ForwardGroupConfig"]; ok { + forwardGroupConfigArg := forwardGroupConfig.(map[string]interface{}) + if len(forwardGroupConfigArg) > 0 { + serverGroupTuplesMaps := make([]map[string]interface{}, 0) + if forwardGroupConfigArgs, ok := forwardGroupConfigArg["ServerGroupTuples"].([]interface{}); ok { + for _, serverGroupTuples := range forwardGroupConfigArgs { + serverGroupTuplesArg := serverGroupTuples.(map[string]interface{}) + serverGroupTuplesMap := map[string]interface{}{} + serverGroupTuplesMap["server_group_id"] = serverGroupTuplesArg["ServerGroupId"] + serverGroupTuplesMaps = append(serverGroupTuplesMaps, serverGroupTuplesMap) + } + } + if len(serverGroupTuplesMaps) > 0 { + forwardGroupConfigMaps := make([]map[string]interface{}, 0) + forwardGroupConfigMap := map[string]interface{}{} + forwardGroupConfigMap["server_group_tuples"] = serverGroupTuplesMaps + forwardGroupConfigMaps = append(forwardGroupConfigMaps, forwardGroupConfigMap) + ruleActionsMap["forward_group_config"] = forwardGroupConfigMaps + ruleActionsMaps = append(ruleActionsMaps, ruleActionsMap) + } + } + } + + if fixedResponseConfig, ok := ruleActionsArg["FixedResponseConfig"]; ok { + fixedResponseConfigArg := fixedResponseConfig.(map[string]interface{}) + if len(fixedResponseConfigArg) > 0 { + fixedResponseConfigMaps := make([]map[string]interface{}, 0) + fixedResponseConfigMap := make(map[string]interface{}, 0) + fixedResponseConfigMap["content"] = fixedResponseConfigArg["Content"] + fixedResponseConfigMap["content_type"] = fixedResponseConfigArg["ContentType"] + fixedResponseConfigMap["http_code"] = fixedResponseConfigArg["HttpCode"] + fixedResponseConfigMaps = append(fixedResponseConfigMaps, fixedResponseConfigMap) + ruleActionsMap["fixed_response_config"] = fixedResponseConfigMaps + ruleActionsMaps = append(ruleActionsMaps, ruleActionsMap) + } + } + + if insertHeaderConfig, ok := ruleActionsArg["InsertHeaderConfig"]; ok { + insertHeaderConfigArg := insertHeaderConfig.(map[string]interface{}) + if len(insertHeaderConfigArg) > 0 { + insertHeaderConfigMaps := make([]map[string]interface{}, 0) + insertHeaderConfigMap := make(map[string]interface{}, 0) + insertHeaderConfigMap["key"] = insertHeaderConfigArg["Key"] + insertHeaderConfigMap["value"] = insertHeaderConfigArg["Value"] + insertHeaderConfigMap["value_type"] = insertHeaderConfigArg["ValueType"] + insertHeaderConfigMaps = append(insertHeaderConfigMaps, insertHeaderConfigMap) + ruleActionsMap["insert_header_config"] = insertHeaderConfigMaps + ruleActionsMaps = append(ruleActionsMaps, ruleActionsMap) + } + } + + if redirectConfig, ok := ruleActionsArg["RedirectConfig"]; ok { + redirectConfigArg := redirectConfig.(map[string]interface{}) + if len(redirectConfigArg) > 0 { + redirectConfigMaps := make([]map[string]interface{}, 0) + redirectConfigMap := make(map[string]interface{}, 0) + redirectConfigMap["host"] = redirectConfigArg["Host"] + redirectConfigMap["http_code"] = redirectConfigArg["HttpCode"] + redirectConfigMap["path"] = redirectConfigArg["Path"] + redirectConfigMap["port"] = formatInt(redirectConfigArg["Port"]) + redirectConfigMap["protocol"] = redirectConfigArg["Protocol"] + redirectConfigMap["query"] = redirectConfigArg["Query"] + redirectConfigMaps = append(redirectConfigMaps, redirectConfigMap) + ruleActionsMap["redirect_config"] = redirectConfigMaps + ruleActionsMaps = append(ruleActionsMaps, ruleActionsMap) + } + } + + if rewriteConfig, ok := ruleActionsArg["RewriteConfig"]; ok { + rewriteConfigArg := rewriteConfig.(map[string]interface{}) + if len(rewriteConfigArg) > 0 { + rewriteConfigMaps := make([]map[string]interface{}, 0) + rewriteConfigMap := make(map[string]interface{}, 0) + rewriteConfigMap["host"] = rewriteConfigArg["Host"] + rewriteConfigMap["path"] = rewriteConfigArg["Path"] + rewriteConfigMap["query"] = rewriteConfigArg["Query"] + rewriteConfigMaps = append(rewriteConfigMaps, rewriteConfigMap) + ruleActionsMap["rewrite_config"] = rewriteConfigMaps + ruleActionsMaps = append(ruleActionsMaps, ruleActionsMap) + } + } + } + d.Set("rule_actions", ruleActionsMaps) + } + + if ruleConditionsList, ok := object["RuleConditions"]; ok { + ruleConditionsMaps := make([]map[string]interface{}, 0) + for _, ruleConditions := range ruleConditionsList.([]interface{}) { + ruleConditionsArg := ruleConditions.(map[string]interface{}) + ruleConditionsMap := map[string]interface{}{} + ruleConditionsMap["type"] = ruleConditionsArg["Type"] + + if cookieConfig, ok := ruleConditionsArg["CookieConfig"]; ok { + cookieConfigArg := cookieConfig.(map[string]interface{}) + if len(cookieConfigArg) > 0 { + cookieConfigMaps := make([]map[string]interface{}, 0) + valuesMaps := make([]map[string]interface{}, 0) + for _, values := range cookieConfigArg["Values"].([]interface{}) { + valuesArg := values.(map[string]interface{}) + valuesMap := map[string]interface{}{} + valuesMap["key"] = valuesArg["Key"] + valuesMap["value"] = valuesArg["Value"] + valuesMaps = append(valuesMaps, valuesMap) + } + cookieConfigMap := map[string]interface{}{} + cookieConfigMap["values"] = valuesMaps + cookieConfigMaps = append(cookieConfigMaps, cookieConfigMap) + ruleConditionsMap["cookie_config"] = cookieConfigMaps + ruleConditionsMaps = append(ruleConditionsMaps, ruleConditionsMap) + } + } + + if headerConfig, ok := ruleConditionsArg["HeaderConfig"]; ok { + headerConfigArg := headerConfig.(map[string]interface{}) + if len(headerConfigArg) > 0 { + headerConfigMaps := make([]map[string]interface{}, 0) + headerConfigMap := map[string]interface{}{} + headerConfigMap["values"] = headerConfigArg["Values"].([]interface{}) + headerConfigMap["key"] = headerConfigArg["Key"] + headerConfigMaps = append(headerConfigMaps, headerConfigMap) + ruleConditionsMap["header_config"] = headerConfigMaps + ruleConditionsMaps = append(ruleConditionsMaps, ruleConditionsMap) + } + } + + if queryStringConfig, ok := ruleConditionsArg["QueryStringConfig"]; ok { + queryStringConfigArg := queryStringConfig.(map[string]interface{}) + if len(queryStringConfigArg) > 0 { + queryStringConfigMaps := make([]map[string]interface{}, 0) + queryStringValuesMaps := make([]map[string]interface{}, 0) + for _, values := range queryStringConfigArg["Values"].([]interface{}) { + valuesArg := values.(map[string]interface{}) + valuesMap := map[string]interface{}{} + valuesMap["key"] = valuesArg["Key"] + valuesMap["value"] = valuesArg["Value"] + queryStringValuesMaps = append(queryStringValuesMaps, valuesMap) + } + queryStringConfigMap := map[string]interface{}{} + queryStringConfigMap["values"] = queryStringValuesMaps + queryStringConfigMaps = append(queryStringConfigMaps, queryStringConfigMap) + ruleConditionsMap["query_string_config"] = queryStringConfigMaps + ruleConditionsMaps = append(ruleConditionsMaps, ruleConditionsMap) + } + } + + if hostConfig, ok := ruleConditionsArg["HostConfig"]; ok { + hostConfigArg := hostConfig.(map[string]interface{}) + if len(hostConfigArg) > 0 { + hostConfigMaps := make([]map[string]interface{}, 0) + hostConfigMap := map[string]interface{}{} + hostConfigMap["values"] = hostConfigArg["Values"].([]interface{}) + hostConfigMaps = append(hostConfigMaps, hostConfigMap) + ruleConditionsMap["host_config"] = hostConfigMaps + ruleConditionsMaps = append(ruleConditionsMaps, ruleConditionsMap) + } + } + + if methodConfig, ok := ruleConditionsArg["MethodConfig"]; ok { + methodConfigArg := methodConfig.(map[string]interface{}) + if len(methodConfigArg) > 0 { + methodConfigMaps := make([]map[string]interface{}, 0) + methodConfigMap := map[string]interface{}{} + methodConfigMap["values"] = methodConfigArg["Values"].([]interface{}) + methodConfigMaps = append(methodConfigMaps, methodConfigMap) + ruleConditionsMap["method_config"] = methodConfigMaps + ruleConditionsMaps = append(ruleConditionsMaps, ruleConditionsMap) + } + } + + if pathConfig, ok := ruleConditionsArg["PathConfig"]; ok { + pathConfigArg := pathConfig.(map[string]interface{}) + if len(pathConfigArg) > 0 { + pathConfigMaps := make([]map[string]interface{}, 0) + pathConfigMap := map[string]interface{}{} + pathConfigMap["values"] = pathConfigArg["Values"].([]interface{}) + pathConfigMaps = append(pathConfigMaps, pathConfigMap) + ruleConditionsMap["path_config"] = pathConfigMaps + ruleConditionsMaps = append(ruleConditionsMaps, ruleConditionsMap) + } + } + } + + d.Set("rule_conditions", ruleConditionsMaps) + } + + d.Set("rule_name", object["RuleName"]) + d.Set("status", object["RuleStatus"]) + return nil +} +func resourceAlicloudAlbRuleUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "RuleId": d.Id(), + } + if d.HasChange("priority") { + update = true + request["Priority"] = d.Get("priority") + } + if d.HasChange("rule_name") { + update = true + request["RuleName"] = d.Get("rule_name") + } + + if d.HasChange("rule_actions") { + update = true + ruleActionsMaps := make([]map[string]interface{}, 0) + for _, ruleActions := range d.Get("rule_actions").(*schema.Set).List() { + ruleActionsArg := ruleActions.(map[string]interface{}) + ruleActionsMap := map[string]interface{}{} + ruleActionsMap["Order"] = ruleActionsArg["order"] + ruleActionsMap["Type"] = ruleActionsArg["type"] + + if ruleActionsMap["Type"] == "" { + continue + } + + fixedResponseConfigMap := map[string]interface{}{} + for _, fixedResponseConfig := range ruleActionsArg["fixed_response_config"].(*schema.Set).List() { + fixedResponseConfigArg := fixedResponseConfig.(map[string]interface{}) + fixedResponseConfigMap["Content"] = fixedResponseConfigArg["content"] + fixedResponseConfigMap["ContentType"] = fixedResponseConfigArg["content_type"] + fixedResponseConfigMap["HttpCode"] = fixedResponseConfigArg["http_code"] + ruleActionsMap["FixedResponseConfig"] = fixedResponseConfigMap + } + + forwardGroupConfigMap := map[string]interface{}{} + for _, forwardGroupConfig := range ruleActionsArg["forward_group_config"].(*schema.Set).List() { + forwardGroupConfigArg := forwardGroupConfig.(map[string]interface{}) + serverGroupTuplesMaps := make([]map[string]interface{}, 0) + for _, serverGroupTuples := range forwardGroupConfigArg["server_group_tuples"].(*schema.Set).List() { + serverGroupTuplesArg := serverGroupTuples.(map[string]interface{}) + serverGroupTuplesMap := map[string]interface{}{} + serverGroupTuplesMap["ServerGroupId"] = serverGroupTuplesArg["server_group_id"] + serverGroupTuplesMaps = append(serverGroupTuplesMaps, serverGroupTuplesMap) + } + forwardGroupConfigMap["ServerGroupTuples"] = serverGroupTuplesMaps + ruleActionsMap["ForwardGroupConfig"] = forwardGroupConfigMap + } + + insertHeaderConfigMap := map[string]interface{}{} + for _, insertHeaderConfig := range ruleActionsArg["insert_header_config"].(*schema.Set).List() { + insertHeaderConfigArg := insertHeaderConfig.(map[string]interface{}) + insertHeaderConfigMap["Key"] = insertHeaderConfigArg["key"] + insertHeaderConfigMap["Value"] = insertHeaderConfigArg["value"] + insertHeaderConfigMap["ValueType"] = insertHeaderConfigArg["value_type"] + ruleActionsMap["InsertHeaderConfig"] = insertHeaderConfigMap + } + + redirectConfigMap := map[string]interface{}{} + for _, redirectConfig := range ruleActionsArg["redirect_config"].(*schema.Set).List() { + redirectConfigArg := redirectConfig.(map[string]interface{}) + redirectConfigMap["Host"] = redirectConfigArg["host"] + redirectConfigMap["HttpCode"] = redirectConfigArg["http_code"] + redirectConfigMap["Path"] = redirectConfigArg["path"] + redirectConfigMap["Port"] = redirectConfigArg["port"] + redirectConfigMap["Protocol"] = redirectConfigArg["protocol"] + redirectConfigMap["Query"] = redirectConfigArg["query"] + ruleActionsMap["RedirectConfig"] = redirectConfigMap + } + + rewriteConfigMap := map[string]interface{}{} + for _, rewriteConfig := range ruleActionsArg["rewrite_config"].(*schema.Set).List() { + rewriteConfigArg := rewriteConfig.(map[string]interface{}) + rewriteConfigMap["Host"] = rewriteConfigArg["host"] + rewriteConfigMap["Path"] = rewriteConfigArg["path"] + rewriteConfigMap["Query"] = rewriteConfigArg["query"] + ruleActionsMap["RewriteConfig"] = rewriteConfigMap + } + + ruleActionsMaps = append(ruleActionsMaps, ruleActionsMap) + } + request["RuleActions"] = ruleActionsMaps + } + + if d.HasChange("rule_conditions") { + update = true + ruleConditionsMaps := make([]map[string]interface{}, 0) + for _, ruleConditions := range d.Get("rule_conditions").(*schema.Set).List() { + ruleConditionsArg := ruleConditions.(map[string]interface{}) + ruleConditionsMap := map[string]interface{}{} + ruleConditionsMap["Type"] = ruleConditionsArg["type"] + + cookieConfigMap := map[string]interface{}{} + for _, cookieConfig := range ruleConditionsArg["cookie_config"].(*schema.Set).List() { + cookieConfigArg := cookieConfig.(map[string]interface{}) + valuesMaps := make([]map[string]interface{}, 0) + for _, values := range cookieConfigArg["values"].(*schema.Set).List() { + valuesArg := values.(map[string]interface{}) + valuesMap := map[string]interface{}{} + valuesMap["Key"] = valuesArg["key"] + valuesMap["Value"] = valuesArg["value"] + valuesMaps = append(valuesMaps, valuesMap) + } + cookieConfigMap["Values"] = valuesMaps + ruleConditionsMap["CookieConfig"] = cookieConfigMap + } + + headerConfigMap := map[string]interface{}{} + for _, headerConfig := range ruleConditionsArg["header_config"].(*schema.Set).List() { + headerConfigArg := headerConfig.(map[string]interface{}) + headerConfigMap["Key"] = headerConfigArg["key"] + headerConfigMap["Values"] = headerConfigArg["values"].(*schema.Set).List() + ruleConditionsMap["HeaderConfig"] = headerConfigMap + } + + hostConfigMap := map[string]interface{}{} + for _, hostConfig := range ruleConditionsArg["host_config"].(*schema.Set).List() { + hostConfigArg := hostConfig.(map[string]interface{}) + hostConfigMap["Values"] = hostConfigArg["values"].(*schema.Set).List() + ruleConditionsMap["HostConfig"] = hostConfigMap + } + + methodConfigMap := map[string]interface{}{} + for _, methodConfig := range ruleConditionsArg["method_config"].(*schema.Set).List() { + methodConfigArg := methodConfig.(map[string]interface{}) + methodConfigMap["Values"] = methodConfigArg["values"].(*schema.Set).List() + ruleConditionsMap["MethodConfig"] = methodConfigMap + } + + pathConfigMap := map[string]interface{}{} + for _, pathConfig := range ruleConditionsArg["path_config"].(*schema.Set).List() { + pathConfigArg := pathConfig.(map[string]interface{}) + pathConfigMap["Values"] = pathConfigArg["values"].(*schema.Set).List() + ruleConditionsMap["PathConfig"] = pathConfigMap + } + + queryStringConfigMap := map[string]interface{}{} + for _, queryStringConfig := range ruleConditionsArg["query_string_config"].(*schema.Set).List() { + queryStringConfigArg := queryStringConfig.(map[string]interface{}) + valuesMaps := make([]map[string]interface{}, 0) + for _, values := range queryStringConfigArg["values"].(*schema.Set).List() { + valuesArg := values.(map[string]interface{}) + valuesMap := map[string]interface{}{} + valuesMap["Key"] = valuesArg["key"] + valuesMap["Value"] = valuesArg["value"] + valuesMaps = append(valuesMaps, valuesMap) + } + queryStringConfigMap["Values"] = valuesMaps + ruleConditionsMap["QueryStringConfig"] = queryStringConfigMap + } + + ruleConditionsMaps = append(ruleConditionsMaps, ruleConditionsMap) + } + request["RuleConditions"] = ruleConditionsMaps + } + + if update { + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + action := "UpdateRuleAttribute" + conn, err := client.NewAlbClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("UpdateRuleAttribute") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-16"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + albService := AlbService{client} + stateConf := BuildStateConf([]string{}, []string{"Available"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, albService.AlbRuleStateRefreshFunc(d.Id(), []string{"CreateFailed"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + return resourceAlicloudAlbRuleRead(d, meta) +} +func resourceAlicloudAlbRuleDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteRule" + var response map[string]interface{} + conn, err := client.NewAlbClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "RuleId": d.Id(), + } + + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + request["ClientToken"] = buildClientToken("DeleteRule") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-16"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if IsExpectedErrors(err, []string{"IdempotenceProcessing", "IncorrectStatus.Rule", "SystemBusy", "Throttling"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"ResourceNotFound.Rule"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_alidns_access_strategy.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_alidns_access_strategy.go new file mode 100644 index 00000000000..e7f2529e40d --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_alidns_access_strategy.go @@ -0,0 +1,538 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudAlidnsAccessStrategy() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudAlidnsAccessStrategyCreate, + Read: resourceAlicloudAlidnsAccessStrategyRead, + Update: resourceAlicloudAlidnsAccessStrategyUpdate, + Delete: resourceAlicloudAlidnsAccessStrategyDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "access_mode": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"AUTO", "DEFAULT", "FAILOVER"}, false), + }, + "default_addr_pool_type": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"IPV4", "IPV6", "DOMAIN"}, false), + }, + "lines": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "line_code": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "default_addr_pools": { + Type: schema.TypeSet, + Required: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "addr_pool_id": { + Type: schema.TypeString, + Required: true, + }, + "lba_weight": { + Type: schema.TypeInt, + Optional: true, + }, + }, + }, + }, + "default_latency_optimization": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"OPEN", "CLOSE"}, false), + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("strategy_mode"); ok && v.(string) == "LATENCY" { + return false + } + return true + }, + }, + "default_lba_strategy": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"ALL_RR", "RATIO"}, false), + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("strategy_mode"); ok && v.(string) == "GEO" { + return false + } + return true + }, + }, + "default_max_return_addr_num": { + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("strategy_mode"); ok && v.(string) == "LATENCY" { + return false + } + return true + }, + }, + "default_min_available_addr_num": { + Type: schema.TypeInt, + Required: true, + }, + "failover_addr_pool_type": { + Type: schema.TypeString, + Optional: true, + }, + "failover_addr_pools": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "addr_pool_id": { + Type: schema.TypeString, + Optional: true, + }, + "lba_weight": { + Type: schema.TypeInt, + Optional: true, + }, + }, + }, + }, + "failover_latency_optimization": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"OPEN", "CLOSE"}, false), + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("strategy_mode"); ok && v.(string) == "LATENCY" { + return false + } + return true + }, + }, + "failover_lba_strategy": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"ALL_RR", "RATIO"}, false), + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("strategy_mode"); ok && v.(string) == "GEO" { + return false + } + return true + }, + }, + "failover_max_return_addr_num": { + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("strategy_mode"); ok && v.(string) == "LATENCY" { + return false + } + return true + }, + }, + "failover_min_available_addr_num": { + Type: schema.TypeInt, + Optional: true, + }, + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "lang": { + Type: schema.TypeString, + Optional: true, + }, + "strategy_mode": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"GEO", "LATENCY"}, false), + }, + "strategy_name": { + Type: schema.TypeString, + Required: true, + }, + }, + } +} + +func resourceAlicloudAlidnsAccessStrategyCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "AddDnsGtmAccessStrategy" + request := make(map[string]interface{}) + conn, err := client.NewAlidnsClient() + if err != nil { + return WrapError(err) + } + + request["DefaultAddrPoolType"] = d.Get("default_addr_pool_type") + if v, ok := d.GetOk("default_latency_optimization"); ok { + request["DefaultLatencyOptimization"] = v + } + if v, ok := d.GetOk("default_lba_strategy"); ok { + request["DefaultLbaStrategy"] = v + } + if v, ok := d.GetOk("default_max_return_addr_num"); ok { + request["DefaultMaxReturnAddrNum"] = v + } + request["DefaultMinAvailableAddrNum"] = d.Get("default_min_available_addr_num") + if v, ok := d.GetOk("lines"); ok { + lines := make([]interface{}, 0) + for _, line := range v.(*schema.Set).List() { + lineArg := line.(map[string]interface{}) + if v, ok := lineArg["line_code"]; ok && fmt.Sprint(v) != "" { + lines = append(lines, v) + } + } + request["Lines"] = convertListToJsonString(lines) + } + if v, ok := d.GetOk("failover_addr_pools"); ok { + failoverAddrPoolMaps := make([]map[string]interface{}, 0) + for _, failoverAddrPool := range v.(*schema.Set).List() { + failoverAddrPoolArg := failoverAddrPool.(map[string]interface{}) + failoverAddrPoolMap := map[string]interface{}{} + failoverAddrPoolMap["Id"] = failoverAddrPoolArg["addr_pool_id"] + if v, ok := failoverAddrPoolArg["lba_weight"]; ok && fmt.Sprint(v) != "0" { + failoverAddrPoolMap["LbaWeight"] = v + } + failoverAddrPoolMaps = append(failoverAddrPoolMaps, failoverAddrPoolMap) + } + request["FailoverAddrPool"] = failoverAddrPoolMaps + } + if v, ok := d.GetOk("default_addr_pools"); ok { + defaultAddrPoolMaps := make([]map[string]interface{}, 0) + for _, defaultAddrPool := range v.(*schema.Set).List() { + defaultAddrPoolArg := defaultAddrPool.(map[string]interface{}) + defaultAddrPoolMap := map[string]interface{}{} + defaultAddrPoolMap["Id"] = defaultAddrPoolArg["addr_pool_id"] + if v, ok := defaultAddrPoolArg["lba_weight"]; ok && fmt.Sprint(v) != "0" { + defaultAddrPoolMap["LbaWeight"] = v + } + defaultAddrPoolMaps = append(defaultAddrPoolMaps, defaultAddrPoolMap) + } + request["DefaultAddrPool"] = defaultAddrPoolMaps + } + if v, ok := d.GetOk("failover_addr_pool_type"); ok { + request["FailoverAddrPoolType"] = v + } + if v, ok := d.GetOk("failover_latency_optimization"); ok { + request["FailoverLatencyOptimization"] = v + } + if v, ok := d.GetOk("failover_lba_strategy"); ok { + request["FailoverLbaStrategy"] = v + } + if v, ok := d.GetOk("failover_max_return_addr_num"); ok { + request["FailoverMaxReturnAddrNum"] = v + } + if v, ok := d.GetOk("failover_min_available_addr_num"); ok { + request["FailoverMinAvailableAddrNum"] = v + } + request["InstanceId"] = d.Get("instance_id") + if v, ok := d.GetOk("lang"); ok { + request["Lang"] = v + } + request["StrategyMode"] = d.Get("strategy_mode") + request["StrategyName"] = d.Get("strategy_name") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-01-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_alidns_access_strategy", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["StrategyId"])) + + return resourceAlicloudAlidnsAccessStrategyRead(d, meta) +} +func resourceAlicloudAlidnsAccessStrategyRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + alidnsService := AlidnsService{client} + object, err := alidnsService.DescribeAlidnsAccessStrategy(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_alidns_access_strategy alidnsService.DescribeAlidnsAccessStrategy Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("default_addr_pool_type", object["DefaultAddrPoolType"]) + if defaultAddrPoolsMap, ok := object["DefaultAddrPools"].(map[string]interface{}); ok && defaultAddrPoolsMap != nil { + if defaultAddrPoolList, ok := defaultAddrPoolsMap["DefaultAddrPool"]; ok && defaultAddrPoolList != nil { + defaultAddrPoolsMaps := make([]map[string]interface{}, 0) + for _, defaultAddrPoolListItem := range defaultAddrPoolList.([]interface{}) { + if v, ok := defaultAddrPoolListItem.(map[string]interface{}); ok { + defaultAddrPoolListItemMap := make(map[string]interface{}, 0) + defaultAddrPoolListItemMap["addr_pool_id"] = v["Id"] + defaultAddrPoolListItemMap["lba_weight"] = v["LbaWeight"] + defaultAddrPoolsMaps = append(defaultAddrPoolsMaps, defaultAddrPoolListItemMap) + } + } + d.Set("default_addr_pools", defaultAddrPoolsMaps) + } + } + + d.Set("default_latency_optimization", object["DefaultLatencyOptimization"]) + d.Set("default_lba_strategy", object["DefaultLbaStrategy"]) + if v, ok := object["DefaultMaxReturnAddrNum"]; ok { + d.Set("default_max_return_addr_num", formatInt(v)) + } + if v, ok := object["DefaultMinAvailableAddrNum"]; ok { + d.Set("default_min_available_addr_num", formatInt(v)) + } + d.Set("failover_addr_pool_type", object["FailoverAddrPoolType"]) + if failoverAddrPoolsMap, ok := object["FailoverAddrPools"].(map[string]interface{}); ok && failoverAddrPoolsMap != nil { + if failoverAddrPoolList, ok := failoverAddrPoolsMap["FailoverAddrPool"]; ok && failoverAddrPoolList != nil { + failoverAddrPoolsMaps := make([]map[string]interface{}, 0) + for _, failoverAddrPoolListItem := range failoverAddrPoolList.([]interface{}) { + if v, ok := failoverAddrPoolListItem.(map[string]interface{}); ok { + failoverAddrPoolListItemMap := make(map[string]interface{}, 0) + failoverAddrPoolListItemMap["addr_pool_id"] = v["Id"] + failoverAddrPoolListItemMap["lba_weight"] = v["LbaWeight"] + failoverAddrPoolsMaps = append(failoverAddrPoolsMaps, failoverAddrPoolListItemMap) + } + } + d.Set("failover_addr_pools", failoverAddrPoolsMaps) + } + } + if LinesMap, ok := object["Lines"].(map[string]interface{}); ok && LinesMap != nil { + if LineList, ok := LinesMap["Line"]; ok && LineList != nil { + LinesMaps := make([]map[string]interface{}, 0) + for _, lineListItem := range LineList.([]interface{}) { + if v, ok := lineListItem.(map[string]interface{}); ok { + lineListItemMap := make(map[string]interface{}, 0) + lineListItemMap["line_code"] = v["LineCode"] + LinesMaps = append(LinesMaps, lineListItemMap) + } + } + d.Set("lines", LinesMaps) + } + } + + d.Set("failover_latency_optimization", object["FailoverLatencyOptimization"]) + d.Set("failover_lba_strategy", object["FailoverLbaStrategy"]) + if v, ok := object["FailoverMaxReturnAddrNum"]; ok { + d.Set("failover_max_return_addr_num", formatInt(v)) + } + if v, ok := object["FailoverMinAvailableAddrNum"]; ok { + d.Set("failover_min_available_addr_num", formatInt(v)) + } + d.Set("instance_id", object["InstanceId"]) + d.Set("strategy_mode", object["StrategyMode"]) + d.Set("strategy_name", object["StrategyName"]) + d.Set("access_mode", object["AccessMode"]) + return nil +} +func resourceAlicloudAlidnsAccessStrategyUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + + update := false + request := map[string]interface{}{ + "StrategyId": d.Id(), + } + if d.HasChange("access_mode") { + update = true + if v, ok := d.GetOk("access_mode"); ok { + request["AccessMode"] = v + } + } + if d.HasChange("default_addr_pool_type") { + update = true + } + request["DefaultAddrPoolType"] = d.Get("default_addr_pool_type") + if d.HasChange("lines") { + update = true + } + if v, ok := d.GetOk("lines"); ok { + lines := make([]interface{}, 0) + for _, line := range v.(*schema.Set).List() { + lineArg := line.(map[string]interface{}) + if v, ok := lineArg["line_code"]; ok && fmt.Sprint(v) != "" { + lines = append(lines, v) + } + } + request["Lines"] = convertListToJsonString(lines) + } + + if d.HasChange("default_min_available_addr_num") { + update = true + } + request["DefaultMinAvailableAddrNum"] = d.Get("default_min_available_addr_num") + + if d.HasChange("strategy_name") { + update = true + } + request["StrategyName"] = d.Get("strategy_name") + if d.HasChange("default_latency_optimization") { + update = true + } + if v, ok := d.GetOk("default_latency_optimization"); ok { + request["DefaultLatencyOptimization"] = v + } + if d.HasChange("default_lba_strategy") { + update = true + } + if v, ok := d.GetOk("default_lba_strategy"); ok { + request["DefaultLbaStrategy"] = v + } + if d.HasChange("default_max_return_addr_num") { + update = true + } + if v, ok := d.GetOk("default_max_return_addr_num"); ok { + request["DefaultMaxReturnAddrNum"] = v + } + if d.HasChange("failover_addr_pool_type") { + update = true + } + if v, ok := d.GetOk("failover_addr_pool_type"); ok { + request["FailoverAddrPoolType"] = v + } + if d.HasChange("failover_latency_optimization") { + update = true + } + if v, ok := d.GetOk("failover_latency_optimization"); ok { + request["FailoverLatencyOptimization"] = v + } + if d.HasChange("failover_lba_strategy") { + update = true + } + if v, ok := d.GetOk("failover_lba_strategy"); ok { + request["FailoverLbaStrategy"] = v + } + if d.HasChange("failover_max_return_addr_num") { + update = true + } + if v, ok := d.GetOk("failover_max_return_addr_num"); ok { + request["FailoverMaxReturnAddrNum"] = v + } + if d.HasChange("failover_min_available_addr_num") { + update = true + } + if v, ok := d.GetOk("failover_min_available_addr_num"); ok { + request["FailoverMinAvailableAddrNum"] = v + } + if d.HasChange("default_addr_pools") { + update = true + } + if v, ok := d.GetOk("default_addr_pools"); ok { + defaultAddrPoolMaps := make([]map[string]interface{}, 0) + for _, defaultAddrPool := range v.(*schema.Set).List() { + defaultAddrPoolArg := defaultAddrPool.(map[string]interface{}) + defaultAddrPoolMap := map[string]interface{}{} + defaultAddrPoolMap["Id"] = defaultAddrPoolArg["addr_pool_id"] + if v, ok := defaultAddrPoolArg["lba_weight"]; ok && fmt.Sprint(v) != "0" { + defaultAddrPoolMap["LbaWeight"] = v + } + defaultAddrPoolMaps = append(defaultAddrPoolMaps, defaultAddrPoolMap) + } + request["DefaultAddrPool"] = defaultAddrPoolMaps + } + if d.HasChange("failover_addr_pools") { + update = true + } + if v, ok := d.GetOk("failover_addr_pools"); ok { + failoverAddrPoolMaps := make([]map[string]interface{}, 0) + for _, failoverAddrPool := range v.(*schema.Set).List() { + failoverAddrPoolArg := failoverAddrPool.(map[string]interface{}) + failoverAddrPoolMap := map[string]interface{}{} + failoverAddrPoolMap["Id"] = failoverAddrPoolArg["addr_pool_id"] + if v, ok := failoverAddrPoolArg["lba_weight"]; ok && fmt.Sprint(v) != "0" { + failoverAddrPoolMap["LbaWeight"] = v + } + failoverAddrPoolMaps = append(failoverAddrPoolMaps, failoverAddrPoolMap) + } + request["FailoverAddrPool"] = failoverAddrPoolMaps + } + if update { + if v, ok := d.GetOk("lang"); ok { + request["Lang"] = v + } + action := "UpdateDnsGtmAccessStrategy" + conn, err := client.NewAlidnsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-01-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudAlidnsAccessStrategyRead(d, meta) +} +func resourceAlicloudAlidnsAccessStrategyDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteDnsGtmAccessStrategy" + var response map[string]interface{} + conn, err := client.NewAlidnsClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "StrategyId": d.Id(), + } + + if v, ok := d.GetOk("lang"); ok { + request["Lang"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-01-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_alidns_address_pool.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_alidns_address_pool.go new file mode 100644 index 00000000000..8b9afec947a --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_alidns_address_pool.go @@ -0,0 +1,241 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudAlidnsAddressPool() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudAlidnsAddressPoolCreate, + Read: resourceAlicloudAlidnsAddressPoolRead, + Update: resourceAlicloudAlidnsAddressPoolUpdate, + Delete: resourceAlicloudAlidnsAddressPoolDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "address": { + Type: schema.TypeSet, + Required: true, + MaxItems: 20, + MinItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "address": { + Type: schema.TypeString, + Required: true, + }, + "attribute_info": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.ValidateJsonString, + }, + "lba_weight": { + Type: schema.TypeInt, + Optional: true, + }, + "mode": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"SMART", "ONLINE", "OFFLINE"}, false), + }, + "remark": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "address_pool_name": { + Type: schema.TypeString, + Required: true, + }, + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "lba_strategy": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"ALL_RR", "RATIO"}, false), + }, + "type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"IPV4", "IPV6", "DOMAIN"}, false), + }, + }, + } +} + +func resourceAlicloudAlidnsAddressPoolCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "AddDnsGtmAddressPool" + request := make(map[string]interface{}) + conn, err := client.NewAlidnsClient() + if err != nil { + return WrapError(err) + } + + request["Name"] = d.Get("address_pool_name") + request["InstanceId"] = d.Get("instance_id") + request["LbaStrategy"] = d.Get("lba_strategy") + if v, ok := d.GetOk("address"); ok { + addressMaps := make([]map[string]interface{}, 0) + for _, address := range v.(*schema.Set).List() { + addressArg := address.(map[string]interface{}) + addressMap := map[string]interface{}{} + addressMap["Addr"] = addressArg["address"] + addressMap["AttributeInfo"] = addressArg["attribute_info"] + if v, ok := addressArg["remark"]; ok { + addressMap["Remark"] = v + } + if v, ok := addressArg["lba_weight"]; ok && fmt.Sprint(v) != "0" { + addressMap["LbaWeight"] = v + } + addressMap["Mode"] = addressArg["mode"] + addressMaps = append(addressMaps, addressMap) + } + request["Addr"] = addressMaps + } + request["Type"] = d.Get("type") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-01-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_alidns_address_pool", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["AddrPoolId"])) + + return resourceAlicloudAlidnsAddressPoolRead(d, meta) +} +func resourceAlicloudAlidnsAddressPoolRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + alidnsService := AlidnsService{client} + object, err := alidnsService.DescribeAlidnsAddressPool(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_alidns_address_pool alidnsService.DescribeAlidnsAddressPool Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("address_pool_name", object["Name"]) + d.Set("lba_strategy", object["LbaStrategy"]) + d.Set("type", object["Type"]) + + return nil +} +func resourceAlicloudAlidnsAddressPoolUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "AddrPoolId": d.Id(), + } + if d.HasChange("lba_strategy") { + update = true + } + request["LbaStrategy"] = d.Get("lba_strategy") + if d.HasChange("address_pool_name") { + update = true + request["Name"] = d.Get("address_pool_name") + } + if d.HasChange("address") { + update = true + } + if v, ok := d.GetOk("address"); ok { + addressMaps := make([]map[string]interface{}, 0) + for _, address := range v.(*schema.Set).List() { + addressArg := address.(map[string]interface{}) + addressMap := map[string]interface{}{} + addressMap["Addr"] = addressArg["address"] + addressMap["AttributeInfo"] = addressArg["attribute_info"] + if v, ok := addressArg["remark"]; ok { + addressMap["Remark"] = v + } + if v, ok := addressArg["lba_weight"]; ok && fmt.Sprint(v) != "0" { + addressMap["LbaWeight"] = v + } + addressMap["Mode"] = addressArg["mode"] + addressMaps = append(addressMaps, addressMap) + } + request["Addr"] = addressMaps + } + if update { + action := "UpdateDnsGtmAddressPool" + conn, err := client.NewAlidnsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-01-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudAlidnsAddressPoolRead(d, meta) +} +func resourceAlicloudAlidnsAddressPoolDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteDnsGtmAddressPool" + var response map[string]interface{} + conn, err := client.NewAlidnsClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "AddrPoolId": d.Id(), + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-01-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_alidns_custom_line.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_alidns_custom_line.go new file mode 100644 index 00000000000..48b3cd7c34f --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_alidns_custom_line.go @@ -0,0 +1,209 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudAlidnsCustomLine() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudAlidnsCustomLineCreate, + Read: resourceAlicloudAlidnsCustomLineRead, + Update: resourceAlicloudAlidnsCustomLineUpdate, + Delete: resourceAlicloudAlidnsCustomLineDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "custom_line_name": { + Type: schema.TypeString, + Required: true, + }, + "domain_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "ip_segment_list": { + Type: schema.TypeSet, + Required: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "end_ip": { + Type: schema.TypeString, + Required: true, + }, + "start_ip": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + "lang": { + Type: schema.TypeString, + Optional: true, + }, + }, + } +} + +func resourceAlicloudAlidnsCustomLineCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "AddCustomLine" + request := make(map[string]interface{}) + conn, err := client.NewAlidnsClient() + if err != nil { + return WrapError(err) + } + for index, ipSegment := range d.Get("ip_segment_list").(*schema.Set).List() { + ipSegmentArg := ipSegment.(map[string]interface{}) + request[fmt.Sprintf("IpSegment.%d.EndIp", index+1)] = ipSegmentArg["end_ip"] + request[fmt.Sprintf("IpSegment.%d.StartIp", index+1)] = ipSegmentArg["start_ip"] + } + + if v, ok := d.GetOk("lang"); ok { + request["Lang"] = v + } + + request["DomainName"] = d.Get("domain_name") + request["LineName"] = d.Get("custom_line_name") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-01-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_alidns_custom_line", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["LineId"])) + + return resourceAlicloudAlidnsCustomLineRead(d, meta) +} +func resourceAlicloudAlidnsCustomLineRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + alidnsService := AlidnsService{client} + object, err := alidnsService.DescribeAlidnsCustomLine(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_alidns_custom_line alidnsService.DescribeAlidnsCustomLine Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("custom_line_name", object["Name"]) + d.Set("domain_name", object["DomainName"]) + if ipSegmentList, ok := object["IpSegmentList"]; ok { + ipSegments := make([]map[string]interface{}, 0) + for _, ipSegmentListItem := range ipSegmentList.([]interface{}) { + ipSegmentMap := ipSegmentListItem.(map[string]interface{}) + ipSegmentArg := make(map[string]interface{}, 0) + ipSegmentArg["end_ip"] = ipSegmentMap["EndIp"] + ipSegmentArg["start_ip"] = ipSegmentMap["StartIp"] + ipSegments = append(ipSegments, ipSegmentArg) + } + d.Set("ip_segment_list", ipSegments) + } + return nil +} +func resourceAlicloudAlidnsCustomLineUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "LineId": d.Id(), + } + if d.HasChange("custom_line_name") { + update = true + if v, ok := d.GetOk("custom_line_name"); ok { + request["LineName"] = v + } + } + + if d.HasChange("ip_segment_list") { + update = true + for index, ipSegment := range d.Get("ip_segment_list").(*schema.Set).List() { + ipSegmentArg := ipSegment.(map[string]interface{}) + request[fmt.Sprintf("IpSegment.%d.EndIp", index+1)] = ipSegmentArg["end_ip"] + request[fmt.Sprintf("IpSegment.%d.StartIp", index+1)] = ipSegmentArg["start_ip"] + } + } + + if update { + if v, ok := d.GetOk("lang"); ok { + request["Lang"] = v + } + action := "UpdateCustomLine" + conn, err := client.NewAlidnsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-01-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudAlidnsCustomLineRead(d, meta) +} +func resourceAlicloudAlidnsCustomLineDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteCustomLines" + var response map[string]interface{} + conn, err := client.NewAlidnsClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "LineIds": d.Id(), + } + + if v, ok := d.GetOk("lang"); ok { + request["Lang"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-01-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_alidns_gtm_instance.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_alidns_gtm_instance.go new file mode 100644 index 00000000000..51e08b02418 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_alidns_gtm_instance.go @@ -0,0 +1,478 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudAlidnsGtmInstance() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudAlidnsGtmInstanceCreate, + Read: resourceAlicloudAlidnsGtmInstanceRead, + Update: resourceAlicloudAlidnsGtmInstanceUpdate, + Delete: resourceAlicloudAlidnsGtmInstanceDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "alert_config": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "dingtalk_notice": { + Type: schema.TypeBool, + Optional: true, + }, + "email_notice": { + Type: schema.TypeBool, + Optional: true, + }, + "notice_type": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"ADDR_RESUME", "ADDR_ALERT", "ADDR_POOL_GROUP_UNAVAILABLE", "ADDR_POOL_GROUP_AVAILABLE", "ACCESS_STRATEGY_POOL_GROUP_SWITCH", "MONITOR_NODE_IP_CHANGE"}, false), + }, + "sms_notice": { + Type: schema.TypeBool, + Optional: true, + }, + }, + }, + }, + "alert_group": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "cname_type": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"PUBLIC"}, false), + }, + "force_update": { + Type: schema.TypeBool, + Optional: true, + }, + "instance_name": { + Type: schema.TypeString, + Required: true, + }, + "lang": { + Type: schema.TypeString, + Optional: true, + }, + "payment_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Subscription"}, false), + }, + "period": { + Type: schema.TypeInt, + Required: true, + }, + "renew_period": { + Type: schema.TypeInt, + Optional: true, + ForceNew: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + return fmt.Sprint(d.Get("renewal_status")) == "ManualRenewal" + }, + }, + "renewal_status": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"AutoRenewal", "ManualRenewal"}, false), + }, + "package_edition": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"standard", "ultimate"}, false), + }, + "health_check_task_count": { + Type: schema.TypeInt, + Required: true, + ForceNew: true, + ValidateFunc: validation.IntBetween(0, 100000), + }, + "sms_notification_count": { + Type: schema.TypeInt, + Required: true, + ForceNew: true, + ValidateFunc: validation.IntBetween(0, 100000), + }, + "strategy_mode": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"GEO", "LATENCY"}, false), + }, + "public_cname_mode": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"CUSTOM", "SYSTEM_ASSIGN"}, false), + }, + "public_rr": { + Type: schema.TypeString, + Optional: true, + Computed: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + return fmt.Sprint(d.Get("public_cname_mode")) == "SYSTEM_ASSIGN" + }, + }, + "public_user_domain_name": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "public_zone_name": { + Type: schema.TypeString, + Optional: true, + Computed: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + return fmt.Sprint(d.Get("public_cname_mode")) == "SYSTEM_ASSIGN" + }, + }, + "resource_group_id": { + Type: schema.TypeString, + Optional: true, + }, + "ttl": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validation.IntInSlice([]int{60, 120, 300, 600}), + }, + }, + } +} + +func resourceAlicloudAlidnsGtmInstanceCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateInstance" + request := make(map[string]interface{}) + conn, err := client.NewBssopenapiClient() + if err != nil { + return WrapError(err) + } + request["SubscriptionType"] = d.Get("payment_type") + if v, ok := d.GetOk("period"); ok { + request["Period"] = v + } + request["ProductCode"] = "dns" + request["ProductType"] = "dns_gtm_public_cn" + if v, ok := d.GetOk("renew_period"); ok { + request["RenewPeriod"] = v + } + if v, ok := d.GetOk("renewal_status"); ok { + request["RenewalStatus"] = v + } + parameters := []map[string]string{ + { + "Code": "PackageEdition", + "Value": fmt.Sprint(d.Get("package_edition")), + }, + { + "Code": "HealthcheckTaskCount", + "Value": fmt.Sprint(d.Get("health_check_task_count")), + }, + { + "Code": "SmsNotificationCount", + "Value": fmt.Sprint(d.Get("sms_notification_count")), + }, + } + + request["Parameter"] = parameters + request["ClientToken"] = buildClientToken("CreateInstance") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-12-14"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + if IsExpectedErrors(err, []string{"NotApplicable"}) { + request["ProductType"] = "dns_gtm_public_intl" + conn.Endpoint = String(connectivity.BssOpenAPIEndpointInternational) + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_alidns_gtm_instance", action, AlibabaCloudSdkGoERROR) + } + + if fmt.Sprint(response["Code"]) != "Success" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + responseData := response["Data"].(map[string]interface{}) + d.SetId(fmt.Sprint(responseData["InstanceId"])) + return resourceAlicloudAlidnsGtmInstanceUpdate(d, meta) +} +func resourceAlicloudAlidnsGtmInstanceRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + alidnsService := AlidnsService{client} + object, err := alidnsService.DescribeAlidnsGtmInstance(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_alidns_gtm_instance alidnsService.DescribeAlidnsGtmInstance Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + + d.Set("resource_group_id", object["ResourceGroupId"]) + d.Set("payment_type", object["PaymentType"]) + d.Set("package_edition", object["VersionCode"]) + if config, ok := object["Config"].(map[string]interface{}); ok { + d.Set("cname_type", config["CnameType"]) + d.Set("instance_name", config["InstanceName"]) + d.Set("strategy_mode", config["StrategyMode"]) + d.Set("public_cname_mode", config["PublicCnameMode"]) + d.Set("public_rr", config["PublicRr"]) + d.Set("public_user_domain_name", config["PublicUserDomainName"]) + d.Set("public_zone_name", config["PubicZoneName"]) + if v, ok := config["Ttl"]; ok { + d.Set("ttl", formatInt(v)) + } + + v, err := convertJsonStringToList(config["AlertGroup"].(string)) + if err != nil { + return WrapError(err) + } else { + d.Set("alert_group", v) + } + + if alertConfigsList, ok := config["AlertConfig"]; ok { + alertConfigsArg := alertConfigsList.(map[string]interface{}) + if alertConfigConfig, ok := alertConfigsArg["AlertConfig"]; ok { + alertConfigConfigArgs := alertConfigConfig.([]interface{}) + alertConfigsMaps := make([]map[string]interface{}, 0) + for _, alertConfigMapArgitem := range alertConfigConfigArgs { + alertConfigMapArg := alertConfigMapArgitem.(map[string]interface{}) + alertConfigsMap := map[string]interface{}{} + alertConfigsMap["sms_notice"] = alertConfigMapArg["SmsNotice"] + alertConfigsMap["notice_type"] = alertConfigMapArg["NoticeType"] + alertConfigsMap["email_notice"] = alertConfigMapArg["EmailNotice"] + alertConfigsMap["dingtalk_notice"] = alertConfigMapArg["DingtalkNotice"] + alertConfigsMaps = append(alertConfigsMaps, alertConfigsMap) + } + d.Set("alert_config", alertConfigsMaps) + } + } + } + return nil +} +func resourceAlicloudAlidnsGtmInstanceUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + d.Partial(true) + + update := false + request := map[string]interface{}{ + "ResourceId": d.Id(), + } + if d.HasChange("resource_group_id") { + update = true + if v, ok := d.GetOk("resource_group_id"); ok { + request["NewResourceGroupId"] = v + } + } + if update { + if v, ok := d.GetOk("lang"); ok { + request["Lang"] = v + } + action := "MoveGtmResourceGroup" + conn, err := client.NewAlidnsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-01-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("resource_group_id") + } + update = false + switchDnsGtmInstanceStrategyModeRequest := map[string]interface{}{ + "InstanceId": d.Id(), + } + if d.HasChange("strategy_mode") { + update = true + if v, ok := d.GetOk("strategy_mode"); ok { + switchDnsGtmInstanceStrategyModeRequest["StrategyMode"] = v + } + } + if update { + if v, ok := d.GetOk("lang"); ok { + request["Lang"] = v + } + action := "SwitchDnsGtmInstanceStrategyMode" + conn, err := client.NewAlidnsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-01-09"), StringPointer("AK"), nil, switchDnsGtmInstanceStrategyModeRequest, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("strategy_mode") + } + update = false + updateDnsGtmInstanceGlobalConfigReq := map[string]interface{}{ + "InstanceId": d.Id(), + } + if d.HasChange("alert_config") { + update = true + alertConfigMaps := make([]map[string]interface{}, 0) + if v, ok := d.GetOk("alert_config"); ok { + for _, alertConfig := range v.(*schema.Set).List() { + alertConfigArg := alertConfig.(map[string]interface{}) + alertConfigMap := map[string]interface{}{} + alertConfigMap["SmsNotice"] = alertConfigArg["sms_notice"] + alertConfigMap["NoticeType"] = alertConfigArg["notice_type"] + alertConfigMap["EmailNotice"] = alertConfigArg["email_notice"] + alertConfigMap["DingtalkNotice"] = alertConfigArg["dingtalk_notice"] + alertConfigMaps = append(alertConfigMaps, alertConfigMap) + } + updateDnsGtmInstanceGlobalConfigReq["AlertConfig"] = alertConfigMaps + } + + } + if d.HasChange("alert_group") { + update = true + if v, ok := d.GetOk("alert_group"); ok { + updateDnsGtmInstanceGlobalConfigReq["AlertGroup"] = convertListToJsonString(v.(*schema.Set).List()) + } + } + if d.HasChange("instance_name") { + update = true + } + if v, ok := d.GetOk("instance_name"); ok { + updateDnsGtmInstanceGlobalConfigReq["InstanceName"] = v + } + if d.HasChange("ttl") { + update = true + if v, ok := d.GetOk("ttl"); ok { + updateDnsGtmInstanceGlobalConfigReq["Ttl"] = v + } + } + if d.HasChange("public_cname_mode") { + update = true + if v, ok := d.GetOk("public_cname_mode"); ok { + updateDnsGtmInstanceGlobalConfigReq["PublicCnameMode"] = v + } + } + if d.HasChange("public_rr") { + update = true + if v, ok := d.GetOk("public_rr"); ok { + updateDnsGtmInstanceGlobalConfigReq["PublicRr"] = v + } + } + if d.HasChange("public_user_domain_name") { + update = true + if v, ok := d.GetOk("public_user_domain_name"); ok { + updateDnsGtmInstanceGlobalConfigReq["PublicUserDomainName"] = v + } + } + if d.HasChange("public_zone_name") { + update = true + if v, ok := d.GetOk("public_zone_name"); ok { + updateDnsGtmInstanceGlobalConfigReq["PublicZoneName"] = v + } + } + if d.HasChange("cname_type") { + update = true + if v, ok := d.GetOk("cname_type"); ok { + updateDnsGtmInstanceGlobalConfigReq["CnameType"] = v + } + } + if update { + if v, ok := d.GetOkExists("force_update"); ok { + updateDnsGtmInstanceGlobalConfigReq["ForceUpdate"] = v + } + if v, ok := d.GetOk("lang"); ok { + updateDnsGtmInstanceGlobalConfigReq["Lang"] = v + } + action := "UpdateDnsGtmInstanceGlobalConfig" + conn, err := client.NewAlidnsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-01-09"), StringPointer("AK"), nil, updateDnsGtmInstanceGlobalConfigReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, updateDnsGtmInstanceGlobalConfigReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("alert_config") + d.SetPartial("alert_group") + d.SetPartial("cname_type") + d.SetPartial("instance_name") + d.SetPartial("public_cname_mode") + d.SetPartial("public_rr") + d.SetPartial("public_user_domain_name") + d.SetPartial("public_zone_name") + d.SetPartial("ttl") + } + d.Partial(false) + return resourceAlicloudAlidnsGtmInstanceRead(d, meta) +} +func resourceAlicloudAlidnsGtmInstanceDelete(d *schema.ResourceData, meta interface{}) error { + log.Printf("[WARN] Cannot destroy resourceAlicloudAlidnsGtmInstance. Terraform will remove this resource from the state file, however resources may remain.") + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_alidns_monitor_config.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_alidns_monitor_config.go new file mode 100644 index 00000000000..21fcb63ed1b --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_alidns_monitor_config.go @@ -0,0 +1,234 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudAlidnsMonitorConfig() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudAlidnsMonitorConfigCreate, + Read: resourceAlicloudAlidnsMonitorConfigRead, + Update: resourceAlicloudAlidnsMonitorConfigUpdate, + Delete: resourceAlicloudAlidnsMonitorConfigDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "addr_pool_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "evaluation_count": { + Type: schema.TypeInt, + Required: true, + ValidateFunc: validation.IntInSlice([]int{1, 2, 3}), + }, + "interval": { + Type: schema.TypeInt, + Required: true, + ValidateFunc: validation.IntInSlice([]int{60}), + }, + "isp_city_node": { + Type: schema.TypeSet, + Required: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "city_code": { + Type: schema.TypeString, + Required: true, + }, + "isp_code": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + "lang": { + Type: schema.TypeString, + Optional: true, + }, + "monitor_extend_info": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.ValidateJsonString, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + equal, _ := compareJsonTemplateAreEquivalent(old, new) + return equal + }, + }, + "protocol_type": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"HTTP", "HTTPS", "PING", "TCP"}, false), + }, + "timeout": { + Type: schema.TypeInt, + Required: true, + ValidateFunc: validation.IntInSlice([]int{2000, 3000, 5000, 10000}), + }, + }, + } +} + +func resourceAlicloudAlidnsMonitorConfigCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "AddDnsGtmMonitor" + request := make(map[string]interface{}) + conn, err := client.NewAlidnsClient() + if err != nil { + return WrapError(err) + } + request["AddrPoolId"] = d.Get("addr_pool_id") + request["EvaluationCount"] = d.Get("evaluation_count") + request["Interval"] = d.Get("interval") + if v, ok := d.GetOk("isp_city_node"); ok { + for i, ispCityNode := range v.(*schema.Set).List() { + ispCityNodeArg := ispCityNode.(map[string]interface{}) + request[fmt.Sprintf("IspCityNode.%d.CityCode", i+1)] = ispCityNodeArg["city_code"] + request[fmt.Sprintf("IspCityNode.%d.IspCode", i+1)] = ispCityNodeArg["isp_code"] + } + } + + if v, ok := d.GetOk("lang"); ok { + request["Lang"] = v + } + request["MonitorExtendInfo"] = d.Get("monitor_extend_info") + request["ProtocolType"] = d.Get("protocol_type") + request["Timeout"] = d.Get("timeout") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-01-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_alidns_monitor_config", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["MonitorConfigId"])) + return resourceAlicloudAlidnsMonitorConfigRead(d, meta) +} +func resourceAlicloudAlidnsMonitorConfigRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + alidnsService := AlidnsService{client} + object, err := alidnsService.DescribeAlidnsMonitorConfig(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_alidns_monitor_config alidnsService.DescribeAlidnsMonitorConfig Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + if v, ok := object["EvaluationCount"]; ok { + d.Set("evaluation_count", formatInt(v)) + } + if v, ok := object["Interval"]; ok { + d.Set("interval", formatInt(v)) + } + d.Set("monitor_extend_info", object["MonitorExtendInfo"]) + d.Set("protocol_type", object["ProtocolType"]) + if v, ok := object["Timeout"]; ok { + d.Set("timeout", formatInt(v)) + } + if ispCityNodesList, ok := object["IspCityNodes"]; ok { + ispCityNodesArg := ispCityNodesList.(map[string]interface{}) + if ispCityNodeConfig, ok := ispCityNodesArg["IspCityNode"]; ok { + ispCityNodeConfigArgs := ispCityNodeConfig.([]interface{}) + ispCityNodesMaps := make([]map[string]interface{}, 0) + for _, ispCityNodeMapArgitem := range ispCityNodeConfigArgs { + ispCityNodeMapArg := ispCityNodeMapArgitem.(map[string]interface{}) + ispCityNodesMap := map[string]interface{}{} + ispCityNodesMap["city_code"] = ispCityNodeMapArg["CityCode"] + ispCityNodesMap["isp_code"] = ispCityNodeMapArg["IspCode"] + ispCityNodesMaps = append(ispCityNodesMaps, ispCityNodesMap) + } + d.Set("isp_city_node", ispCityNodesMaps) + } + } + return nil +} +func resourceAlicloudAlidnsMonitorConfigUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "MonitorConfigId": d.Id(), + } + if d.HasChange("isp_city_node") { + update = true + } + if v, ok := d.GetOk("isp_city_node"); ok { + for i, ispCityNode := range v.(*schema.Set).List() { + ispCityNodeArg := ispCityNode.(map[string]interface{}) + request[fmt.Sprintf("IspCityNode.%d.CityCode", i+1)] = ispCityNodeArg["city_code"] + request[fmt.Sprintf("IspCityNode.%d.IspCode", i+1)] = ispCityNodeArg["isp_code"] + } + } + if d.HasChange("monitor_extend_info") { + update = true + } + request["MonitorExtendInfo"] = d.Get("monitor_extend_info") + if d.HasChange("protocol_type") { + update = true + } + request["ProtocolType"] = d.Get("protocol_type") + if d.HasChange("evaluation_count") { + update = true + request["EvaluationCount"] = d.Get("evaluation_count") + } + if d.HasChange("interval") { + update = true + request["Interval"] = d.Get("interval") + } + if d.HasChange("timeout") { + update = true + request["Timeout"] = d.Get("timeout") + } + if update { + action := "UpdateDnsGtmMonitor" + conn, err := client.NewAlidnsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-01-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudAlidnsMonitorConfigRead(d, meta) +} +func resourceAlicloudAlidnsMonitorConfigDelete(d *schema.ResourceData, meta interface{}) error { + log.Printf("[WARN] Cannot destroy resourceAlicloudAlidnsMonitorConfig. Terraform will remove this resource from the state file, however resources may remain.") + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_alikafka_instance.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_alikafka_instance.go index 529741a6cb9..97da7fc7bea 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_alikafka_instance.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_alikafka_instance.go @@ -69,10 +69,12 @@ func resourceAlicloudAlikafkaInstance() *schema.Resource { "eip_max": { Type: schema.TypeInt, Optional: true, + Computed: true, }, "security_group": { Type: schema.TypeString, Optional: true, + Computed: true, ForceNew: true, }, "vswitch_id": { diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_amqp_binding.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_amqp_binding.go new file mode 100644 index 00000000000..2433e06293e --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_amqp_binding.go @@ -0,0 +1,168 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudAmqpBinding() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudAmqpBindingCreate, + Read: resourceAlicloudAmqpBindingRead, + Delete: resourceAlicloudAmqpBindingDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "argument": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"x-match:all", "x-match:any"}, false), + }, + "binding_key": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "binding_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"EXCHANGE", "QUEUE"}, false), + }, + "destination_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "source_exchange": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "virtual_host_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudAmqpBindingCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateBinding" + request := make(map[string]interface{}) + conn, err := client.NewOnsproxyClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("argument"); ok { + request["Argument"] = v + } + request["BindingKey"] = d.Get("binding_key") + request["BindingType"] = d.Get("binding_type") + request["DestinationName"] = d.Get("destination_name") + request["InstanceId"] = d.Get("instance_id") + request["SourceExchange"] = d.Get("source_exchange") + request["VirtualHost"] = d.Get("virtual_host_name") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-12"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_amqp_binding", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["InstanceId"], ":", request["VirtualHost"], ":", request["SourceExchange"], ":", request["DestinationName"])) + + return resourceAlicloudAmqpBindingRead(d, meta) +} +func resourceAlicloudAmqpBindingRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + amqpOpenService := AmqpOpenService{client} + object, err := amqpOpenService.DescribeAmqpBinding(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_amqp_binding amqpOpenService.DescribeAmqpBinding Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 4) + if err != nil { + return WrapError(err) + } + d.Set("destination_name", parts[3]) + d.Set("instance_id", parts[0]) + d.Set("source_exchange", parts[2]) + d.Set("virtual_host_name", parts[1]) + d.Set("argument", object["Argument"]) + d.Set("binding_key", object["BindingKey"]) + d.Set("binding_type", object["BindingType"]) + return nil +} +func resourceAlicloudAmqpBindingDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 4) + if err != nil { + return WrapError(err) + } + action := "DeleteBinding" + var response map[string]interface{} + conn, err := client.NewOnsproxyClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "DestinationName": parts[3], + "InstanceId": parts[0], + "SourceExchange": parts[2], + "VirtualHost": parts[1], + } + + request["BindingKey"] = d.Get("binding_key") + request["BindingType"] = d.Get("binding_type") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-12"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_amqp_instance.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_amqp_instance.go index 4ab86246963..7ad13d800a6 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_amqp_instance.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_amqp_instance.go @@ -27,6 +27,7 @@ func resourceAlicloudAmqpInstance() *schema.Resource { Schema: map[string]*schema.Schema{ "instance_name": { Type: schema.TypeString, + Computed: true, Optional: true, }, "instance_type": { @@ -213,6 +214,7 @@ func resourceAlicloudAmqpInstanceCreate(d *schema.ResourceData, meta interface{} } if IsExpectedErrors(err, []string{"NotApplicable"}) { conn.Endpoint = String(connectivity.BssOpenAPIEndpointInternational) + request["ProductType"] = "ons_onsproxy_public_intl" return resource.RetryableError(err) } return resource.NonRetryableError(err) @@ -253,7 +255,7 @@ func resourceAlicloudAmqpInstanceRead(d *schema.ResourceData, meta interface{}) d.Set("status", object["Status"]) d.Set("support_eip", object["SupportEIP"]) bssOpenApiService := BssOpenApiService{client} - queryAvailableInstancesObject, err := bssOpenApiService.QueryAvailableInstances(d.Id(), "ons", "ons_onsproxy_pre") + queryAvailableInstancesObject, err := bssOpenApiService.QueryAvailableInstances(d.Id(), "ons", "ons_onsproxy_pre", "ons_onsproxy_public_intl") if err != nil { return WrapError(err) } @@ -311,26 +313,26 @@ func resourceAlicloudAmqpInstanceUpdate(d *schema.ResourceData, meta interface{} setRenewalReq := map[string]interface{}{ "InstanceIDs": d.Id(), } + if !d.IsNewResource() && d.HasChange("renewal_status") { update = true } if v, ok := d.GetOk("renewal_status"); ok { setRenewalReq["RenewalStatus"] = v } + if !d.IsNewResource() && d.HasChange("renewal_duration") { + update = true + } + if v, ok := d.GetOk("renewal_duration"); ok { + setRenewalReq["RenewalPeriod"] = v + } + if !d.IsNewResource() && d.HasChange("payment_type") { update = true setRenewalReq["SubscriptionType"] = d.Get("payment_type") } setRenewalReq["ProductCode"] = "ons" setRenewalReq["ProductType"] = "ons_onsproxy_pre" - if !d.IsNewResource() && d.HasChange("renewal_duration") { - update = true - if v, ok := d.GetOk("renewal_duration"); ok { - setRenewalReq["RenewalPeriod"] = v - } else if v, ok := d.GetOk("renewal_status"); ok && v.(string) == "AutoRenewal" { - return WrapError(fmt.Errorf("attribute '%s' is required when '%s' is %v ", "renewal_duration", "renewal_status", d.Get("renewal_status"))) - } - } if d.HasChange("renewal_duration_unit") { update = true if v, ok := d.GetOk("renewal_duration_unit"); ok { @@ -338,6 +340,7 @@ func resourceAlicloudAmqpInstanceUpdate(d *schema.ResourceData, meta interface{} } else if v, ok := d.GetOk("renewal_status"); ok && v.(string) == "AutoRenewal" { return WrapError(fmt.Errorf("attribute '%s' is required when '%s' is %v ", "renewal_duration_unit", "renewal_status", d.Get("renewal_status"))) } + setRenewalReq["RenewalStatus"] = d.Get("renewal_status") } if update { action := "SetRenewal" @@ -355,6 +358,7 @@ func resourceAlicloudAmqpInstanceUpdate(d *schema.ResourceData, meta interface{} } if IsExpectedErrors(err, []string{"NotApplicable"}) { conn.Endpoint = String(connectivity.BssOpenAPIEndpointInternational) + setRenewalReq["ProductType"] = "ons_onsproxy_public_intl" return resource.RetryableError(err) } return resource.NonRetryableError(err) @@ -446,6 +450,7 @@ func resourceAlicloudAmqpInstanceUpdate(d *schema.ResourceData, meta interface{} } if IsExpectedErrors(err, []string{"NotApplicable"}) { conn.Endpoint = String(connectivity.BssOpenAPIEndpointInternational) + modifyInstanceReq["ProductType"] = "ons_onsproxy_public_intl" return resource.RetryableError(err) } return resource.NonRetryableError(err) diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_api_gateway_api.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_api_gateway_api.go index 66b5fd042b8..66500dfe402 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_api_gateway_api.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_api_gateway_api.go @@ -3,9 +3,12 @@ package alicloud import ( "encoding/json" "fmt" + "strconv" "strings" "time" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" @@ -290,6 +293,11 @@ func resourceAliyunApigatewayApi() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "force_nonce_check": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, }, } } @@ -358,6 +366,7 @@ func resourceAliyunApigatewayApiRead(d *schema.ResourceData, meta interface{}) e d.Set("name", object.ApiName) d.Set("description", object.Description) d.Set("auth_type", object.AuthType) + d.Set("force_nonce_check", object.ForceNonceCheck) requestConfig := map[string]interface{}{} requestConfig["protocol"] = object.RequestConfig.RequestProtocol @@ -492,6 +501,13 @@ func resourceAliyunApigatewayApiUpdate(d *schema.ResourceData, meta interface{}) request.Description = d.Get("description").(string) request.AuthType = d.Get("auth_type").(string) + if d.HasChange("force_nonce_check") { + update = true + } + if v, exist := d.GetOk("force_nonce_check"); exist { + request.ForceNonceCheck = requests.Boolean(strconv.FormatBool(v.(bool))) + } + var paramErr error var paramConfig string if d.HasChange("request_config") { @@ -622,7 +638,9 @@ func buildAliyunApiArgs(d *schema.ResourceData, meta interface{}) (*cloudapi.Cre request.Description = d.Get("description").(string) request.ApiName = d.Get("name").(string) request.AuthType = d.Get("auth_type").(string) - + if v, exist := d.GetOk("force_nonce_check"); exist { + request.ForceNonceCheck = requests.Boolean(strconv.FormatBool(v.(bool))) + } requestConfig, err := requestConfigToJsonStr(d.Get("request_config").([]interface{})) if err != nil { return request, WrapError(err) diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_arms_alert_contact.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_arms_alert_contact.go index 5e14717fb28..893e7d303a4 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_arms_alert_contact.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_arms_alert_contact.go @@ -132,45 +132,45 @@ func resourceAlicloudArmsAlertContactUpdate(d *schema.ResourceData, meta interfa request["RegionId"] = client.RegionId if d.HasChange("alert_contact_name") { update = true - if v, ok := d.GetOk("alert_contact_name"); ok { - request["ContactName"] = v - } + } + if v, ok := d.GetOk("alert_contact_name"); ok { + request["ContactName"] = v } if d.HasChange("ding_robot_webhook_url") { update = true - if v, ok := d.GetOk("ding_robot_webhook_url"); ok { - request["DingRobotWebhookUrl"] = v - } else if v, ok := d.GetOk("email"); ok && v.(string) == "" { - if v, ok := d.GetOk("phone_num"); ok && v.(string) == "" { - return WrapError(fmt.Errorf("attribute '%s' is required when '%s' is %v and '%s' is %v ", "ding_robot_webhook_url", "email", d.Get("email"), "phone_num", d.Get("phone_num"))) - } + } + if v, ok := d.GetOk("ding_robot_webhook_url"); ok { + request["DingRobotWebhookUrl"] = v + } else if v, ok := d.GetOk("email"); ok && v.(string) == "" { + if v, ok := d.GetOk("phone_num"); ok && v.(string) == "" { + return WrapError(fmt.Errorf("attribute '%s' is required when '%s' is %v and '%s' is %v ", "ding_robot_webhook_url", "email", d.Get("email"), "phone_num", d.Get("phone_num"))) } } if d.HasChange("email") { update = true - if v, ok := d.GetOk("email"); ok { - request["Email"] = v - } else if v, ok := d.GetOk("ding_robot_webhook_url"); ok && v.(string) == "" { - if v, ok := d.GetOk("phone_num"); ok && v.(string) == "" { - return WrapError(fmt.Errorf("attribute '%s' is required when '%s' is %v and '%s' is %v ", "email", "ding_robot_webhook_url", d.Get("ding_robot_webhook_url"), "phone_num", d.Get("phone_num"))) - } + } + if v, ok := d.GetOk("email"); ok { + request["Email"] = v + } else if v, ok := d.GetOk("ding_robot_webhook_url"); ok && v.(string) == "" { + if v, ok := d.GetOk("phone_num"); ok && v.(string) == "" { + return WrapError(fmt.Errorf("attribute '%s' is required when '%s' is %v and '%s' is %v ", "email", "ding_robot_webhook_url", d.Get("ding_robot_webhook_url"), "phone_num", d.Get("phone_num"))) } } if d.HasChange("phone_num") { update = true - if v, ok := d.GetOk("phone_num"); ok { - request["PhoneNum"] = v - } else if v, ok := d.GetOk("ding_robot_webhook_url"); ok && v.(string) == "" { - if v, ok := d.GetOk("email"); ok && v.(string) == "" { - return WrapError(fmt.Errorf("attribute '%s' is required when '%s' is %v and '%s' is %v ", "phone_num", "ding_robot_webhook_url", d.Get("ding_robot_webhook_url"), "email", d.Get("email"))) - } + } + if v, ok := d.GetOk("phone_num"); ok { + request["PhoneNum"] = v + } else if v, ok := d.GetOk("ding_robot_webhook_url"); ok && v.(string) == "" { + if v, ok := d.GetOk("email"); ok && v.(string) == "" { + return WrapError(fmt.Errorf("attribute '%s' is required when '%s' is %v and '%s' is %v ", "phone_num", "ding_robot_webhook_url", d.Get("ding_robot_webhook_url"), "email", d.Get("email"))) } } if d.HasChange("system_noc") || d.IsNewResource() { update = true - if v, ok := d.GetOkExists("system_noc"); ok { - request["SystemNoc"] = v - } + } + if v, ok := d.GetOkExists("system_noc"); ok { + request["SystemNoc"] = v } if update { action := "UpdateAlertContact" diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_arms_dispatch_rule.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_arms_dispatch_rule.go new file mode 100644 index 00000000000..a265efb0b82 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_arms_dispatch_rule.go @@ -0,0 +1,501 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudArmsDispatchRule() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudArmsDispatchRuleCreate, + Read: resourceAlicloudArmsDispatchRuleRead, + Update: resourceAlicloudArmsDispatchRuleUpdate, + Delete: resourceAlicloudArmsDispatchRuleDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "is_recover": { + Type: schema.TypeBool, + Optional: true, + }, + "group_rules": { + Type: schema.TypeSet, + Required: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "group_id": { + Type: schema.TypeInt, + Computed: true, + }, + "group_wait_time": { + Type: schema.TypeInt, + Required: true, + }, + "group_interval": { + Type: schema.TypeInt, + Required: true, + }, + "grouping_fields": { + Type: schema.TypeList, + Required: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "repeat_interval": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + }, + }, + }, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + return d.Get("dispatch_type").(string) == "DISCARD_ALERT" + }, + }, + "dispatch_type": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"CREATE_ALERT", "DISCARD_ALERT"}, false), + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "label_match_expression_grid": { + Type: schema.TypeSet, + Required: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "label_match_expression_groups": { + Type: schema.TypeSet, + Required: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "label_match_expressions": { + Type: schema.TypeSet, + Required: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Required: true, + }, + "value": { + Type: schema.TypeString, + Required: true, + }, + "operator": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + "notify_rules": { + Type: schema.TypeSet, + Required: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "notify_objects": { + Type: schema.TypeSet, + Required: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "notify_object_id": { + Type: schema.TypeString, + Required: true, + }, + "notify_type": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"ARMS_CONTACT", "ARMS_CONTACT_GROUP"}, false), + }, + "name": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + "notify_channels": { + Type: schema.TypeList, + Required: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + return d.Get("dispatch_type").(string) == "DISCARD_ALERT" + }, + }, + "dispatch_rule_name": { + Type: schema.TypeString, + Required: true, + }, + }, + } +} + +func resourceAlicloudArmsDispatchRuleCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateDispatchRule" + request := make(map[string]interface{}) + conn, err := client.NewArmsClient() + if err != nil { + return WrapError(err) + } + dispatchRuleMap := make(map[string]interface{}, 0) + if v, ok := d.GetOk("is_recover"); ok { + dispatchRuleMap["isRecover"] = v + } + + if v, ok := d.GetOk("group_rules"); ok { + groupRulesMaps := make([]map[string]interface{}, 0) + for _, groupRules := range v.(*schema.Set).List() { + groupRulesArg := groupRules.(map[string]interface{}) + groupRulesMap := map[string]interface{}{ + "groupWait": groupRulesArg["group_wait_time"], + "groupInterval": groupRulesArg["group_interval"], + "groupingFields": groupRulesArg["grouping_fields"], + "repeatInterval": groupRulesArg["repeat_interval"], + } + groupRulesMaps = append(groupRulesMaps, groupRulesMap) + } + dispatchRuleMap["groupRules"] = groupRulesMaps + } + if v, ok := d.GetOk("dispatch_type"); ok { + dispatchRuleMap["dispatchType"] = v + } + if v, ok := d.GetOk("label_match_expression_grid"); ok { + labelMatchExpressionGrid := v.(*schema.Set).List()[0] + labelMatchExpressionGridArg := labelMatchExpressionGrid.(map[string]interface{}) + labelMatchExpressionGroupsMaps := make([]map[string]interface{}, 0) + for _, labelMatchExpressionGroups := range labelMatchExpressionGridArg["label_match_expression_groups"].(*schema.Set).List() { + labelMatchExpressionGroupsArg := labelMatchExpressionGroups.(map[string]interface{}) + labelMatchExpressionsMaps := make([]map[string]interface{}, 0) + for _, labelMatchExpressions := range labelMatchExpressionGroupsArg["label_match_expressions"].(*schema.Set).List() { + labelMatchExpressionsArg := labelMatchExpressions.(map[string]interface{}) + labelMatchExpressionsMap := map[string]interface{}{ + "key": labelMatchExpressionsArg["key"], + "value": labelMatchExpressionsArg["value"], + "operator": labelMatchExpressionsArg["operator"], + } + labelMatchExpressionsMaps = append(labelMatchExpressionsMaps, labelMatchExpressionsMap) + } + labelMatchExpressionGroupsMaps = append(labelMatchExpressionGroupsMaps, map[string]interface{}{ + "labelMatchExpressions": labelMatchExpressionsMaps, + }) + } + dispatchRuleMap["labelMatchExpressionGrid"] = map[string]interface{}{ + "labelMatchExpressionGroups": labelMatchExpressionGroupsMaps, + } + } + + if v, ok := d.GetOk("notify_rules"); ok { + notifyRulesMaps := make([]map[string]interface{}, 0) + for _, notifyRules := range v.(*schema.Set).List() { + notifyRulesArg := notifyRules.(map[string]interface{}) + notifyObjectsMaps := make([]map[string]interface{}, 0) + for _, notifyObjects := range notifyRulesArg["notify_objects"].(*schema.Set).List() { + notifyObjectsArg := notifyObjects.(map[string]interface{}) + notifyObjectsMap := map[string]interface{}{ + "notifyType": notifyObjectsArg["notify_type"], + "name": notifyObjectsArg["name"], + "notifyObjectId": notifyObjectsArg["notify_object_id"], + } + notifyObjectsMaps = append(notifyObjectsMaps, notifyObjectsMap) + } + notifyRulesMap := map[string]interface{}{ + "notifyObjects": notifyObjectsMaps, + "notifyChannels": notifyRulesArg["notify_channels"].([]interface{}), + } + notifyRulesMaps = append(notifyRulesMaps, notifyRulesMap) + } + dispatchRuleMap["notifyRules"] = notifyRulesMaps + } + + if v, ok := d.GetOk("dispatch_rule_name"); ok { + dispatchRuleMap["name"] = v + } + + request["RegionId"] = client.RegionId + if v, err := convertMaptoJsonString(dispatchRuleMap); err != nil { + return WrapError(err) + } else { + request["DispatchRule"] = v + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-08-08"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_arms_dispatch_rule", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["DispatchRuleId"])) + + return resourceAlicloudArmsDispatchRuleRead(d, meta) +} +func resourceAlicloudArmsDispatchRuleRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + armsService := ArmsService{client} + object, err := armsService.DescribeArmsDispatchRule(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_arms_dispatch_rule armsService.DescribeArmsDispatchRule Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + if groupRulesList, ok := object["GroupRules"]; ok && groupRulesList != nil { + groupRulesMaps := make([]map[string]interface{}, 0) + for _, groupRulesListItem := range groupRulesList.([]interface{}) { + if groupRulesItemMap, ok := groupRulesListItem.(map[string]interface{}); ok { + groupRulesMap := make(map[string]interface{}, 0) + groupRulesMap["group_interval"] = groupRulesItemMap["GroupInterval"] + groupRulesMap["group_wait_time"] = groupRulesItemMap["GroupWaitTime"] + groupRulesMap["group_id"] = groupRulesItemMap["GroupId"] + groupRulesMap["grouping_fields"] = groupRulesItemMap["GroupingFields"] + groupRulesMap["repeat_interval"] = groupRulesItemMap["RepeatInterval"] + groupRulesMaps = append(groupRulesMaps, groupRulesMap) + } + } + d.Set("group_rules", groupRulesMaps) + } + d.Set("status", object["State"]) + if labelMatchExpressionGrid, ok := object["LabelMatchExpressionGrid"]; ok && labelMatchExpressionGrid != nil { + labelMatchExpressionGridMaps := make([]map[string]interface{}, 0) + labelMatchExpressionGridMap := make(map[string]interface{}) + + labelMatchExpressionGroupsMaps := make([]map[string]interface{}, 0) + if v, ok := labelMatchExpressionGrid.(map[string]interface{})["LabelMatchExpressionGroups"]; ok && v != nil { + for _, labelMatchExpressionGroups := range v.([]interface{}) { + labelMatchExpressionGroupsMap := make(map[string]interface{}) + labelMatchExpressionsMaps := make([]map[string]interface{}, 0) + if v, ok := labelMatchExpressionGroups.(map[string]interface{})["LabelMatchExpressions"]; ok && v != nil { + for _, labelMatchExpressions := range v.([]interface{}) { + labelMatchExpressionsArg := labelMatchExpressions.(map[string]interface{}) + labelMatchExpressionsMap := make(map[string]interface{}, 0) + labelMatchExpressionsMap["operator"] = labelMatchExpressionsArg["Operator"] + labelMatchExpressionsMap["key"] = labelMatchExpressionsArg["Key"] + labelMatchExpressionsMap["value"] = labelMatchExpressionsArg["Value"] + labelMatchExpressionsMaps = append(labelMatchExpressionsMaps, labelMatchExpressionsMap) + } + } + labelMatchExpressionGroupsMap["label_match_expressions"] = labelMatchExpressionsMaps + labelMatchExpressionGroupsMaps = append(labelMatchExpressionGroupsMaps, labelMatchExpressionGroupsMap) + } + } + labelMatchExpressionGridMap["label_match_expression_groups"] = labelMatchExpressionGroupsMaps + labelMatchExpressionGridMaps = append(labelMatchExpressionGridMaps, labelMatchExpressionGridMap) + if err := d.Set("label_match_expression_grid", labelMatchExpressionGridMaps); err != nil { + return WrapError(err) + } + } + + if notifyRulesList, ok := object["NotifyRules"]; ok && notifyRulesList != nil { + notifyRulesMaps := make([]map[string]interface{}, 0) + for _, notifyRulesListItem := range notifyRulesList.([]interface{}) { + if notifyRulesItemMap, ok := notifyRulesListItem.(map[string]interface{}); ok { + notifyRulesMap := make(map[string]interface{}, 0) + notifyObjectsMaps := make([]map[string]interface{}, 0) + for _, notifyObjects := range notifyRulesItemMap["NotifyObjects"].([]interface{}) { + notifyObjectsArg := notifyObjects.(map[string]interface{}) + notifyObjectsMap := make(map[string]interface{}, 0) + notifyObjectsMap["notify_type"] = convertArmsDispatchRuleNotifyTypeResponse(notifyObjectsArg["NotifyType"]) + notifyObjectsMap["notify_object_id"] = notifyObjectsArg["NotifyObjectId"] + notifyObjectsMap["name"] = notifyObjectsArg["Name"] + notifyObjectsMaps = append(notifyObjectsMaps, notifyObjectsMap) + } + notifyRulesMap["notify_objects"] = notifyObjectsMaps + notifyRulesMap["notify_channels"] = notifyRulesItemMap["NotifyChannels"] + notifyRulesMaps = append(notifyRulesMaps, notifyRulesMap) + } + } + d.Set("notify_rules", notifyRulesMaps) + } + + d.Set("dispatch_rule_name", object["Name"]) + return nil +} +func resourceAlicloudArmsDispatchRuleUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "UpdateDispatchRule" + request := make(map[string]interface{}) + conn, err := client.NewArmsClient() + if err != nil { + return WrapError(err) + } + dispatchRuleMap := make(map[string]interface{}, 0) + dispatchRuleMap["isRecover"] = d.Get("is_recover") + + dispatchRuleMap["ruleid"] = d.Id() + dispatchRuleMap["id"] = d.Id() + if _, ok := d.GetOk("group_rules"); ok { + oraw, nraw := d.GetChange("group_rules") + groupRulesMaps := make([]map[string]interface{}, 0) + groupId := 0 + for _, groupRules := range oraw.(*schema.Set).List() { + groupRulesArg := groupRules.(map[string]interface{}) + groupId = groupRulesArg["group_id"].(int) + } + for _, groupRules := range nraw.(*schema.Set).List() { + groupRulesArg := groupRules.(map[string]interface{}) + groupRulesMap := map[string]interface{}{ + "groupId": groupId, + "groupWait": groupRulesArg["group_wait_time"], + "groupInterval": groupRulesArg["group_interval"], + "groupingFields": groupRulesArg["grouping_fields"], + "repeatInterval": groupRulesArg["repeat_interval"], + } + groupRulesMaps = append(groupRulesMaps, groupRulesMap) + } + dispatchRuleMap["groupRules"] = groupRulesMaps + } + if v, ok := d.GetOk("dispatch_type"); ok { + dispatchRuleMap["dispatchType"] = v + } + if v, ok := d.GetOk("label_match_expression_grid"); ok { + labelMatchExpressionGrid := v.(*schema.Set).List()[0] + labelMatchExpressionGridArg := labelMatchExpressionGrid.(map[string]interface{}) + labelMatchExpressionGroupsMaps := make([]map[string]interface{}, 0) + for _, labelMatchExpressionGroups := range labelMatchExpressionGridArg["label_match_expression_groups"].(*schema.Set).List() { + labelMatchExpressionGroupsArg := labelMatchExpressionGroups.(map[string]interface{}) + labelMatchExpressionsMaps := make([]map[string]interface{}, 0) + for _, labelMatchExpressions := range labelMatchExpressionGroupsArg["label_match_expressions"].(*schema.Set).List() { + labelMatchExpressionsArg := labelMatchExpressions.(map[string]interface{}) + labelMatchExpressionsMap := map[string]interface{}{ + "key": labelMatchExpressionsArg["key"], + "value": labelMatchExpressionsArg["value"], + "operator": labelMatchExpressionsArg["operator"], + } + labelMatchExpressionsMaps = append(labelMatchExpressionsMaps, labelMatchExpressionsMap) + } + labelMatchExpressionGroupsMaps = append(labelMatchExpressionGroupsMaps, map[string]interface{}{ + "labelMatchExpressions": labelMatchExpressionsMaps, + }) + } + dispatchRuleMap["labelMatchExpressionGrid"] = map[string]interface{}{ + "labelMatchExpressionGroups": labelMatchExpressionGroupsMaps, + } + } + + if v, ok := d.GetOk("notify_rules"); ok { + notifyRulesMaps := make([]map[string]interface{}, 0) + for _, notifyRules := range v.(*schema.Set).List() { + notifyRulesArg := notifyRules.(map[string]interface{}) + notifyObjectsMaps := make([]map[string]interface{}, 0) + for _, notifyObjects := range notifyRulesArg["notify_objects"].(*schema.Set).List() { + notifyObjectsArg := notifyObjects.(map[string]interface{}) + notifyObjectsMap := map[string]interface{}{ + "notifyType": notifyObjectsArg["notify_type"], + "name": notifyObjectsArg["name"], + "notifyObjectId": notifyObjectsArg["notify_object_id"], + } + notifyObjectsMaps = append(notifyObjectsMaps, notifyObjectsMap) + } + notifyRulesMap := map[string]interface{}{ + "notifyObjects": notifyObjectsMaps, + "notifyChannels": notifyRulesArg["notify_channels"].([]interface{}), + } + notifyRulesMaps = append(notifyRulesMaps, notifyRulesMap) + } + dispatchRuleMap["notifyRules"] = notifyRulesMaps + } + + if v, ok := d.GetOk("dispatch_rule_name"); ok { + dispatchRuleMap["name"] = v + } + + request["RegionId"] = client.RegionId + if v, err := convertMaptoJsonString(dispatchRuleMap); err != nil { + return WrapError(err) + } else { + request["DispatchRule"] = v + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-08-08"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_arms_dispatch_rule", action, AlibabaCloudSdkGoERROR) + } + + return resourceAlicloudArmsDispatchRuleRead(d, meta) +} +func resourceAlicloudArmsDispatchRuleDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteDispatchRule" + var response map[string]interface{} + conn, err := client.NewArmsClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "Id": d.Id(), + "RegionId": client.RegionId, + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-08-08"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} +func convertArmsDispatchRuleNotifyTypeResponse(source interface{}) interface{} { + switch source { + case "CONTACT": + return "ARMS_CONTACT" + case "CONTACT_GROUP": + return "ARMS_CONTACT_GROUP" + } + return source +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_arms_prometheus_alert_rule.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_arms_prometheus_alert_rule.go new file mode 100644 index 00000000000..d4d97046866 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_arms_prometheus_alert_rule.go @@ -0,0 +1,375 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudArmsPrometheusAlertRule() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudArmsPrometheusAlertRuleCreate, + Read: resourceAlicloudArmsPrometheusAlertRuleRead, + Update: resourceAlicloudArmsPrometheusAlertRuleUpdate, + Delete: resourceAlicloudArmsPrometheusAlertRuleDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "annotations": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Optional: true, + }, + "value": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "cluster_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "dispatch_rule_id": { + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("notify_type"); ok && v.(string) == "DISPATCH_RULE" { + return false + } + return true + }, + }, + "duration": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "expression": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "labels": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Optional: true, + }, + "value": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "message": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "notify_type": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"ALERT_MANAGER", "DISPATCH_RULE"}, false), + }, + "prometheus_alert_rule_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeInt, + Computed: true, + ForceNew: true, + }, + "type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Computed: true, + }, + }, + } +} + +func resourceAlicloudArmsPrometheusAlertRuleCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreatePrometheusAlertRule" + request := make(map[string]interface{}) + conn, err := client.NewArmsClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("annotations"); ok { + annotationsMaps := make([]map[string]interface{}, 0) + for _, annotations := range v.(*schema.Set).List() { + annotationsMap := annotations.(map[string]interface{}) + annotationsMaps = append(annotationsMaps, annotationsMap) + } + if v, err := convertArrayObjectToJsonString(annotationsMaps); err == nil { + request["Annotations"] = v + } else { + return WrapError(err) + } + } + request["ClusterId"] = d.Get("cluster_id") + if v, ok := d.GetOk("dispatch_rule_id"); ok { + request["DispatchRuleId"] = v + } + request["Duration"] = d.Get("duration") + request["Expression"] = d.Get("expression") + if v, ok := d.GetOk("labels"); ok { + labelsMaps := make([]map[string]interface{}, 0) + for _, labels := range v.(*schema.Set).List() { + labelsMap := labels.(map[string]interface{}) + labelsMaps = append(labelsMaps, labelsMap) + } + if v, err := convertArrayObjectToJsonString(labelsMaps); err == nil { + request["Labels"] = v + } else { + return WrapError(err) + } + } + request["Message"] = d.Get("message") + if v, ok := d.GetOk("notify_type"); ok { + request["NotifyType"] = v + } + request["AlertName"] = d.Get("prometheus_alert_rule_name") + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("type"); ok { + request["Type"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-08-08"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_arms_prometheus_alert_rule", action, AlibabaCloudSdkGoERROR) + } + responsePrometheusAlertRule := response["PrometheusAlertRule"].(map[string]interface{}) + d.SetId(fmt.Sprint(request["ClusterId"], ":", responsePrometheusAlertRule["AlertId"])) + + return resourceAlicloudArmsPrometheusAlertRuleRead(d, meta) +} +func resourceAlicloudArmsPrometheusAlertRuleRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + armsService := ArmsService{client} + object, err := armsService.DescribeArmsPrometheusAlertRule(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_arms_prometheus_alert_rule armsService.DescribeArmsPrometheusAlertRule Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Set("cluster_id", parts[0]) + d.Set("prometheus_alert_rule_id", parts[1]) + if v, ok := object["Annotations"].([]interface{}); ok { + annotations := make([]map[string]interface{}, 0) + for _, val := range v { + item := val.(map[string]interface{}) + if item["Name"] == "message" { + continue + } + + temp := map[string]interface{}{ + "name": item["Name"], + "value": item["Value"], + } + + annotations = append(annotations, temp) + } + if err := d.Set("annotations", annotations); err != nil { + return WrapError(err) + } + } + d.Set("dispatch_rule_id", fmt.Sprint(formatInt(object["DispatchRuleId"]))) + d.Set("duration", object["Duration"]) + d.Set("expression", object["Expression"]) + if v, ok := object["Labels"].([]interface{}); ok { + labels := make([]map[string]interface{}, 0) + for _, val := range v { + item := val.(map[string]interface{}) + temp := map[string]interface{}{ + "name": item["Name"], + "value": item["Value"], + } + + labels = append(labels, temp) + } + if err := d.Set("labels", labels); err != nil { + return WrapError(err) + } + } + d.Set("message", object["Message"]) + d.Set("notify_type", object["NotifyType"]) + d.Set("prometheus_alert_rule_name", object["AlertName"]) + d.Set("status", fmt.Sprint(formatInt(object["Status"]))) + d.Set("type", object["Type"]) + return nil +} +func resourceAlicloudArmsPrometheusAlertRuleUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + update := false + request := map[string]interface{}{ + "ClusterId": parts[0], + "AlertId": parts[1], + } + + request["Duration"] = d.Get("duration") + if d.HasChange("duration") { + update = true + } + request["Expression"] = d.Get("expression") + if d.HasChange("expression") { + update = true + } + request["Message"] = d.Get("message") + if d.HasChange("message") { + update = true + } + request["AlertName"] = d.Get("prometheus_alert_rule_name") + if d.HasChange("prometheus_alert_rule_name") { + update = true + } + request["RegionId"] = client.RegionId + if d.HasChange("annotations") { + update = true + if v, ok := d.GetOk("annotations"); ok { + annotationsMaps := make([]map[string]interface{}, 0) + for _, annotations := range v.(*schema.Set).List() { + annotationsMap := annotations.(map[string]interface{}) + annotationsMaps = append(annotationsMaps, annotationsMap) + } + if v, err := convertArrayObjectToJsonString(annotationsMaps); err == nil { + request["Annotations"] = v + } else { + return WrapError(err) + } + } + } + if d.HasChange("dispatch_rule_id") { + update = true + if v, ok := d.GetOk("dispatch_rule_id"); ok { + request["DispatchRuleId"] = v + } + } + if d.HasChange("labels") { + update = true + if v, ok := d.GetOk("labels"); ok { + labelsMaps := make([]map[string]interface{}, 0) + for _, labels := range v.(*schema.Set).List() { + labelsMap := labels.(map[string]interface{}) + labelsMaps = append(labelsMaps, labelsMap) + } + if v, err := convertArrayObjectToJsonString(labelsMaps); err == nil { + request["Labels"] = v + } else { + return WrapError(err) + } + } + } + if d.HasChange("notify_type") { + update = true + if v, ok := d.GetOk("notify_type"); ok { + request["NotifyType"] = v + } + } + + if update { + action := "UpdatePrometheusAlertRule" + conn, err := client.NewArmsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-08-08"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudArmsPrometheusAlertRuleRead(d, meta) +} +func resourceAlicloudArmsPrometheusAlertRuleDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + action := "DeletePrometheusAlertRule" + var response map[string]interface{} + conn, err := client.NewArmsClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "AlertId": parts[1], + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-08-08"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_host.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_host.go new file mode 100644 index 00000000000..b5cb64011ce --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_host.go @@ -0,0 +1,302 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudBastionhostHost() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudBastionhostHostCreate, + Read: resourceAlicloudBastionhostHostRead, + Update: resourceAlicloudBastionhostHostUpdate, + Delete: resourceAlicloudBastionhostHostDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "active_address_type": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"Private", "Public"}, false), + }, + "comment": { + Type: schema.TypeString, + Optional: true, + }, + "host_id": { + Type: schema.TypeString, + Computed: true, + }, + "host_name": { + Type: schema.TypeString, + Required: true, + }, + "host_private_address": { + Type: schema.TypeString, + Optional: true, + }, + "host_public_address": { + Type: schema.TypeString, + Optional: true, + }, + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "instance_region_id": { + Type: schema.TypeString, + Optional: true, + }, + "os_type": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"Linux", "Windows"}, false), + }, + "source": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Ecs", "Local", "Rds"}, false), + }, + "source_instance_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudBastionhostHostCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateHost" + request := make(map[string]interface{}) + conn, err := client.NewBastionhostClient() + if err != nil { + return WrapError(err) + } + request["ActiveAddressType"] = d.Get("active_address_type") + if v, ok := d.GetOk("comment"); ok { + request["Comment"] = v + } + request["HostName"] = d.Get("host_name") + if v, ok := d.GetOk("host_private_address"); ok { + request["HostPrivateAddress"] = v + } + if v, ok := d.GetOk("host_public_address"); ok { + request["HostPublicAddress"] = v + } + request["InstanceId"] = d.Get("instance_id") + if v, ok := d.GetOk("instance_region_id"); ok { + request["InstanceRegionId"] = v + } + request["OSType"] = d.Get("os_type") + request["RegionId"] = client.RegionId + request["Source"] = d.Get("source") + if v, ok := d.GetOk("source_instance_id"); ok { + request["SourceInstanceId"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_bastionhost_host", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["InstanceId"], ":", response["HostId"])) + + return resourceAlicloudBastionhostHostRead(d, meta) +} +func resourceAlicloudBastionhostHostRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + yundunBastionhostService := YundunBastionhostService{client} + object, err := yundunBastionhostService.DescribeBastionhostHost(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_bastionhost_host yundunBastionhostService.DescribeBastionhostHost Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Set("host_id", parts[1]) + d.Set("instance_id", parts[0]) + d.Set("active_address_type", object["ActiveAddressType"]) + d.Set("comment", object["Comment"]) + d.Set("host_name", object["HostName"]) + d.Set("host_private_address", object["HostPrivateAddress"]) + d.Set("host_public_address", object["HostPublicAddress"]) + d.Set("os_type", object["OSType"]) + d.Set("source", object["Source"]) + d.Set("source_instance_id", object["SourceInstanceId"]) + return nil +} +func resourceAlicloudBastionhostHostUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Partial(true) + + update := false + request := map[string]interface{}{ + "HostIds": convertListToJsonString([]interface{}{parts[1]}), + "InstanceId": parts[0], + } + if d.HasChange("active_address_type") { + update = true + } + request["ActiveAddressType"] = d.Get("active_address_type") + request["RegionId"] = client.RegionId + if update { + action := "ModifyHostsActiveAddressType" + conn, err := client.NewBastionhostClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("active_address_type") + } + update = false + modifyHostReq := map[string]interface{}{ + "HostId": parts[1], + "InstanceId": parts[0], + } + if d.HasChange("comment") { + update = true + if v, ok := d.GetOk("comment"); ok { + modifyHostReq["Comment"] = v + } + } + if d.HasChange("host_name") { + update = true + modifyHostReq["HostName"] = d.Get("host_name") + } + if d.HasChange("host_private_address") { + update = true + if v, ok := d.GetOk("host_private_address"); ok { + modifyHostReq["HostPrivateAddress"] = v + } + } + if d.HasChange("host_public_address") { + update = true + if v, ok := d.GetOk("host_public_address"); ok { + modifyHostReq["HostPublicAddress"] = v + } + } + if d.HasChange("os_type") { + update = true + modifyHostReq["OSType"] = d.Get("os_type") + } + modifyHostReq["RegionId"] = client.RegionId + if update { + action := "ModifyHost" + conn, err := client.NewBastionhostClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, modifyHostReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, modifyHostReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("comment") + d.SetPartial("host_name") + d.SetPartial("host_private_address") + d.SetPartial("host_public_address") + d.SetPartial("os_type") + } + d.Partial(false) + return resourceAlicloudBastionhostHostRead(d, meta) +} +func resourceAlicloudBastionhostHostDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + action := "DeleteHost" + var response map[string]interface{} + conn, err := client.NewBastionhostClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "HostId": parts[1], + "InstanceId": parts[0], + } + + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"Commodity.BizError.InvalidStatus", "OBJECT_NOT_FOUND"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_host_account.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_host_account.go new file mode 100644 index 00000000000..86003dca9e4 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_host_account.go @@ -0,0 +1,245 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudBastionhostHostAccount() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudBastionhostHostAccountCreate, + Read: resourceAlicloudBastionhostHostAccountRead, + Update: resourceAlicloudBastionhostHostAccountUpdate, + Delete: resourceAlicloudBastionhostHostAccountDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "host_account_id": { + Type: schema.TypeString, + Computed: true, + }, + "host_account_name": { + Type: schema.TypeString, + Required: true, + }, + "host_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "pass_phrase": { + Type: schema.TypeString, + Optional: true, + Sensitive: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("protocol_name"); ok && v.(string) == "SSH" { + return false + } + return true + }, + }, + "password": { + Type: schema.TypeString, + Optional: true, + Sensitive: true, + }, + "private_key": { + Type: schema.TypeString, + Optional: true, + Sensitive: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("protocol_name"); ok && v.(string) == "SSH" { + return false + } + return true + }, + }, + "protocol_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"RDP", "SSH"}, false), + }, + }, + } +} + +func resourceAlicloudBastionhostHostAccountCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateHostAccount" + request := make(map[string]interface{}) + conn, err := client.NewBastionhostClient() + if err != nil { + return WrapError(err) + } + request["HostAccountName"] = d.Get("host_account_name") + request["HostId"] = d.Get("host_id") + request["InstanceId"] = d.Get("instance_id") + if v, ok := d.GetOk("pass_phrase"); ok { + request["PassPhrase"] = v + } + if v, ok := d.GetOk("password"); ok { + request["Password"] = v + } + if v, ok := d.GetOk("private_key"); ok { + request["PrivateKey"] = v + } + request["ProtocolName"] = d.Get("protocol_name") + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_bastionhost_host_account", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["InstanceId"], ":", response["HostAccountId"])) + + return resourceAlicloudBastionhostHostAccountRead(d, meta) +} +func resourceAlicloudBastionhostHostAccountRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + yundunBastionhostService := YundunBastionhostService{client} + object, err := yundunBastionhostService.DescribeBastionhostHostAccount(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_bastionhost_host_account yundunBastionhostService.DescribeBastionhostHostAccount Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Set("host_account_id", parts[1]) + d.Set("instance_id", parts[0]) + d.Set("host_account_name", object["HostAccountName"]) + d.Set("host_id", object["HostId"]) + d.Set("protocol_name", object["ProtocolName"]) + return nil +} +func resourceAlicloudBastionhostHostAccountUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + update := false + request := map[string]interface{}{ + "HostAccountId": parts[1], + "InstanceId": parts[0], + } + if d.HasChange("host_account_name") { + update = true + request["HostAccountName"] = d.Get("host_account_name") + } + if d.HasChange("pass_phrase") { + update = true + if v, ok := d.GetOk("pass_phrase"); ok { + request["PassPhrase"] = v + } + } + if d.HasChange("password") { + update = true + if v, ok := d.GetOk("password"); ok { + request["Password"] = v + } + } + if d.HasChange("private_key") { + update = true + if v, ok := d.GetOk("private_key"); ok { + request["PrivateKey"] = v + } + } + request["RegionId"] = client.RegionId + if update { + action := "ModifyHostAccount" + conn, err := client.NewBastionhostClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudBastionhostHostAccountRead(d, meta) +} +func resourceAlicloudBastionhostHostAccountDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + action := "DeleteHostAccount" + var response map[string]interface{} + conn, err := client.NewBastionhostClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "HostAccountId": parts[1], + "InstanceId": parts[0], + } + + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"Commodity.BizError.InvalidStatus", "OBJECT_NOT_FOUND"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_host_account_user_attachment.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_host_account_user_attachment.go new file mode 100644 index 00000000000..266715bdae0 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_host_account_user_attachment.go @@ -0,0 +1,211 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudBastionhostHostAccountUserAttachment() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudBastionhostHostAccountUserAttachmentCreate, + Read: resourceAlicloudBastionhostHostAccountUserAttachmentRead, + Update: resourceAlicloudBastionhostHostAccountUserAttachmentUpdate, + Delete: resourceAlicloudBastionhostHostAccountUserAttachmentDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "host_account_ids": { + Type: schema.TypeSet, + Required: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "host_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "user_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudBastionhostHostAccountUserAttachmentCreate(d *schema.ResourceData, meta interface{}) error { + d.SetId(fmt.Sprint(d.Get("instance_id"), ":", d.Get("user_id"), ":", d.Get("host_id"))) + + return resourceAlicloudBastionhostHostAccountUserAttachmentUpdate(d, meta) +} +func resourceAlicloudBastionhostHostAccountUserAttachmentRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + yundunBastionhostService := YundunBastionhostService{client} + object, err := yundunBastionhostService.DescribeBastionhostHostAccountUserAttachment(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_bastionhost_host_account_user_attachment yundunBastionhostService.DescribeBastionhostHostAccountUserAttachment Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + d.Set("host_id", parts[2]) + d.Set("instance_id", parts[0]) + d.Set("user_id", parts[1]) + hostAccountIdsItems := make([]string, 0) + for _, item := range object { + itemMap := item.(map[string]interface{}) + if v, ok := itemMap["IsAuthorized"]; !ok || !v.(bool) { + continue + } + if v, ok := itemMap["HostAccountId"]; ok && v != nil { + hostAccountIdsItems = append(hostAccountIdsItems, fmt.Sprint(v)) + } + } + d.Set("host_account_ids", hostAccountIdsItems) + return nil +} +func resourceAlicloudBastionhostHostAccountUserAttachmentUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + if d.HasChange("host_account_ids") { + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + action := "AttachHostAccountsToUser" + request := make(map[string]interface{}) + conn, err := client.NewBastionhostClient() + if err != nil { + return WrapError(err) + } + + oraw, nraw := d.GetChange("host_account_ids") + request["InstanceId"] = parts[0] + request["RegionId"] = client.RegionId + request["UserId"] = parts[1] + + if oraw != nil && len(oraw.(*schema.Set).List()) > 0 { + action = "DetachHostAccountsFromUser" + hostRequestMaps := make([]map[string]interface{}, 0) + hostRequestMap := make(map[string]interface{}, 0) + hostRequestMap["HostId"] = parts[2] + hostRequestMap["HostAccountIds"] = oraw.(*schema.Set).List() + hostRequestMaps = append(hostRequestMaps, hostRequestMap) + if v, err := convertListMapToJsonString(hostRequestMaps); err != nil { + return WrapError(err) + } else { + request["Hosts"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + _, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + + return nil + }) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + if nraw != nil && len(nraw.(*schema.Set).List()) > 0 { + action = "AttachHostAccountsToUser" + hostRequestMaps := make([]map[string]interface{}, 0) + hostRequestMap := make(map[string]interface{}, 0) + hostRequestMap["HostId"] = parts[2] + hostRequestMap["HostAccountIds"] = nraw.(*schema.Set).List() + hostRequestMaps = append(hostRequestMaps, hostRequestMap) + if v, err := convertListMapToJsonString(hostRequestMaps); err != nil { + return WrapError(err) + } else { + request["Hosts"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + _, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + + return nil + }) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + } + return resourceAlicloudBastionhostHostAccountUserAttachmentRead(d, meta) +} +func resourceAlicloudBastionhostHostAccountUserAttachmentDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + action := "DetachHostAccountsFromUser" + var response map[string]interface{} + conn, err := client.NewBastionhostClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "InstanceId": parts[0], + "UserId": parts[1], + } + request["RegionId"] = client.RegionId + hostRequestMaps := make([]map[string]interface{}, 0) + hostRequestMap := make(map[string]interface{}, 0) + hostRequestMap["HostId"] = parts[2] + hostRequestMap["HostAccountIds"] = d.Get("host_account_ids").(*schema.Set).List() + hostRequestMaps = append(hostRequestMaps, hostRequestMap) + if v, err := convertListMapToJsonString(hostRequestMaps); err != nil { + return WrapError(err) + } else { + request["Hosts"] = v + } + + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_host_account_user_group_attachment.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_host_account_user_group_attachment.go new file mode 100644 index 00000000000..84419e67baa --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_host_account_user_group_attachment.go @@ -0,0 +1,209 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudBastionhostHostAccountUserGroupAttachment() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudBastionhostHostAccountUserGroupAttachmentCreate, + Read: resourceAlicloudBastionhostHostAccountUserGroupAttachmentRead, + Update: resourceAlicloudBastionhostHostAccountUserGroupAttachmentUpdate, + Delete: resourceAlicloudBastionhostHostAccountUserGroupAttachmentDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "host_account_ids": { + Type: schema.TypeSet, + Required: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "host_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "user_group_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudBastionhostHostAccountUserGroupAttachmentCreate(d *schema.ResourceData, meta interface{}) error { + d.SetId(fmt.Sprint(d.Get("instance_id"), ":", d.Get("user_group_id"), ":", d.Get("host_id"))) + + return resourceAlicloudBastionhostHostAccountUserGroupAttachmentUpdate(d, meta) +} +func resourceAlicloudBastionhostHostAccountUserGroupAttachmentRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + yundunBastionhostService := YundunBastionhostService{client} + object, err := yundunBastionhostService.DescribeBastionhostHostAccountUserGroupAttachment(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_bastionhost_host_account_user_attachment yundunBastionhostService.DescribeBastionhostHostAccountUserGroupAttachment Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + d.Set("host_id", parts[2]) + d.Set("instance_id", parts[0]) + d.Set("user_group_id", parts[1]) + hostAccountIdsItems := make([]string, 0) + for _, item := range object { + itemMap := item.(map[string]interface{}) + if v, ok := itemMap["IsAuthorized"]; !ok || !v.(bool) { + continue + } + if v, ok := itemMap["HostAccountId"]; ok && v != nil { + hostAccountIdsItems = append(hostAccountIdsItems, fmt.Sprint(v)) + } + } + d.Set("host_account_ids", hostAccountIdsItems) + return nil +} +func resourceAlicloudBastionhostHostAccountUserGroupAttachmentUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + if d.HasChange("host_account_ids") { + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + action := "AttachHostAccountsToUserGroup" + request := make(map[string]interface{}) + conn, err := client.NewBastionhostClient() + if err != nil { + return WrapError(err) + } + + oraw, nraw := d.GetChange("host_account_ids") + request["InstanceId"] = parts[0] + request["RegionId"] = client.RegionId + request["UserGroupId"] = parts[1] + + if oraw != nil && len(oraw.(*schema.Set).List()) > 0 { + action = "DetachHostAccountsFromUserGroup" + hostRequestMaps := make([]map[string]interface{}, 0) + hostRequestMap := make(map[string]interface{}, 0) + hostRequestMap["HostId"] = parts[2] + hostRequestMap["HostAccountIds"] = oraw.(*schema.Set).List() + hostRequestMaps = append(hostRequestMaps, hostRequestMap) + if v, err := convertListMapToJsonString(hostRequestMaps); err != nil { + return WrapError(err) + } else { + request["Hosts"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + _, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + if nraw != nil && len(nraw.(*schema.Set).List()) > 0 { + action = "AttachHostAccountsToUserGroup" + hostRequestMaps := make([]map[string]interface{}, 0) + hostRequestMap := make(map[string]interface{}, 0) + hostRequestMap["HostId"] = parts[2] + hostRequestMap["HostAccountIds"] = nraw.(*schema.Set).List() + hostRequestMaps = append(hostRequestMaps, hostRequestMap) + if v, err := convertListMapToJsonString(hostRequestMaps); err != nil { + return WrapError(err) + } else { + request["Hosts"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + _, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + } + return resourceAlicloudBastionhostHostAccountUserGroupAttachmentRead(d, meta) +} +func resourceAlicloudBastionhostHostAccountUserGroupAttachmentDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + action := "DetachHostAccountsFromUserGroup" + var response map[string]interface{} + conn, err := client.NewBastionhostClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "InstanceId": parts[0], + "UserGroupId": parts[1], + } + request["RegionId"] = client.RegionId + hostRequestMaps := make([]map[string]interface{}, 0) + hostRequestMap := make(map[string]interface{}, 0) + hostRequestMap["HostId"] = parts[2] + hostRequestMap["HostAccountIds"] = d.Get("host_account_ids").(*schema.Set).List() + hostRequestMaps = append(hostRequestMaps, hostRequestMap) + if v, err := convertListMapToJsonString(hostRequestMaps); err != nil { + return WrapError(err) + } else { + request["Hosts"] = v + } + + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_host_attachment.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_host_attachment.go new file mode 100644 index 00000000000..4f6c38f8386 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_host_attachment.go @@ -0,0 +1,133 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudBastionhostHostAttachment() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudBastionhostHostAttachmentCreate, + Read: resourceAlicloudBastionhostHostAttachmentRead, + Delete: resourceAlicloudBastionhostHostAttachmentDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "host_group_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "host_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudBastionhostHostAttachmentCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "AddHostsToGroup" + request := make(map[string]interface{}) + conn, err := client.NewBastionhostClient() + if err != nil { + return WrapError(err) + } + request["HostGroupId"] = d.Get("host_group_id") + request["HostIds"] = convertListToJsonString([]interface{}{d.Get("host_id")}) + request["InstanceId"] = d.Get("instance_id") + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_bastionhost_host_attachment", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["InstanceId"], ":", request["HostGroupId"], ":", d.Get("host_id"))) + + return resourceAlicloudBastionhostHostAttachmentRead(d, meta) +} +func resourceAlicloudBastionhostHostAttachmentRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + yundunBastionhostService := YundunBastionhostService{client} + _, err := yundunBastionhostService.DescribeBastionhostHostAttachment(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_bastionhost_host_attachment yundunBastionhostService.DescribeBastionhostHostAttachment Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + d.Set("host_group_id", parts[1]) + d.Set("host_id", parts[2]) + d.Set("instance_id", parts[0]) + return nil +} +func resourceAlicloudBastionhostHostAttachmentDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + action := "RemoveHostsFromGroup" + var response map[string]interface{} + conn, err := client.NewBastionhostClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "HostGroupId": parts[1], + "HostIds": convertListToJsonString([]interface{}{parts[2]}), + "InstanceId": parts[0], + } + + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_host_group.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_host_group.go new file mode 100644 index 00000000000..0be8639ede6 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_host_group.go @@ -0,0 +1,189 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudBastionhostHostGroup() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudBastionhostHostGroupCreate, + Read: resourceAlicloudBastionhostHostGroupRead, + Update: resourceAlicloudBastionhostHostGroupUpdate, + Delete: resourceAlicloudBastionhostHostGroupDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "comment": { + Type: schema.TypeString, + Optional: true, + }, + "host_group_id": { + Type: schema.TypeString, + Computed: true, + }, + "host_group_name": { + Type: schema.TypeString, + Required: true, + }, + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudBastionhostHostGroupCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateHostGroup" + request := make(map[string]interface{}) + conn, err := client.NewBastionhostClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("comment"); ok { + request["Comment"] = v + } + request["HostGroupName"] = d.Get("host_group_name") + request["InstanceId"] = d.Get("instance_id") + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_bastionhost_host_group", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["InstanceId"], ":", response["HostGroupId"])) + + return resourceAlicloudBastionhostHostGroupRead(d, meta) +} +func resourceAlicloudBastionhostHostGroupRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + yundunBastionhostService := YundunBastionhostService{client} + object, err := yundunBastionhostService.DescribeBastionhostHostGroup(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_bastionhost_host_group yundunBastionhostService.DescribeBastionhostHostGroup Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Set("host_group_id", parts[1]) + d.Set("instance_id", parts[0]) + d.Set("comment", object["Comment"]) + d.Set("host_group_name", object["HostGroupName"]) + return nil +} +func resourceAlicloudBastionhostHostGroupUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + update := false + request := map[string]interface{}{ + "HostGroupId": parts[1], + "InstanceId": parts[0], + } + if d.HasChange("comment") { + update = true + if v, ok := d.GetOk("comment"); ok { + request["Comment"] = v + } + } + if d.HasChange("host_group_name") { + update = true + request["HostGroupName"] = d.Get("host_group_name") + } + request["RegionId"] = client.RegionId + if update { + action := "ModifyHostGroup" + conn, err := client.NewBastionhostClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudBastionhostHostGroupRead(d, meta) +} +func resourceAlicloudBastionhostHostGroupDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + action := "DeleteHostGroup" + var response map[string]interface{} + conn, err := client.NewBastionhostClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "HostGroupId": parts[1], + "InstanceId": parts[0], + } + + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"OBJECT_NOT_FOUND"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_host_group_account_user_attachment.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_host_group_account_user_attachment.go new file mode 100644 index 00000000000..4fa60b12c19 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_host_group_account_user_attachment.go @@ -0,0 +1,201 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudBastionhostHostGroupAccountUserAttachment() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudBastionhostHostGroupAccountUserAttachmentCreate, + Read: resourceAlicloudBastionhostHostGroupAccountUserAttachmentRead, + Update: resourceAlicloudBastionhostHostGroupAccountUserAttachmentUpdate, + Delete: resourceAlicloudBastionhostHostGroupAccountUserAttachmentDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "host_account_names": { + Type: schema.TypeSet, + Required: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "host_group_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "user_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudBastionhostHostGroupAccountUserAttachmentCreate(d *schema.ResourceData, meta interface{}) error { + d.SetId(fmt.Sprint(d.Get("instance_id"), ":", d.Get("user_id"), ":", d.Get("host_group_id"))) + + return resourceAlicloudBastionhostHostGroupAccountUserAttachmentUpdate(d, meta) +} +func resourceAlicloudBastionhostHostGroupAccountUserAttachmentRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + yundunBastionhostService := YundunBastionhostService{client} + object, err := yundunBastionhostService.DescribeBastionhostHostGroupAccountUserAttachment(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_bastionhost_host_group_account_user_attachment yundunBastionhostService.DescribeBastionhostHostGroupAccountUserAttachment Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + d.Set("host_group_id", parts[2]) + d.Set("instance_id", parts[0]) + d.Set("user_id", parts[1]) + d.Set("host_account_names", object) + return nil +} +func resourceAlicloudBastionhostHostGroupAccountUserAttachmentUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + if d.HasChange("host_account_names") { + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + action := "AttachHostGroupAccountsToUser" + request := make(map[string]interface{}) + conn, err := client.NewBastionhostClient() + if err != nil { + return WrapError(err) + } + + oraw, nraw := d.GetChange("host_account_names") + request["InstanceId"] = parts[0] + request["RegionId"] = client.RegionId + request["UserId"] = parts[1] + + if oraw != nil && len(oraw.(*schema.Set).List()) > 0 { + action = "DetachHostGroupAccountsFromUser" + hostRequestMaps := make([]map[string]interface{}, 0) + hostRequestMap := make(map[string]interface{}, 0) + hostRequestMap["HostGroupId"] = parts[2] + hostRequestMap["HostAccountNames"] = oraw.(*schema.Set).List() + hostRequestMaps = append(hostRequestMaps, hostRequestMap) + if v, err := convertListMapToJsonString(hostRequestMaps); err != nil { + return WrapError(err) + } else { + request["HostGroups"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + _, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + + return nil + }) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + if nraw != nil && len(nraw.(*schema.Set).List()) > 0 { + action = "AttachHostGroupAccountsToUser" + hostRequestMaps := make([]map[string]interface{}, 0) + hostRequestMap := make(map[string]interface{}, 0) + hostRequestMap["HostGroupId"] = parts[2] + hostRequestMap["HostAccountNames"] = nraw.(*schema.Set).List() + hostRequestMaps = append(hostRequestMaps, hostRequestMap) + if v, err := convertListMapToJsonString(hostRequestMaps); err != nil { + return WrapError(err) + } else { + request["HostGroups"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + _, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + + return nil + }) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + } + return resourceAlicloudBastionhostHostGroupAccountUserAttachmentRead(d, meta) +} +func resourceAlicloudBastionhostHostGroupAccountUserAttachmentDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + action := "DetachHostGroupAccountsFromUser" + var response map[string]interface{} + conn, err := client.NewBastionhostClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "InstanceId": parts[0], + "UserId": parts[1], + } + request["RegionId"] = client.RegionId + hostRequestMaps := make([]map[string]interface{}, 0) + hostRequestMap := make(map[string]interface{}, 0) + hostRequestMap["HostGroupId"] = parts[2] + hostRequestMap["HostAccountNames"] = d.Get("host_account_names").(*schema.Set).List() + hostRequestMaps = append(hostRequestMaps, hostRequestMap) + if v, err := convertListMapToJsonString(hostRequestMaps); err != nil { + return WrapError(err) + } else { + request["HostGroups"] = v + } + + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_host_group_account_user_group_attachment.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_host_group_account_user_group_attachment.go new file mode 100644 index 00000000000..3e473c6aa27 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_host_group_account_user_group_attachment.go @@ -0,0 +1,201 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudBastionhostHostGroupAccountUserGroupAttachment() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudBastionhostHostGroupAccountUserGroupAttachmentCreate, + Read: resourceAlicloudBastionhostHostGroupAccountUserGroupAttachmentRead, + Update: resourceAlicloudBastionhostHostGroupAccountUserGroupAttachmentUpdate, + Delete: resourceAlicloudBastionhostHostGroupAccountUserGroupAttachmentDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "host_account_names": { + Type: schema.TypeSet, + Required: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "host_group_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "user_group_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudBastionhostHostGroupAccountUserGroupAttachmentCreate(d *schema.ResourceData, meta interface{}) error { + d.SetId(fmt.Sprint(d.Get("instance_id"), ":", d.Get("user_group_id"), ":", d.Get("host_group_id"))) + + return resourceAlicloudBastionhostHostGroupAccountUserGroupAttachmentUpdate(d, meta) +} +func resourceAlicloudBastionhostHostGroupAccountUserGroupAttachmentRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + yundunBastionhostService := YundunBastionhostService{client} + object, err := yundunBastionhostService.DescribeBastionhostHostGroupAccountUserGroupAttachment(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_bastionhost_host_group_account_user_group_attachment yundunBastionhostService.DescribeBastionhostHostGroupAccountUserGroupAttachment Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + d.Set("host_group_id", parts[2]) + d.Set("instance_id", parts[0]) + d.Set("user_group_id", parts[1]) + d.Set("host_account_names", object) + return nil +} +func resourceAlicloudBastionhostHostGroupAccountUserGroupAttachmentUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + if d.HasChange("host_account_names") { + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + action := "AttachHostGroupAccountsToUserGroup" + request := make(map[string]interface{}) + conn, err := client.NewBastionhostClient() + if err != nil { + return WrapError(err) + } + + oraw, nraw := d.GetChange("host_account_names") + request["InstanceId"] = parts[0] + request["RegionId"] = client.RegionId + request["UserGroupId"] = parts[1] + + if oraw != nil && len(oraw.(*schema.Set).List()) > 0 { + action = "DetachHostGroupAccountsFromUserGroup" + hostRequestMaps := make([]map[string]interface{}, 0) + hostRequestMap := make(map[string]interface{}, 0) + hostRequestMap["HostGroupId"] = parts[2] + hostRequestMap["HostAccountNames"] = oraw.(*schema.Set).List() + hostRequestMaps = append(hostRequestMaps, hostRequestMap) + if v, err := convertListMapToJsonString(hostRequestMaps); err != nil { + return WrapError(err) + } else { + request["HostGroups"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + _, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + + return nil + }) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + if nraw != nil && len(nraw.(*schema.Set).List()) > 0 { + action = "AttachHostGroupAccountsToUserGroup" + hostRequestMaps := make([]map[string]interface{}, 0) + hostRequestMap := make(map[string]interface{}, 0) + hostRequestMap["HostGroupId"] = parts[2] + hostRequestMap["HostAccountNames"] = nraw.(*schema.Set).List() + hostRequestMaps = append(hostRequestMaps, hostRequestMap) + if v, err := convertListMapToJsonString(hostRequestMaps); err != nil { + return WrapError(err) + } else { + request["HostGroups"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + _, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + + return nil + }) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + } + return resourceAlicloudBastionhostHostGroupAccountUserGroupAttachmentRead(d, meta) +} +func resourceAlicloudBastionhostHostGroupAccountUserGroupAttachmentDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + action := "DetachHostGroupAccountsFromUserGroup" + var response map[string]interface{} + conn, err := client.NewBastionhostClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "InstanceId": parts[0], + "UserGroupId": parts[1], + } + request["RegionId"] = client.RegionId + hostRequestMaps := make([]map[string]interface{}, 0) + hostRequestMap := make(map[string]interface{}, 0) + hostRequestMap["HostGroupId"] = parts[2] + hostRequestMap["HostAccountNames"] = d.Get("host_account_names").(*schema.Set).List() + hostRequestMaps = append(hostRequestMaps, hostRequestMap) + if v, err := convertListMapToJsonString(hostRequestMaps); err != nil { + return WrapError(err) + } else { + request["HostGroups"] = v + } + + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_instance.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_instance.go index 3878837ad8e..e0566bf85ad 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_instance.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_instance.go @@ -2,24 +2,19 @@ package alicloud import ( "fmt" - "github.com/aliyun/alibaba-cloud-sdk-go/services/yundun_bastionhost" + "strconv" "time" + log "github.com/sirupsen/logrus" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi" "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" ) -const ( - BATIONHOST_RELEASE_HANG_MINS = 5 - BASTIONHOST_WAITING_FOR_START = 600 -) - func resourceAlicloudBastionhostInstance() *schema.Resource { return &schema.Resource{ Create: resourceAlicloudBastionhostInstanceCreate, @@ -28,8 +23,9 @@ func resourceAlicloudBastionhostInstance() *schema.Resource { Delete: resourceAlicloudBastionhostInstanceDelete, Timeouts: &schema.ResourceTimeout{ - Create: schema.DefaultTimeout(20 * time.Minute), + Create: schema.DefaultTimeout(30 * time.Minute), Update: schema.DefaultTimeout(20 * time.Minute), + Delete: schema.DefaultTimeout(1 * time.Minute), }, Importer: &schema.ResourceImporter{ @@ -67,6 +63,11 @@ func resourceAlicloudBastionhostInstance() *schema.Resource { Type: schema.TypeString, Optional: true, }, + "enable_public_access": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, }, } } @@ -153,7 +154,7 @@ func resourceAlicloudBastionhostInstanceCreate(d *schema.ResourceData, meta inte return WrapError(err) } // wait for pending - stateConf = BuildStateConf([]string{"PENDING", "CREATING"}, []string{"RUNNING"}, d.Timeout(schema.TimeoutCreate), BASTIONHOST_WAITING_FOR_START*time.Second, bastionhostService.BastionhostInstanceRefreshFunc(d.Id(), []string{"UPGRADING", "UPGRADE_FAILED", "CREATE_FAILED"})) + stateConf = BuildStateConf([]string{"PENDING", "CREATING"}, []string{"RUNNING"}, d.Timeout(schema.TimeoutCreate), 600*time.Second, bastionhostService.BastionhostInstanceRefreshFunc(d.Id(), []string{"UPGRADING", "UPGRADE_FAILED", "CREATE_FAILED"})) if _, err := stateConf.WaitForState(); err != nil { return WrapErrorf(err, IdMsg, d.Id()) } @@ -163,7 +164,7 @@ func resourceAlicloudBastionhostInstanceCreate(d *schema.ResourceData, meta inte func resourceAlicloudBastionhostInstanceRead(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) BastionhostService := YundunBastionhostService{client} - instance, err := BastionhostService.DescribeBastionhostInstanceAttribute(d.Id()) + instance, err := BastionhostService.DescribeBastionhostInstance(d.Id()) if err != nil { if NotFoundError(err) { d.SetId("") @@ -175,7 +176,7 @@ func resourceAlicloudBastionhostInstanceRead(d *schema.ResourceData, meta interf d.Set("license_code", instance["LicenseCode"]) d.Set("vswitch_id", instance["VswitchId"]) d.Set("security_group_ids", instance["AuthorizedSecurityGroups"]) - + d.Set("enable_public_access", instance["PublicNetworkAccess"]) tags, err := BastionhostService.DescribeTags(d.Id(), nil, TagResourceInstance) if err != nil { return WrapError(err) @@ -210,12 +211,7 @@ func resourceAlicloudBastionhostInstanceUpdate(d *schema.ResourceData, meta inte d.SetPartial("resource_group_id") } - if d.IsNewResource() { - d.Partial(false) - return resourceAlicloudBastionhostInstanceRead(d, meta) - } - - if d.HasChange("license_code") { + if !d.IsNewResource() && d.HasChange("license_code") { params := map[string]string{ "LicenseCode": "license_code", } @@ -229,7 +225,7 @@ func resourceAlicloudBastionhostInstanceUpdate(d *schema.ResourceData, meta inte d.SetPartial("license_code") } - if d.HasChange("security_group_ids") { + if !d.IsNewResource() && d.HasChange("security_group_ids") { securityGroupIds := d.Get("security_group_ids").([]interface{}) sgs := make([]string, 0, len(securityGroupIds)) for _, rawSecurityGroupId := range securityGroupIds { @@ -245,57 +241,36 @@ func resourceAlicloudBastionhostInstanceUpdate(d *schema.ResourceData, meta inte d.SetPartial("security_group_ids") } + if d.HasChange("enable_public_access") { + client := meta.(*connectivity.AliyunClient) + BastionhostService := YundunBastionhostService{client} + instance, err := BastionhostService.DescribeBastionhostInstance(d.Id()) + if err != nil { + return WrapError(err) + } + target := strconv.FormatBool(d.Get("enable_public_access").(bool)) + if strconv.FormatBool(instance["PublicNetworkAccess"].(bool)) != target { + if target == "false" { + err := BastionhostService.DisableInstancePublicAccess(d.Id()) + if err != nil { + return WrapError(err) + } + } else { + err := BastionhostService.EnableInstancePublicAccess(d.Id()) + if err != nil { + return WrapError(err) + } + } + } + d.SetPartial("enable_public_access") + } + d.Partial(false) // wait for order complete return resourceAlicloudBastionhostInstanceRead(d, meta) } func resourceAlicloudBastionhostInstanceDelete(d *schema.ResourceData, meta interface{}) error { - client := meta.(*connectivity.AliyunClient) - bastionhostService := YundunBastionhostService{client} - request := yundun_bastionhost.CreateRefundInstanceRequest() - request.InstanceId = d.Id() - - raw, err := bastionhostService.client.WithBastionhostClient(func(BastionhostClient *yundun_bastionhost.Client) (interface{}, error) { - return BastionhostClient.RefundInstance(request) - }) - - if err != nil { - return WrapErrorf(err, DefaultErrorMsg, d.Id(), request.GetActionName(), AlibabaCloudSdkGoERROR) - } - addDebug(request.GetActionName(), raw, request.RpcRequest, request) - // Wait for the release procedure of cloud resource dependencies. Instance can not be fetched through api as soon as release has - // been invoked, however the resources have not been fully destroyed yet. Therefore, a certain amount time of waiting - // is quite necessary (conservative estimation cloud be less then 3 minutes) - time.Sleep(BATIONHOST_RELEASE_HANG_MINS * time.Minute) - return WrapError(bastionhostService.WaitForYundunBastionhostInstance(d.Id(), Deleted, 0)) -} - -func buildBastionhostCreateRequest(d *schema.ResourceData, meta interface{}) *bssopenapi.CreateInstanceRequest { - request := bssopenapi.CreateCreateInstanceRequest() - request.ProductCode = "bastionhost" - request.SubscriptionType = "Subscription" - request.Period = requests.NewInteger(d.Get("period").(int)) - client := meta.(*connectivity.AliyunClient) - - request.Parameter = &[]bssopenapi.CreateInstanceParameter{ - // force to buy vpc version - { - Code: "NetworkType", - Value: "vpc", - }, - { - Code: "LicenseCode", - Value: d.Get("license_code").(string), - }, - { - Code: "PlanCode", - Value: "cloudbastion", - }, - { - Code: "RegionId", - Value: client.RegionId, - }, - } - return request + log.Printf("[WARN] Cannot destroy resourceBastionhostInstance. Terraform will remove this resource from the state file, however resources may remain.") + return nil } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_user.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_user.go new file mode 100644 index 00000000000..4de15325dd0 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_user.go @@ -0,0 +1,371 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudBastionhostUser() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudBastionhostUserCreate, + Read: resourceAlicloudBastionhostUserRead, + Update: resourceAlicloudBastionhostUserUpdate, + Delete: resourceAlicloudBastionhostUserDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "comment": { + Type: schema.TypeString, + Optional: true, + }, + "display_name": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "email": { + Type: schema.TypeString, + Optional: true, + }, + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "mobile": { + Type: schema.TypeString, + Optional: true, + }, + "mobile_country_code": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"AE", "AU", "CH", "CN", "DE", "GB", "HK", "ID", "IN", "JP", "KR", "MO", "MY", "PH", "RU", "SE", "SG", "TW", "US"}, false), + }, + "password": { + Type: schema.TypeString, + Optional: true, + Sensitive: true, + }, + "source": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Local", "Ram"}, false), + }, + "source_user_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"Frozen", "Normal"}, false), + }, + "user_id": { + Type: schema.TypeString, + Computed: true, + }, + "user_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudBastionhostUserCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateUser" + request := make(map[string]interface{}) + conn, err := client.NewBastionhostClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("comment"); ok { + request["Comment"] = v + } + if v, ok := d.GetOk("display_name"); ok { + request["DisplayName"] = v + } + if v, ok := d.GetOk("email"); ok { + request["Email"] = v + } + request["InstanceId"] = d.Get("instance_id") + if v, ok := d.GetOk("mobile"); ok { + request["Mobile"] = v + } else if v, ok := d.GetOk("mobile_country_code"); ok && v.(string) == "" { + return WrapError(fmt.Errorf("attribute '%s' is required when '%s' is %v ", "mobile", "mobile_country_code", d.Get("mobile_country_code"))) + } + if v, ok := d.GetOk("mobile_country_code"); ok { + request["MobileCountryCode"] = v + } + if v, ok := d.GetOk("password"); ok { + request["Password"] = v + } else if v, ok := d.GetOk("source"); ok && v.(string) == "Local" { + return WrapError(fmt.Errorf("attribute '%s' is required when '%s' is %v ", "password", "source", d.Get("source"))) + } + request["RegionId"] = client.RegionId + request["Source"] = d.Get("source") + if v, ok := d.GetOk("source_user_id"); ok { + request["SourceUserId"] = v + } else if v, ok := d.GetOk("source"); ok && v.(string) == "Ram" { + return WrapError(fmt.Errorf("attribute '%s' is required when '%s' is %v ", "source_user_id", "source", d.Get("source"))) + } + request["UserName"] = d.Get("user_name") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_bastionhost_user", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["InstanceId"], ":", response["UserId"])) + + return resourceAlicloudBastionhostUserUpdate(d, meta) +} +func resourceAlicloudBastionhostUserRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + yundunBastionhostService := YundunBastionhostService{client} + object, err := yundunBastionhostService.DescribeBastionhostUser(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_bastionhost_user yundunBastionhostService.DescribeBastionhostUser Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Set("instance_id", parts[0]) + d.Set("user_id", parts[1]) + d.Set("comment", object["Comment"]) + d.Set("display_name", object["DisplayName"]) + d.Set("email", object["Email"]) + d.Set("mobile", object["Mobile"]) + d.Set("mobile_country_code", object["MobileCountryCode"]) + d.Set("source", object["Source"]) + d.Set("source_user_id", object["SourceUserId"]) + d.Set("status", convertArrayToString(object["UserState"], "")) + d.Set("user_name", object["UserName"]) + return nil +} +func resourceAlicloudBastionhostUserUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + yundunBastionhostService := YundunBastionhostService{client} + var response map[string]interface{} + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Partial(true) + + update := false + request := map[string]interface{}{ + "InstanceId": parts[0], + "UserId": parts[1], + } + if !d.IsNewResource() && d.HasChange("comment") { + update = true + if v, ok := d.GetOk("comment"); ok { + request["Comment"] = v + } + } + if !d.IsNewResource() && d.HasChange("display_name") { + update = true + if v, ok := d.GetOk("display_name"); ok { + request["DisplayName"] = v + } + } + if !d.IsNewResource() && d.HasChange("email") { + update = true + if v, ok := d.GetOk("email"); ok { + request["Email"] = v + } + } + if !d.IsNewResource() && d.HasChange("mobile") { + update = true + if v, ok := d.GetOk("mobile"); ok { + request["Mobile"] = v + } else if v, ok := d.GetOk("mobile_country_code"); ok && v.(string) == "" { + return WrapError(fmt.Errorf("attribute '%s' is required when '%s' is %v ", "mobile", "mobile_country_code", d.Get("mobile_country_code"))) + } + request["MobileCountryCode"] = d.Get("mobile_country_code") + } + if !d.IsNewResource() && d.HasChange("mobile_country_code") { + update = true + if v, ok := d.GetOk("mobile_country_code"); ok { + request["MobileCountryCode"] = v + } + } + if !d.IsNewResource() && d.HasChange("password") { + update = true + if v, ok := d.GetOk("password"); ok { + request["Password"] = v + } else if v, ok := d.GetOk("source"); ok && v.(string) == "Local" { + return WrapError(fmt.Errorf("attribute '%s' is required when '%s' is %v ", "password", "source", d.Get("source"))) + } + } + request["RegionId"] = client.RegionId + if update { + action := "ModifyUser" + conn, err := client.NewBastionhostClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("comment") + d.SetPartial("display_name") + d.SetPartial("email") + d.SetPartial("mobile") + d.SetPartial("mobile_country_code") + d.SetPartial("password") + } + if d.HasChange("status") { + object, err := yundunBastionhostService.DescribeBastionhostUser(d.Id()) + if err != nil { + return WrapError(err) + } + target := d.Get("status").(string) + if convertArrayToString(object["UserState"], "") != target { + if target == "Frozen" { + request := map[string]interface{}{ + "InstanceId": parts[0], + "UserIds": convertListToJsonString([]interface{}{parts[1]}), + } + request["RegionId"] = client.RegionId + action := "LockUsers" + conn, err := client.NewBastionhostClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + if target == "Normal" { + request := map[string]interface{}{ + "InstanceId": parts[0], + "UserIds": convertListToJsonString([]interface{}{parts[1]}), + } + request["RegionId"] = client.RegionId + action := "UnlockUsers" + conn, err := client.NewBastionhostClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + d.SetPartial("status") + } + } + d.Partial(false) + return resourceAlicloudBastionhostUserRead(d, meta) +} +func resourceAlicloudBastionhostUserDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + action := "DeleteUser" + var response map[string]interface{} + conn, err := client.NewBastionhostClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "InstanceId": parts[0], + "UserId": parts[1], + } + + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"OBJECT_NOT_FOUND"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_user_attachment.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_user_attachment.go new file mode 100644 index 00000000000..9c12c86a0a4 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_bastionhost_user_attachment.go @@ -0,0 +1,136 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudBastionhostUserAttachment() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudBastionhostUserAttachmentCreate, + Read: resourceAlicloudBastionhostUserAttachmentRead, + Delete: resourceAlicloudBastionhostUserAttachmentDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "user_group_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "user_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudBastionhostUserAttachmentCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "AddUsersToGroup" + request := make(map[string]interface{}) + conn, err := client.NewBastionhostClient() + if err != nil { + return WrapError(err) + } + request["InstanceId"] = d.Get("instance_id") + request["RegionId"] = client.RegionId + request["UserGroupId"] = d.Get("user_group_id") + request["UserIds"] = convertListToJsonString([]interface{}{d.Get("user_id")}) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_bastionhost_user_attachment", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["InstanceId"], ":", request["UserGroupId"], ":", d.Get("user_id"))) + + return resourceAlicloudBastionhostUserAttachmentRead(d, meta) +} +func resourceAlicloudBastionhostUserAttachmentRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + yundunBastionhostService := YundunBastionhostService{client} + _, err := yundunBastionhostService.DescribeBastionhostUserAttachment(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_bastionhost_user_attachment yundunBastionhostService.DescribeBastionhostUserAttachment Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + d.Set("instance_id", parts[0]) + d.Set("user_group_id", parts[1]) + d.Set("user_id", parts[2]) + return nil +} +func resourceAlicloudBastionhostUserAttachmentDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + action := "RemoveUsersFromGroup" + var response map[string]interface{} + conn, err := client.NewBastionhostClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "InstanceId": parts[0], + "UserGroupId": parts[1], + "UserIds": convertListToJsonString([]interface{}{parts[2]}), + } + + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"Commodity.BizError.InvalidStatus", "OBJECT_NOT_FOUND"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cddc_dedicated_host.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cddc_dedicated_host.go new file mode 100644 index 00000000000..cb7f4bc6b7a --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cddc_dedicated_host.go @@ -0,0 +1,315 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudCddcDedicatedHost() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudCddcDedicatedHostCreate, + Read: resourceAlicloudCddcDedicatedHostRead, + Update: resourceAlicloudCddcDedicatedHostUpdate, + Delete: resourceAlicloudCddcDedicatedHostDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(20 * time.Minute), + Update: schema.DefaultTimeout(20 * time.Minute), + Delete: schema.DefaultTimeout(20 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "allocation_status": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"Allocatable", "Suspended"}, false), + }, + "auto_renew": { + Type: schema.TypeBool, + Optional: true, + }, + "dedicated_host_group_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "dedicated_host_id": { + Type: schema.TypeString, + Computed: true, + }, + "host_class": { + Type: schema.TypeString, + Required: true, + }, + "host_name": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-zA_Z][a-zA-Z0-9_-]{1,63}`), "The name must be `1` to `64` characters in length and can contain letters, digits, underscores (_), and hyphens (-). The name must start with a letter."), + }, + "image_category": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"WindowsWithMssqlEntAlwaysonLicense", "WindowsWithMssqlStdLicense", "WindowsWithMssqlEntLicense", "WindowsWithMssqlWebLicense", "AliLinux"}, false), + }, + "os_password": { + Type: schema.TypeString, + Optional: true, + Sensitive: true, + }, + "payment_type": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"Subscription"}, false), + }, + "period": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"Month", "Year", "Week"}, false), + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "tags": tagsSchema(), + "used_time": { + Type: schema.TypeInt, + Optional: true, + }, + "vswitch_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "zone_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudCddcDedicatedHostCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateDedicatedHost" + request := make(map[string]interface{}) + conn, err := client.NewCddcClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("auto_renew"); ok { + request["AutoRenew"] = v + } + request["DedicatedHostGroupId"] = d.Get("dedicated_host_group_id") + request["HostClass"] = d.Get("host_class") + if v, ok := d.GetOk("host_name"); ok { + request["HostName"] = v + } + if v, ok := d.GetOk("image_category"); ok { + request["ImageCategory"] = v + } + if v, ok := d.GetOk("os_password"); ok { + request["OsPassword"] = v + } + request["PayType"] = convertCddcDedicatedPaymentTypeRequest(d.Get("payment_type").(string)) + if v, ok := d.GetOk("period"); ok { + request["Period"] = v + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("used_time"); ok { + request["UsedTime"] = fmt.Sprint(v) + } + request["ZoneId"] = d.Get("zone_id") + if v, ok := d.GetOk("vswitch_id"); ok { + request["VSwitchId"] = v + } + request["ClientToken"] = buildClientToken("CreateDedicatedHost") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-03-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_cddc_dedicated_host", action, AlibabaCloudSdkGoERROR) + } + responseDedicateHostList := response["DedicateHostList"].(map[string]interface{}) + d.SetId(fmt.Sprint(request["DedicatedHostGroupId"], ":", responseDedicateHostList["DedicateHostList"].([]interface{})[0].(map[string]interface{})["DedicatedHostId"])) + cddcService := CddcService{client} + stateConf := BuildStateConf([]string{}, []string{"1"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, cddcService.CddcDedicatedHostStateRefreshFunc(d.Id(), []string{"5"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudCddcDedicatedHostUpdate(d, meta) +} +func resourceAlicloudCddcDedicatedHostRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + cddcService := CddcService{client} + object, err := cddcService.DescribeCddcDedicatedHost(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_cddc_dedicated_host cddcService.DescribeCddcDedicatedHost Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("dedicated_host_group_id", object["DedicatedHostGroupId"]) + d.Set("host_class", object["HostClass"]) + d.Set("host_name", object["HostName"]) + d.Set("status", object["HostStatus"]) + d.Set("vswitch_id", object["VSwitchId"]) + d.Set("zone_id", object["ZoneId"]) + d.Set("allocation_status", convertCddcAllocationStatusResponse(object["AllocationStatus"].(string))) + d.Set("dedicated_host_id", object["DedicatedHostId"]) + listTagResourcesObject, err := cddcService.ListTagResources(d.Id(), "DEDICATEDHOST") + if err != nil { + return WrapError(err) + } + d.Set("tags", tagsToMap(listTagResourcesObject)) + return nil +} +func resourceAlicloudCddcDedicatedHostUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + cddcService := CddcService{client} + var response map[string]interface{} + d.Partial(true) + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + if d.HasChange("tags") { + if err := cddcService.SetResourceTags(d, "DEDICATEDHOST"); err != nil { + return WrapError(err) + } + d.SetPartial("tags") + } + + if d.HasChange("host_name") || d.HasChange("allocation_status") { + request := map[string]interface{}{ + "DedicatedHostId": parts[1], + } + if v, ok := d.GetOk("host_name"); ok { + request["HostName"] = v + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("allocation_status"); ok { + request["AllocationStatus"] = convertCddcAllocationStatusRequest(v.(string)) + } + action := "ModifyDedicatedHostAttribute" + conn, err := client.NewCddcClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-03-20"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"1"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, cddcService.CddcDedicatedHostStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + d.SetPartial("host_name") + } + + if !d.IsNewResource() && d.HasChange("host_class") { + request := map[string]interface{}{ + "DedicatedHostId": parts[1], + } + request["TargetClassCode"] = d.Get("host_class") + request["RegionId"] = client.RegionId + action := "ModifyDedicatedHostClass" + conn, err := client.NewCddcClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-03-20"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"1"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, cddcService.CddcDedicatedHostStateRefreshFunc(d.Id(), []string{"5"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + d.SetPartial("host_class") + } + d.Partial(false) + return resourceAlicloudCddcDedicatedHostRead(d, meta) +} +func resourceAlicloudCddcDedicatedHostDelete(d *schema.ResourceData, meta interface{}) error { + log.Printf("[WARN] Cannot destroy resource AlicloudResourceCddcDedicatedHost. Terraform will remove this resource from the state file, however resources may remain.") + return nil +} + +func convertCddcDedicatedPaymentTypeRequest(source string) string { + switch source { + case "Subscription": + return "Prepaid" + } + return source +} +func convertCddcAllocationStatusRequest(source string) string { + switch source { + case "Allocatable": + return "1" + case "Suspended": + return "0" + } + return source +} +func convertCddcAllocationStatusResponse(source string) string { + switch source { + case "1": + return "Allocatable" + case "0": + return "Suspended" + } + return source +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cddc_dedicated_host_account.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cddc_dedicated_host_account.go new file mode 100644 index 00000000000..de511193cb7 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cddc_dedicated_host_account.go @@ -0,0 +1,188 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudCddcDedicatedHostAccount() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudCddcDedicatedHostAccountCreate, + Read: resourceAlicloudCddcDedicatedHostAccountRead, + Update: resourceAlicloudCddcDedicatedHostAccountUpdate, + Delete: resourceAlicloudCddcDedicatedHostAccountDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "account_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-z][a-z0-9_]{0,14}[a-z0-9]$`), "The account name must be 2 to 16 characters in length, and can contain lower case letters, digits, and underscore(_)."), + }, + "account_password": { + Type: schema.TypeString, + Required: true, + Sensitive: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[\w!@#$%^&*()_+=]{6,32}$`), "The account password must be 6 to 32 characters in length, and can contain letters, digits, and special characters(!@#$%^&*()_+-=)."), + }, + "account_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Admin", "Normal"}, false), + }, + "dedicated_host_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudCddcDedicatedHostAccountCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateDedicatedHostAccount" + request := make(map[string]interface{}) + conn, err := client.NewCddcClient() + if err != nil { + return WrapError(err) + } + request["AccountName"] = d.Get("account_name") + request["AccountPassword"] = d.Get("account_password") + if v, ok := d.GetOk("account_type"); ok { + request["AccountType"] = v + } + request["DedicatedHostId"] = d.Get("dedicated_host_id") + request["RegionId"] = client.RegionId + request["ClientToken"] = buildClientToken("CreateDedicatedHostAccount") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-03-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_cddc_dedicated_host_account", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["DedicatedHostId"], ":", request["AccountName"])) + + return resourceAlicloudCddcDedicatedHostAccountRead(d, meta) +} +func resourceAlicloudCddcDedicatedHostAccountRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + cddcService := CddcService{client} + _, err := cddcService.DescribeCddcDedicatedHostAccount(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_cddc_dedicated_host_account cddcService.DescribeCddcDedicatedHostAccount Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Set("account_name", parts[1]) + d.Set("dedicated_host_id", parts[0]) + return nil +} +func resourceAlicloudCddcDedicatedHostAccountUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "AccountName": parts[1], + "DedicatedHostId": parts[0], + } + if d.HasChange("account_password") { + request["AccountPassword"] = d.Get("account_password") + } + request["RegionId"] = client.RegionId + action := "ModifyDedicatedHostAccount" + conn, err := client.NewCddcClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-03-20"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return resourceAlicloudCddcDedicatedHostAccountRead(d, meta) +} +func resourceAlicloudCddcDedicatedHostAccountDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + action := "DeleteDedicatedHostAccount" + var response map[string]interface{} + conn, err := client.NewCddcClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "AccountName": parts[1], + "DedicatedHostId": parts[0], + } + + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-03-20"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + // wait for complete async operation + time.Sleep(2 * time.Minute) + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cddc_dedicated_host_group.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cddc_dedicated_host_group.go index d4b7b274b14..17f853b03de 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cddc_dedicated_host_group.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cddc_dedicated_host_group.go @@ -67,6 +67,12 @@ func resourceAlicloudCddcDedicatedHostGroup() *schema.Resource { Required: true, ForceNew: true, }, + "open_permission": { + Type: schema.TypeBool, + Computed: true, + Optional: true, + ForceNew: true, + }, }, } } @@ -89,7 +95,9 @@ func resourceAlicloudCddcDedicatedHostGroupCreate(d *schema.ResourceData, meta i if v, ok := d.GetOk("dedicated_host_group_desc"); ok { request["DedicatedHostGroupDesc"] = v } - + if v, ok := d.GetOk("open_permission"); ok { + request["OpenPermission"] = convertCddcDedicatedHostGroupOpenPermissionRequest(v.(bool)) + } request["Engine"] = d.Get("engine") if v, ok := d.GetOk("disk_allocation_ratio"); ok { if d.Get("engine").(string) == "SQLServer" && v.(int) > 100 { @@ -156,6 +164,7 @@ func resourceAlicloudCddcDedicatedHostGroupRead(d *schema.ResourceData, meta int d.Set("mem_allocation_ratio", formatInt(v)) } d.Set("vpc_id", object["VPCId"]) + d.Set("open_permission", convertCddcDedicatedHostGroupOpenPermissionResponse(formatInt(object["OpenPermission"]))) return nil } func resourceAlicloudCddcDedicatedHostGroupUpdate(d *schema.ResourceData, meta interface{}) error { @@ -274,3 +283,23 @@ func switchEngine(engine string) string { } return engine } + +func convertCddcDedicatedHostGroupOpenPermissionRequest(source interface{}) interface{} { + switch source { + case true: + return 3 + case false: + return 0 + } + return 3 +} + +func convertCddcDedicatedHostGroupOpenPermissionResponse(source interface{}) interface{} { + switch source { + case 0: + return false + case 3: + return true + } + return false +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cdn_real_time_log_delivery.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cdn_real_time_log_delivery.go new file mode 100644 index 00000000000..1a5cf55d64d --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cdn_real_time_log_delivery.go @@ -0,0 +1,140 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudCdnRealTimeLogDelivery() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudCdnRealTimeLogDeliveryCreate, + Read: resourceAlicloudCdnRealTimeLogDeliveryRead, + Delete: resourceAlicloudCdnRealTimeLogDeliveryDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(2 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "domain": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "logstore": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "project": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "sls_region": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudCdnRealTimeLogDeliveryCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateRealTimeLogDelivery" + request := make(map[string]interface{}) + conn, err := client.NewCdnClient() + if err != nil { + return WrapError(err) + } + request["Domain"] = d.Get("domain") + request["Logstore"] = d.Get("logstore") + request["Project"] = d.Get("project") + request["Region"] = d.Get("sls_region") + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("GET"), StringPointer("2018-05-10"), StringPointer("AK"), request, nil, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"InternalError"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_cdn_real_time_log_delivery", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["Domain"])) + + return resourceAlicloudCdnRealTimeLogDeliveryRead(d, meta) +} +func resourceAlicloudCdnRealTimeLogDeliveryRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + cdnService := CdnService{client} + object, err := cdnService.DescribeCdnRealTimeLogDelivery(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_cdn_real_time_log_delivery cdnService.DescribeCdnRealTimeLogDelivery Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + + d.Set("domain", d.Id()) + d.Set("logstore", object["Logstore"]) + d.Set("project", object["Project"]) + d.Set("sls_region", object["Region"]) + d.Set("status", object["Status"]) + return nil +} +func resourceAlicloudCdnRealTimeLogDeliveryDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteRealtimeLogDelivery" + var response map[string]interface{} + conn, err := client.NewCdnClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "Domain": d.Id(), + } + + request["Logstore"] = d.Get("logstore") + request["Project"] = d.Get("project") + request["Region"] = d.Get("sls_region") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("GET"), StringPointer("2018-05-10"), StringPointer("AK"), request, nil, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cen_instance.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cen_instance.go index e0fa58e135a..25ea46529d8 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cen_instance.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cen_instance.go @@ -130,6 +130,10 @@ func resourceAlicloudCenInstanceRead(d *schema.ResourceData, meta interface{}) e func resourceAlicloudCenInstanceUpdate(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) cbnService := CbnService{client} + conn, err := client.NewCbnClient() + if err != nil { + return WrapError(err) + } var response map[string]interface{} d.Partial(true) @@ -146,11 +150,9 @@ func resourceAlicloudCenInstanceUpdate(d *schema.ResourceData, meta interface{}) if !d.IsNewResource() && (d.HasChange("cen_instance_name") || d.HasChange("name")) { update = true if v, ok := d.GetOk("cen_instance_name"); ok { - if _, ok := d.GetOk("cen_instance_name"); ok { - request["Name"] = v - } else { - request["Name"] = v - } + request["Name"] = v + } else if v, ok := d.GetOk("name"); ok { + request["Name"] = v } } if !d.IsNewResource() && d.HasChange("description") { @@ -167,10 +169,6 @@ func resourceAlicloudCenInstanceUpdate(d *schema.ResourceData, meta interface{}) } if update { action := "ModifyCenAttribute" - conn, err := client.NewCbnClient() - if err != nil { - return WrapError(err) - } wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-09-12"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cen_transit_router.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cen_transit_router.go index 1c68a2682af..0aa027e7a37 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cen_transit_router.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cen_transit_router.go @@ -143,6 +143,10 @@ func resourceAlicloudCenTransitRouterRead(d *schema.ResourceData, meta interface func resourceAlicloudCenTransitRouterUpdate(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) cbnService := CbnService{client} + conn, err := client.NewCbnClient() + if err != nil { + return WrapError(err) + } var response map[string]interface{} update := false parts, err1 := ParseResourceId(d.Id(), 2) @@ -166,10 +170,6 @@ func resourceAlicloudCenTransitRouterUpdate(d *schema.ResourceData, meta interfa request["DryRun"] = d.Get("dry_run") } action := "UpdateTransitRouter" - conn, err := client.NewCbnClient() - if err != nil { - return WrapError(err) - } wait := incrementalWait(3*time.Second, 5*time.Second) err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-09-12"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) @@ -226,6 +226,9 @@ func resourceAlicloudCenTransitRouterDelete(d *schema.ResourceData, meta interfa }) addDebug(action, response, request) if err != nil { + if IsExpectedErrors(err, []string{"ParameterInstanceId"}) { + return nil + } return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) } return nil diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cen_transit_router_peer_attachment.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cen_transit_router_peer_attachment.go index 0c4b30efbbf..cfa0247ff01 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cen_transit_router_peer_attachment.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cen_transit_router_peer_attachment.go @@ -215,6 +215,10 @@ func resourceAlicloudCenTransitRouterPeerAttachmentRead(d *schema.ResourceData, func resourceAlicloudCenTransitRouterPeerAttachmentUpdate(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) cbnService := CbnService{client} + conn, err := client.NewCbnClient() + if err != nil { + return WrapError(err) + } var response map[string]interface{} update := false parts, err1 := ParseResourceId(d.Id(), 2) @@ -249,10 +253,6 @@ func resourceAlicloudCenTransitRouterPeerAttachmentUpdate(d *schema.ResourceData request["DryRun"] = d.Get("dry_run") } action := "UpdateTransitRouterPeerAttachmentAttribute" - conn, err := client.NewCbnClient() - if err != nil { - return WrapError(err) - } wait := incrementalWait(3*time.Second, 5*time.Second) err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-09-12"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cen_transit_router_vbr_attachment.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cen_transit_router_vbr_attachment.go index dc2a82faf48..688e8490f14 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cen_transit_router_vbr_attachment.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cen_transit_router_vbr_attachment.go @@ -190,6 +190,7 @@ func resourceAlicloudCenTransitRouterVbrAttachmentRead(d *schema.ResourceData, m d.Set("transit_router_attachment_id", object["TransitRouterAttachmentId"]) d.Set("transit_router_attachment_description", object["TransitRouterAttachmentDescription"]) d.Set("transit_router_attachment_name", object["TransitRouterAttachmentName"]) + d.Set("transit_router_id", object["TransitRouterId"]) d.Set("vbr_id", object["VbrId"]) d.Set("vbr_owner_id", object["VbrOwnerId"]) return nil diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_click_house_account.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_click_house_account.go new file mode 100644 index 00000000000..893bb10e007 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_click_house_account.go @@ -0,0 +1,239 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudClickHouseAccount() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudClickHouseAccountCreate, + Read: resourceAlicloudClickHouseAccountRead, + Update: resourceAlicloudClickHouseAccountUpdate, + Delete: resourceAlicloudClickHouseAccountDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "account_description": { + Type: schema.TypeString, + Optional: true, + }, + "account_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-z][a-z0-9_]{1,15}`), "The account_name most consist of lowercase letters, numbers, and underscores, starting with a lowercase letter"), + }, + "account_password": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`[a-zA-Z!#$%^&*()_+-=]{8,32}`), "account_password must consist of uppercase letters, lowercase letters, numbers, and special characters"), + }, + "db_cluster_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "type": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudClickHouseAccountCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateAccount" + request := make(map[string]interface{}) + conn, err := client.NewClickhouseClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("account_description"); ok { + request["AccountDescription"] = v + } + request["AccountName"] = d.Get("account_name") + request["AccountPassword"] = d.Get("account_password") + request["DBClusterId"] = d.Get("db_cluster_id") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-11"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"IncorrectAccountStatus", "IncorrectDBInstanceState"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_click_house_account", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["DBClusterId"], ":", request["AccountName"])) + + return resourceAlicloudClickHouseAccountRead(d, meta) +} +func resourceAlicloudClickHouseAccountRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + clickhouseService := ClickhouseService{client} + object, err := clickhouseService.DescribeClickHouseAccount(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_click_house_account clickhouseService.DescribeClickHouseAccount Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Set("account_name", parts[1]) + d.Set("db_cluster_id", parts[0]) + d.Set("account_description", object["AccountDescription"]) + d.Set("status", object["AccountStatus"]) + d.Set("type", object["AccountType"]) + return nil +} +func resourceAlicloudClickHouseAccountUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + update := false + d.Partial(true) + request := map[string]interface{}{ + "AccountName": parts[1], + "DBClusterId": parts[0], + } + if d.HasChange("account_description") { + update = true + if v, ok := d.GetOk("account_description"); ok { + request["AccountDescription"] = v + } + } + if update { + action := "ModifyAccountDescription" + conn, err := client.NewClickhouseClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-11"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"IncorrectAccountStatus", "IncorrectDBInstanceState"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("account_description") + } + update = false + if d.HasChange("account_password") { + update = true + request = map[string]interface{}{ + "AccountName": parts[1], + "DBClusterId": parts[0], + } + request["AccountPassword"] = d.Get("account_password") + } + if update { + action := "ResetAccountPassword" + conn, err := client.NewClickhouseClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-11"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"IncorrectAccountStatus", "IncorrectDBInstanceState"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("account_password") + } + d.Partial(false) + return resourceAlicloudClickHouseAccountRead(d, meta) +} +func resourceAlicloudClickHouseAccountDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + clickhouseService := ClickhouseService{client} + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + action := "DeleteAccount" + var response map[string]interface{} + conn, err := client.NewClickhouseClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "AccountName": parts[1], + "DBClusterId": parts[0], + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-11"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"IncorrectAccountStatus", "IncorrectDBInstanceState"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{"Deleting"}, []string{}, d.Timeout(schema.TimeoutDelete), 5*time.Second, clickhouseService.ClickhouseStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + if NotFoundError(err) { + return nil + } + return WrapErrorf(err, IdMsg, d.Id()) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_click_house_backup_policy.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_click_house_backup_policy.go new file mode 100644 index 00000000000..942613d0b1a --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_click_house_backup_policy.go @@ -0,0 +1,174 @@ +package alicloud + +import ( + "fmt" + "log" + "strings" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudClickHouseBackupPolicy() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudClickHouseBackupPolicyCreate, + Read: resourceAlicloudClickHouseBackupPolicyRead, + Update: resourceAlicloudClickHouseBackupPolicyUpdate, + Delete: resourceAlicloudClickHouseBackupPolicyDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(1 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "backup_retention_period": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validation.IntBetween(7, 730), + }, + "db_cluster_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "preferred_backup_period": { + Type: schema.TypeSet, + Elem: &schema.Schema{Type: schema.TypeString}, + Required: true, + }, + "preferred_backup_time": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice(BACKUP_TIME, false), + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudClickHouseBackupPolicyCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateBackupPolicy" + request := make(map[string]interface{}) + conn, err := client.NewClickhouseClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("backup_retention_period"); ok { + request["BackupRetentionPeriod"] = v + } + request["DBClusterId"] = d.Get("db_cluster_id") + if v, ok := d.Get("preferred_backup_period").(*schema.Set); ok { + periodList := expandStringList(v.List()) + request["PreferredBackupPeriod"] = strings.Join(periodList[:], COMMA_SEPARATED) + } + request["PreferredBackupTime"] = d.Get("preferred_backup_time") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-11"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_click_house_backup_policy", action, AlibabaCloudSdkGoERROR) + } + d.SetId(fmt.Sprint(request["DBClusterId"])) + clickhouseService := ClickhouseService{client} + stateConf := BuildStateConf([]string{}, []string{"true"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, clickhouseService.ClickHouseBackupPolicyStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudClickHouseBackupPolicyRead(d, meta) +} +func resourceAlicloudClickHouseBackupPolicyRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + clickhouseService := ClickhouseService{client} + object, err := clickhouseService.DescribeClickHouseBackupPolicy(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_click_house_backup_policy clickhouseService.DescribeClickHouseBackupPolicy Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + + d.Set("db_cluster_id", d.Id()) + if v, ok := object["BackupRetentionPeriod"]; ok && fmt.Sprint(v) != "0" { + d.Set("backup_retention_period", formatInt(v)) + } + d.Set("preferred_backup_period", strings.Split(object["PreferredBackupPeriod"].(string), ",")) + d.Set("preferred_backup_time", object["PreferredBackupTime"]) + d.Set("status", fmt.Sprint(object["Switch"])) + return nil +} +func resourceAlicloudClickHouseBackupPolicyUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "DBClusterId": d.Id(), + } + if d.HasChange("preferred_backup_period") { + update = true + } + if v, ok := d.Get("preferred_backup_period").(*schema.Set); ok { + periodList := expandStringList(v.List()) + request["PreferredBackupPeriod"] = strings.Join(periodList[:], COMMA_SEPARATED) + } + if d.HasChange("preferred_backup_time") { + update = true + } + request["PreferredBackupTime"] = d.Get("preferred_backup_time") + if d.HasChange("backup_retention_period") { + update = true + if v, ok := d.GetOk("backup_retention_period"); ok { + request["BackupRetentionPeriod"] = v + } + } + if update { + action := "ModifyBackupPolicy" + conn, err := client.NewClickhouseClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-11"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudClickHouseBackupPolicyRead(d, meta) +} +func resourceAlicloudClickHouseBackupPolicyDelete(d *schema.ResourceData, meta interface{}) error { + log.Printf("[WARN] Cannot destroy resourceAlicloudClickHouseBackupPolicy. Terraform will remove this resource from the state file, however resources may remain.") + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_click_house_db_cluster.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_click_house_db_cluster.go new file mode 100644 index 00000000000..6cc9fea3a87 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_click_house_db_cluster.go @@ -0,0 +1,530 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudClickHouseDbCluster() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudClickHouseDbClusterCreate, + Read: resourceAlicloudClickHouseDbClusterRead, + Update: resourceAlicloudClickHouseDbClusterUpdate, + Delete: resourceAlicloudClickHouseDbClusterDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(60 * time.Minute), + Update: schema.DefaultTimeout(60 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "category": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"Basic", "HighAvailability"}, false), + ForceNew: true, + }, + "db_cluster_access_white_list": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "db_cluster_ip_array_attribute": { + Type: schema.TypeString, + Optional: true, + }, + "db_cluster_ip_array_name": { + Type: schema.TypeString, + Optional: true, + }, + "security_ip_list": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "db_cluster_class": { + Type: schema.TypeString, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"S4-NEW", "S8", "S16", "S32", "S64", "S104", "C4-NEW", "C8", "C16", "C32", "C64", "C104"}, false), + Required: true, + }, + "db_cluster_network_type": { + Type: schema.TypeString, + ValidateFunc: validation.StringInSlice([]string{"vpc"}, false), + Required: true, + ForceNew: true, + }, + "db_cluster_version": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"19.15.2.2", "20.3.10.75", "20.8.7.15"}, false), + }, + "db_node_storage": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "db_node_group_count": { + Type: schema.TypeInt, + ValidateFunc: validation.IntBetween(1, 48), + Required: true, + ForceNew: true, + }, + + "encryption_key": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "encryption_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "payment_type": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"PayAsYouGo", "Subscription"}, false), + ForceNew: true, + }, + "period": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Month", "Year"}, false), + }, + "storage_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"cloud_essd", "cloud_efficiency", "cloud_essd_pl2", "cloud_essd_pl3"}, false), + }, + "used_time": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "vswitch_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + + "db_cluster_description": { + Type: schema.TypeString, + Computed: true, + Optional: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"Creating", "Deleting", "Restarting", "Preparing", "Running"}, false), + }, + "maintain_time": { + Type: schema.TypeString, + Computed: true, + Optional: true, + }, + }, + } +} + +func resourceAlicloudClickHouseDbClusterCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + clickhouseService := ClickhouseService{client} + var response map[string]interface{} + action := "CreateDBInstance" + request := make(map[string]interface{}) + conn, err := client.NewClickhouseClient() + if err != nil { + return WrapError(err) + } + request["DBClusterCategory"] = d.Get("category") + request["DBClusterClass"] = d.Get("db_cluster_class") + if v, ok := d.GetOk("db_cluster_description"); ok { + request["DBClusterDescription"] = v + } + request["DBClusterNetworkType"] = d.Get("db_cluster_network_type") + request["DBClusterVersion"] = d.Get("db_cluster_version") + request["DBNodeGroupCount"] = d.Get("db_node_group_count") + request["DBNodeStorage"] = d.Get("db_node_storage") + if v, ok := d.GetOk("encryption_key"); ok { + request["EncryptionKey"] = v + } + if v, ok := d.GetOk("encryption_type"); ok { + request["EncryptionType"] = v + } + request["PayType"] = convertClickHouseDbClusterPaymentTypeRequest(d.Get("payment_type").(string)) + + if v, ok := d.GetOk("period"); ok { + request["Period"] = v + } + request["RegionId"] = client.RegionId + request["DbNodeStorageType"] = d.Get("storage_type") + if v, ok := d.GetOk("used_time"); ok { + request["UsedTime"] = v + } + vswitchId := Trim(d.Get("vswitch_id").(string)) + if vswitchId != "" { + vpcService := VpcService{client} + vsw, err := vpcService.DescribeVSwitchWithTeadsl(vswitchId) + if err != nil { + return WrapError(err) + } + request["VPCId"] = vsw["VpcId"] + request["VSwitchId"] = vswitchId + if v, ok := request["ZoneId"].(string); !ok || v == "" { + request["ZoneId"] = vsw["ZoneId"] + } + } + request["ClientToken"] = buildClientToken("CreateDBInstance") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-11"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_click_house_db_cluster", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["DBClusterId"])) + stateConf := BuildStateConf([]string{"Creating", "Deleting", "Restarting", "Preparing"}, []string{"Running"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, clickhouseService.ClickHouseDbClusterStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return resourceAlicloudClickHouseDbClusterUpdate(d, meta) +} +func resourceAlicloudClickHouseDbClusterRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + clickhouseService := ClickhouseService{client} + object, err := clickhouseService.DescribeClickHouseDbCluster(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_click_house_db_cluster clickhouseService.DescribeClickHouseDbCluster Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("category", object["Category"]) + d.Set("db_cluster_description", object["DBClusterDescription"]) + d.Set("db_cluster_network_type", object["DBClusterNetworkType"]) + d.Set("db_node_storage", fmt.Sprint(formatInt(object["DBNodeStorage"]))) + d.Set("encryption_key", object["EncryptionKey"]) + d.Set("encryption_type", object["EncryptionType"]) + d.Set("maintain_time", object["MaintainTime"]) + d.Set("status", object["DBClusterStatus"]) + d.Set("payment_type", convertClickHouseDbClusterPaymentTypeResponse(object["PayType"].(string))) + d.Set("storage_type", convertClickHouseDbClusterStorageTypeResponse(object["StorageType"].(string))) + d.Set("vswitch_id", object["VSwitchId"]) + d.Set("zone_id", object["ZoneId"]) + describeDBClusterAccessWhiteListObject, err := clickhouseService.DescribeDBClusterAccessWhiteList(d.Id()) + if err != nil { + return WrapError(err) + } + if dBClusterAccessWhiteListMap, ok := describeDBClusterAccessWhiteListObject["DBClusterAccessWhiteList"].(map[string]interface{}); ok && dBClusterAccessWhiteListMap != nil { + if iPArrayList, ok := dBClusterAccessWhiteListMap["IPArray"]; ok && iPArrayList != nil { + dBClusterAccessWhiteListMaps := make([]map[string]interface{}, 0) + for _, iPArrayListItem := range iPArrayList.([]interface{}) { + if v, ok := iPArrayListItem.(map[string]interface{}); ok { + if v["DBClusterIPArrayName"].(string) == "default" { + continue + } + iPArrayListItemMap := make(map[string]interface{}) + iPArrayListItemMap["db_cluster_ip_array_attribute"] = v["DBClusterIPArrayAttribute"] + iPArrayListItemMap["db_cluster_ip_array_name"] = v["DBClusterIPArrayName"] + iPArrayListItemMap["security_ip_list"] = v["SecurityIPList"] + dBClusterAccessWhiteListMaps = append(dBClusterAccessWhiteListMaps, iPArrayListItemMap) + } + } + d.Set("db_cluster_access_white_list", dBClusterAccessWhiteListMaps) + } + } + + return nil +} +func resourceAlicloudClickHouseDbClusterUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + d.Partial(true) + + update := false + request := map[string]interface{}{ + "DBClusterId": d.Id(), + } + if !d.IsNewResource() && d.HasChange("db_cluster_description") { + update = true + if v, ok := d.GetOk("db_cluster_description"); ok { + request["DBClusterDescription"] = v + } + } + if update { + action := "ModifyDBClusterDescription" + conn, err := client.NewClickhouseClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-11"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"IncorrectDBInstanceState"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("db_cluster_description") + } + update = false + modifyDBClusterMaintainTimeReq := map[string]interface{}{ + "DBClusterId": d.Id(), + } + if !d.IsNewResource() && d.HasChange("maintain_time") { + update = true + } + if v, ok := d.GetOk("maintain_time"); ok { + modifyDBClusterMaintainTimeReq["MaintainTime"] = v + } + if update { + action := "ModifyDBClusterMaintainTime" + conn, err := client.NewClickhouseClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-11"), StringPointer("AK"), nil, modifyDBClusterMaintainTimeReq, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"IncorrectDBInstanceState"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, modifyDBClusterMaintainTimeReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("maintain_time") + } + if d.HasChange("db_cluster_access_white_list") { + + oraw, nraw := d.GetChange("db_cluster_access_white_list") + remove := oraw.(*schema.Set).Difference(nraw.(*schema.Set)).List() + create := nraw.(*schema.Set).Difference(oraw.(*schema.Set)).List() + if len(remove) > 0 { + removeWhiteListReq := map[string]interface{}{ + "DBClusterId": d.Id(), + "ModifyMode": "Delete", + } + + for _, whiteList := range remove { + whiteListArg := whiteList.(map[string]interface{}) + removeWhiteListReq["DBClusterIPArrayAttribute"] = whiteListArg["db_cluster_ip_array_attribute"] + removeWhiteListReq["DBClusterIPArrayName"] = whiteListArg["db_cluster_ip_array_name"] + removeWhiteListReq["SecurityIps"] = whiteListArg["security_ip_list"] + + action := "ModifyDBClusterAccessWhiteList" + conn, err := client.NewClickhouseClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-11"), StringPointer("AK"), nil, removeWhiteListReq, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"IncorrectDBInstanceState"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, removeWhiteListReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + } + if len(create) > 0 { + createWhiteListReq := map[string]interface{}{ + "DBClusterId": d.Id(), + "ModifyMode": "Append", + } + + for _, whiteList := range create { + whiteListArg := whiteList.(map[string]interface{}) + createWhiteListReq["DBClusterIPArrayAttribute"] = whiteListArg["db_cluster_ip_array_attribute"] + createWhiteListReq["DBClusterIPArrayName"] = whiteListArg["db_cluster_ip_array_name"] + createWhiteListReq["SecurityIps"] = whiteListArg["security_ip_list"] + + action := "ModifyDBClusterAccessWhiteList" + conn, err := client.NewClickhouseClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-11"), StringPointer("AK"), nil, createWhiteListReq, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"IncorrectDBInstanceState"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, createWhiteListReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + } + d.SetPartial("db_cluster_access_white_list") + } + if d.HasChange("status") { + clickhouseService := ClickhouseService{client} + object, err := clickhouseService.DescribeClickHouseDbCluster(d.Id()) + if err != nil { + return WrapError(err) + } + target := d.Get("status").(string) + if object["DBClusterStatus"].(string) != target { + if target == "Running" { + request := map[string]interface{}{ + "DBClusterId": d.Id(), + } + request["RegionId"] = client.RegionId + action := "RestartInstance" + conn, err := client.NewClickhouseClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-11"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"IncorrectDBInstanceState"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + d.SetPartial("status") + } + stateConf := BuildStateConf([]string{"RESTARTING"}, []string{"Running"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, clickhouseService.ClickHouseDbClusterStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + d.Partial(false) + return resourceAlicloudClickHouseDbClusterRead(d, meta) +} +func resourceAlicloudClickHouseDbClusterDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteDBCluster" + var response map[string]interface{} + conn, err := client.NewClickhouseClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "DBClusterId": d.Id(), + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-11"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"IncorrectDBInstanceState"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} + +func convertClickHouseDbClusterPaymentTypeRequest(source string) string { + switch source { + case "PayAsYouGo": + return "Postpaid" + case "Subscription": + return "Prepay" + } + return source +} +func convertClickHouseDbClusterPaymentTypeResponse(source string) string { + switch source { + case "Postpaid": + return "PayAsYouGo" + case "Prepay": + return "Subscription" + } + return source +} + +func convertClickHouseDbClusterStorageTypeResponse(source string) string { + switch source { + case "CloudESSD": + return "cloud_essd" + case "CloudEfficiency": + return "cloud_efficiency" + case "CloudESSD_PL2": + return "cloud_essd_pl2" + case "CloudESSD_PL3": + return "cloud_essd_pl3" + + } + return source +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_firewall_control_policy.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_firewall_control_policy.go index 6ae8062c653..27bcfcbdb33 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_firewall_control_policy.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_firewall_control_policy.go @@ -30,7 +30,6 @@ func resourceAlicloudCloudFirewallControlPolicy() *schema.Resource { "acl_uuid": { Type: schema.TypeString, Computed: true, - ForceNew: true, }, "application_name": { Type: schema.TypeString, diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_firewall_instance.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_firewall_instance.go new file mode 100644 index 00000000000..be02a107b65 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_firewall_instance.go @@ -0,0 +1,459 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudCloudFirewallInstance() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudCloudFirewallInstanceCreate, + Read: resourceAlicloudCloudFirewallInstanceRead, + Update: resourceAlicloudCloudFirewallInstanceUpdate, + Delete: resourceAlicloudCloudFirewallInstanceDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "payment_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Subscription"}, false), + }, + "period": { + Type: schema.TypeInt, + Required: true, + ValidateFunc: validation.IntInSlice([]int{6, 12, 24, 36}), + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("payment_type"); ok && v.(string) == "Subscription" { + return false + } + return true + }, + }, + "renew_period": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validation.IntBetween(1, 12), + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("payment_type"); ok && v.(string) == "Subscription" { + if v, ok := d.GetOk("renewal_status"); ok && v.(string) == "AutoRenewal" { + return false + } + } + return true + }, + }, + "renewal_status": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"AutoRenewal", "ManualRenewal"}, false), + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("payment_type"); ok && v.(string) == "Subscription" { + return false + } + return true + }, + }, + "logistics": { + Type: schema.TypeString, + Optional: true, + }, + "cfw_service": { + Type: schema.TypeBool, + Required: true, + }, + "fw_vpc_number": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validation.IntBetween(2, 500), + }, + "ip_number": { + Type: schema.TypeInt, + Required: true, + ValidateFunc: validation.IntBetween(20, 4000), + }, + "cfw_log_storage": { + Type: schema.TypeInt, + Required: true, + ValidateFunc: validation.IntBetween(1000, 500000), + }, + "cfw_log": { + Type: schema.TypeBool, + Required: true, + }, + "band_width": { + Type: schema.TypeInt, + Required: true, + ValidateFunc: validation.IntBetween(10, 15000), + }, + "instance_count": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validation.IntBetween(5, 5000), + }, + "spec": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"premium_version", "enterprise_version", "ultimate_version"}, false), + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + }, + "renewal_duration_unit": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "end_time": { + Type: schema.TypeString, + Computed: true, + }, + "release_time": { + Type: schema.TypeString, + Computed: true, + }, + "modify_type": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"Downgrade", "Upgrade"}, false), + }, + }, + } +} +func resourceAlicloudCloudFirewallInstanceCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateInstance" + request := make(map[string]interface{}) + conn, err := client.NewBssopenapiClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken(action) + request["ProductCode"] = "vipcloudfw" + + request["ProductType"] = "vipcloudfw" + request["SubscriptionType"] = d.Get("payment_type") + + if v, ok := d.GetOk("period"); ok { + request["Period"] = v + } else if d.Get("payment_type").(string) == "Subscription" { + return WrapError(fmt.Errorf("attribute '%s' is required when '%s' is %v", "period", "payment_type", "Subscription")) + } + + if v, ok := d.GetOk("renewal_status"); ok { + request["RenewalStatus"] = v + } + + if v, ok := d.GetOk("renewal_duration"); ok { + request["RenewPeriod"] = v + } else if v, ok := d.GetOk("renewal_status"); ok && v.(string) == "AutoRenewal" { + return WrapError(fmt.Errorf("attribute '%s' is required when '%s' is %v ", "renewal_duration", "renewal_status", d.Get("renewal_status"))) + } + if v, ok := d.GetOk("logistics"); ok { + request["Logistics"] = v + } + + parameterMapList := make([]map[string]interface{}, 0) + parameterMapList = append(parameterMapList, map[string]interface{}{ + "Code": "Spec", + "Value": convertCloudFirewallInstanceVersion(d.Get("spec").(string)), + }) + parameterMapList = append(parameterMapList, map[string]interface{}{ + "Code": "IpNumber", + "Value": d.Get("ip_number"), + }) + parameterMapList = append(parameterMapList, map[string]interface{}{ + "Code": "BandWidth", + "Value": d.Get("band_width"), + }) + parameterMapList = append(parameterMapList, map[string]interface{}{ + "Code": "CfwLog", + "Value": d.Get("cfw_log"), + }) + parameterMapList = append(parameterMapList, map[string]interface{}{ + "Code": "CfwLogStorage", + "Value": d.Get("cfw_log_storage"), + }) + parameterMapList = append(parameterMapList, map[string]interface{}{ + "Code": "CfwService", + "Value": d.Get("cfw_service"), + }) + if v, ok := d.GetOk("fw_vpc_number"); ok { + parameterMapList = append(parameterMapList, map[string]interface{}{ + "Code": "FwVpcNumber", + "Value": v, + }) + } + if v, ok := d.GetOk("instance_count"); ok { + parameterMapList = append(parameterMapList, map[string]interface{}{ + "Code": "InstanceCount", + "Value": v, + }) + } + request["Parameter"] = parameterMapList + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-12-14"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + if IsExpectedErrors(err, []string{"NotApplicable"}) { + conn.Endpoint = String(connectivity.BssOpenAPIEndpointInternational) + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_cloud_firewall_instance", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Code"]) != "Success" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + responseData := response["Data"].(map[string]interface{}) + d.SetId(fmt.Sprint(responseData["InstanceId"])) + return resourceAlicloudCloudFirewallInstanceRead(d, meta) +} +func resourceAlicloudCloudFirewallInstanceRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + bssOpenApiService := BssOpenApiService{client} + getQueryInstanceObject, err := bssOpenApiService.QueryAvailableInstance(d.Id()) + if err != nil { + return WrapError(err) + } + d.Set("create_time", getQueryInstanceObject["CreateTime"]) + d.Set("renewal_status", getQueryInstanceObject["RenewStatus"]) + d.Set("renewal_duration_unit", convertCloudFirewallInstanceRenewalDurationUnitResponse(getQueryInstanceObject["RenewalDurationUnit"])) + d.Set("status", getQueryInstanceObject["Status"]) + d.Set("subscription_type", getQueryInstanceObject["SubscriptionType"]) + d.Set("end_time", getQueryInstanceObject["EndTime"]) + return nil +} +func resourceAlicloudCloudFirewallInstanceUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + conn, err := client.NewBssopenapiClient() + if err != nil { + return WrapError(err) + } + var response map[string]interface{} + d.Partial(true) + update := false + renewInstancerequest := map[string]interface{}{ + "InstanceId": d.Id(), + } + + if d.HasChange("renew_period") && !d.IsNewResource() { + update = true + renewInstancerequest["RenewPeriod"] = d.Get("renew_period") + } + if update { + action := "RenewInstance" + renewInstancerequest["ClientToken"] = buildClientToken(action) + renewInstancerequest["ProductCode"] = "vipcloudfw" + renewInstancerequest["ProductType"] = "vipcloudfw" + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-12-14"), StringPointer("AK"), nil, renewInstancerequest, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + if IsExpectedErrors(err, []string{"NotApplicable"}) { + conn.Endpoint = String(connectivity.BssOpenAPIEndpointInternational) + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, renewInstancerequest) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Code"]) != "Success" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + } + + update = false + modifyInstanceRequest := map[string]interface{}{ + "InstanceId": d.Id(), + } + modifyInstanceRequest["ProductType"] = "vipcloudfw" + modifyInstanceRequest["ProductCode"] = "vipcloudfw" + modifyInstanceRequest["SubscriptionType"] = d.Get("payment_type") + parameterMapList := make([]map[string]interface{}, 0) + if d.HasChange("cfw_service") { + update = true + } + if v, ok := d.GetOk("cfw_service"); ok { + parameterMapList = append(parameterMapList, map[string]interface{}{ + "Code": "CfwService", + "Value": v, + }) + } + + if d.HasChange("fw_vpc_number") { + update = true + } + if v, ok := d.GetOk("fw_vpc_number"); ok { + parameterMapList = append(parameterMapList, map[string]interface{}{ + "Code": "FwVpcNumber", + "Value": v, + }) + } + if d.HasChange("ip_number") { + update = true + } + if v, ok := d.GetOk("ip_number"); ok { + parameterMapList = append(parameterMapList, map[string]interface{}{ + "Code": "IpNumber", + "Value": v, + }) + } + if d.HasChange("cfw_log_storage") { + update = true + } + if v, ok := d.GetOk("cfw_log_storage"); ok { + parameterMapList = append(parameterMapList, map[string]interface{}{ + "Code": "CfwLogStorage", + "Value": v, + }) + } + if d.HasChange("cfw_log") { + update = true + } + if v, ok := d.GetOk("cfw_log"); ok { + parameterMapList = append(parameterMapList, map[string]interface{}{ + "Code": "CfwLog", + "Value": v, + }) + } + if d.HasChange("band_width") { + update = true + } + if v, ok := d.GetOk("band_width"); ok { + parameterMapList = append(parameterMapList, map[string]interface{}{ + "Code": "BandWidth", + "Value": v, + }) + } + if d.HasChange("spec") { + update = true + } + if v, ok := d.GetOk("spec"); ok { + parameterMapList = append(parameterMapList, map[string]interface{}{ + "Code": "Spec", + "Value": convertCloudFirewallInstanceVersion(v.(string)), + }) + } + if d.HasChange("instance_count") { + update = true + } + if v, ok := d.GetOk("instance_count"); ok { + parameterMapList = append(parameterMapList, map[string]interface{}{ + "Code": "InstanceCount", + "Value": v, + }) + } + modifyInstanceRequest["Parameter"] = parameterMapList + if update { + if v, ok := d.GetOk("modify_type"); ok { + modifyInstanceRequest["ModifyType"] = v + } + action := "ModifyInstance" + modifyInstanceRequest["ClientToken"] = buildClientToken(action) + conn, err := client.NewBssopenapiClient() + if err != nil { + return WrapError(err) + } + modifyInstanceRequest["ClientToken"] = buildClientToken(action) + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-12-14"), StringPointer("AK"), nil, modifyInstanceRequest, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + if IsExpectedErrors(err, []string{"NotApplicable"}) { + conn.Endpoint = String(connectivity.BssOpenAPIEndpointInternational) + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, modifyInstanceRequest) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Code"]) != "Success" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + d.SetPartial("payment_type") + d.SetPartial("cfw_service") + d.SetPartial("fw_vpc_number") + d.SetPartial("ip_number") + d.SetPartial("cfw_log_storage") + d.SetPartial("cfw_log") + d.SetPartial("band_width") + d.SetPartial("spec") + d.SetPartial("instance_count") + } + d.Partial(false) + return resourceAlicloudCloudFirewallInstanceRead(d, meta) +} +func resourceAlicloudCloudFirewallInstanceDelete(d *schema.ResourceData, meta interface{}) error { + log.Printf("[WARN] Cannot destroy resourceAlicloudCloudFirewallInstance. Terraform will remove this resource from the state file, however resources may remain.") + return nil +} + +func convertCloudFirewallInstanceVersion(source string) interface{} { + switch source { + case "premium_version": + return 2 + case "enterprise_version": + return 3 + case "ultimate_version": + return 4 + } + return source +} + +func convertCloudFirewallInstanceRenewalDurationUnitResponse(source interface{}) interface{} { + switch source { + case "M": + return "Month" + case "Y": + return "Year" + } + return source +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_sso_access_assignment.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_sso_access_assignment.go new file mode 100644 index 00000000000..f1735977102 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_sso_access_assignment.go @@ -0,0 +1,204 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + "github.com/PaesslerAG/jsonpath" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudCloudSsoAccessAssignment() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudCloudSsoAccessAssignmentCreate, + Read: resourceAlicloudCloudSsoAccessAssignmentRead, + Update: resourceAlicloudCloudSsoAccessAssignmentUpdate, + Delete: resourceAlicloudCloudSsoAccessAssignmentDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(5 * time.Minute), + Delete: schema.DefaultTimeout(5 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "access_configuration_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "deprovision_strategy": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"DeprovisionForLastAccessAssignmentOnAccount", "None"}, false), + }, + "directory_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "principal_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "principal_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Group", "User"}, false), + }, + "target_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "target_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"RD-Account"}, false), + }, + }, + } +} + +func resourceAlicloudCloudSsoAccessAssignmentCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateAccessAssignment" + request := make(map[string]interface{}) + conn, err := client.NewCloudssoClient() + if err != nil { + return WrapError(err) + } + + request["AccessConfigurationId"] = d.Get("access_configuration_id") + request["DirectoryId"] = d.Get("directory_id") + request["PrincipalId"] = d.Get("principal_id") + request["PrincipalType"] = d.Get("principal_type") + request["TargetId"] = d.Get("target_id") + request["TargetType"] = d.Get("target_type") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"OperationConflict.Task"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_cloud_sso_access_assignment", action, AlibabaCloudSdkGoERROR) + } + d.SetId(fmt.Sprint(request["DirectoryId"], ":", request["AccessConfigurationId"], ":", request["TargetType"], ":", request["TargetId"], ":", request["PrincipalType"], ":", request["PrincipalId"])) + + v, err := jsonpath.Get("$.Task", response) + if err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + response = v.(map[string]interface{}) + cloudssoService := CloudssoService{client} + stateConf := BuildStateConf([]string{}, []string{"Success"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, cloudssoService.CloudssoServiceAccessAssignmentStateRefreshFunc(fmt.Sprint(request["DirectoryId"]), fmt.Sprint(response["TaskId"]), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudCloudSsoAccessAssignmentRead(d, meta) +} +func resourceAlicloudCloudSsoAccessAssignmentRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + cloudssoService := CloudssoService{client} + _, err := cloudssoService.DescribeCloudSsoAccessAssignment(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_cloud_sso_access_assignment cloudssoService.DescribeCloudSsoAccessAssignment Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + + parts, err := ParseResourceId(d.Id(), 6) + if err != nil { + return WrapError(err) + } + d.Set("directory_id", parts[0]) + d.Set("access_configuration_id", parts[1]) + d.Set("target_type", parts[2]) + d.Set("target_id", parts[3]) + d.Set("principal_type", parts[4]) + d.Set("principal_id", parts[5]) + + return nil +} +func resourceAlicloudCloudSsoAccessAssignmentUpdate(d *schema.ResourceData, meta interface{}) error { + log.Println(fmt.Sprintf("[WARNING] The resouce has not update operation.")) + return resourceAlicloudCloudSsoAccessAssignmentRead(d, meta) +} +func resourceAlicloudCloudSsoAccessAssignmentDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 6) + if err != nil { + return WrapError(err) + } + action := "DeleteAccessAssignment" + var response map[string]interface{} + conn, err := client.NewCloudssoClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "DirectoryId": parts[0], + "AccessConfigurationId": parts[1], + "TargetType": parts[2], + "TargetId": parts[3], + "PrincipalType": parts[4], + "PrincipalId": parts[5], + } + + if v, ok := d.GetOk("deprovision_strategy"); ok { + request["DeprovisionStrategy"] = v + } else { + request["DeprovisionStrategy"] = "DeprovisionForLastAccessAssignmentOnAccount" + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"OperationConflict.Task", "DeletionConflict.AccessConfigurationProvisioning.AccessAssignment"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + + v, err := jsonpath.Get("$.Task", response) + if err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + response = v.(map[string]interface{}) + cloudssoService := CloudssoService{client} + stateConf := BuildStateConf([]string{}, []string{"Success"}, d.Timeout(schema.TimeoutDelete), 5*time.Second, cloudssoService.CloudssoServiceAccessAssignmentStateRefreshFunc(fmt.Sprint(request["DirectoryId"]), fmt.Sprint(response["TaskId"]), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_sso_access_configuration.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_sso_access_configuration.go new file mode 100644 index 00000000000..e27bb74e01f --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_sso_access_configuration.go @@ -0,0 +1,410 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudCloudSsoAccessConfiguration() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudCloudSsoAccessConfigurationCreate, + Read: resourceAlicloudCloudSsoAccessConfigurationRead, + Update: resourceAlicloudCloudSsoAccessConfigurationUpdate, + Delete: resourceAlicloudCloudSsoAccessConfigurationDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(5 * time.Minute), + Update: schema.DefaultTimeout(5 * time.Minute), + Delete: schema.DefaultTimeout(5 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "access_configuration_id": { + Type: schema.TypeString, + Computed: true, + }, + "access_configuration_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-zA-z0-9-]{1,32}$`), "The name of the resource. The name can be up to `32` characters long and can contain letters, digits, and hyphens (-)"), + }, + "description": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(0, 1024), + }, + "directory_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "force_remove_permission_policies": { + Type: schema.TypeBool, + Optional: true, + }, + "permission_policies": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "permission_policy_document": { + Type: schema.TypeString, + Optional: true, + Sensitive: true, + }, + "permission_policy_name": { + Type: schema.TypeString, + Required: true, + }, + "permission_policy_type": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"System", "Inline"}, false), + }, + }, + }, + }, + "relay_state": { + Type: schema.TypeString, + Optional: true, + }, + "session_duration": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + ValidateFunc: validation.IntBetween(900, 43200), + }, + }, + } +} + +func resourceAlicloudCloudSsoAccessConfigurationCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateAccessConfiguration" + request := make(map[string]interface{}) + conn, err := client.NewCloudssoClient() + if err != nil { + return WrapError(err) + } + + request["AccessConfigurationName"] = d.Get("access_configuration_name") + + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + request["DirectoryId"] = d.Get("directory_id") + + if v, ok := d.GetOk("relay_state"); ok { + request["RelayState"] = v + } + if v, ok := d.GetOk("session_duration"); ok { + request["SessionDuration"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_cloud_sso_access_configuration", action, AlibabaCloudSdkGoERROR) + } + responseAccessConfiguration := response["AccessConfiguration"].(map[string]interface{}) + d.SetId(fmt.Sprint(request["DirectoryId"], ":", responseAccessConfiguration["AccessConfigurationId"])) + + return resourceAlicloudCloudSsoAccessConfigurationUpdate(d, meta) +} +func resourceAlicloudCloudSsoAccessConfigurationRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + cloudssoService := CloudssoService{client} + object, err := cloudssoService.DescribeCloudSsoAccessConfiguration(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_cloud_sso_access_configuration cloudssoService.DescribeCloudSsoAccessConfiguration Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Set("access_configuration_id", parts[1]) + d.Set("directory_id", parts[0]) + d.Set("access_configuration_name", object["AccessConfigurationName"]) + d.Set("description", object["Description"]) + d.Set("relay_state", object["RelayState"]) + if v, ok := object["SessionDuration"]; ok && fmt.Sprint(v) != "0" { + d.Set("session_duration", formatInt(v)) + } + listPermissionPoliciesInAccessConfigurationObject, err := cloudssoService.ListPermissionPoliciesInAccessConfiguration(d.Id()) + if err != nil { + return WrapError(err) + } + if permissionPoliciesList, ok := listPermissionPoliciesInAccessConfigurationObject["PermissionPolicies"]; ok && permissionPoliciesList != nil { + permissionPoliciesMaps := make([]map[string]interface{}, 0) + for _, permissionPoliciesListItem := range permissionPoliciesList.([]interface{}) { + if permissionPoliciesListItemMap, ok := permissionPoliciesListItem.(map[string]interface{}); ok { + permissionPoliciesListItemMaps := map[string]interface{}{} + permissionPoliciesListItemMaps["permission_policy_name"] = permissionPoliciesListItemMap["PermissionPolicyName"] + permissionPoliciesListItemMaps["permission_policy_type"] = permissionPoliciesListItemMap["PermissionPolicyType"] + permissionPoliciesListItemMaps["permission_policy_document"] = permissionPoliciesListItemMap["PermissionPolicyDocument"] + permissionPoliciesMaps = append(permissionPoliciesMaps, permissionPoliciesListItemMaps) + } + } + d.Set("permission_policies", permissionPoliciesMaps) + } + + return nil +} +func resourceAlicloudCloudSsoAccessConfigurationUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Partial(true) + + if d.HasChange("permission_policies") { + oraw, nraw := d.GetChange("permission_policies") + removed := oraw.(*schema.Set).Difference(nraw.(*schema.Set)).List() + added := nraw.(*schema.Set).Difference(oraw.(*schema.Set)).List() + if len(removed) > 0 { + for _, permissions := range removed { + RemovePermissionPolicyFromAccessConfigurationReq := map[string]interface{}{ + "AccessConfigurationId": parts[1], + "DirectoryId": parts[0], + } + + permissionsArg := permissions.(map[string]interface{}) + RemovePermissionPolicyFromAccessConfigurationReq["PermissionPolicyName"] = permissionsArg["permission_policy_name"] + RemovePermissionPolicyFromAccessConfigurationReq["PermissionPolicyType"] = permissionsArg["permission_policy_type"] + + action := "RemovePermissionPolicyFromAccessConfiguration" + conn, err := client.NewCloudssoClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, RemovePermissionPolicyFromAccessConfigurationReq, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"OperationConflict.Task"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, RemovePermissionPolicyFromAccessConfigurationReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + } + + if len(added) > 0 { + for _, permissions := range added { + AddPermissionPolicyFromAccessConfigurationReq := map[string]interface{}{ + "AccessConfigurationId": parts[1], + "DirectoryId": parts[0], + } + + permissionsArg := permissions.(map[string]interface{}) + AddPermissionPolicyFromAccessConfigurationReq["PermissionPolicyName"] = permissionsArg["permission_policy_name"] + AddPermissionPolicyFromAccessConfigurationReq["PermissionPolicyType"] = permissionsArg["permission_policy_type"] + if AddPermissionPolicyFromAccessConfigurationReq["PermissionPolicyType"] == "Inline" { + AddPermissionPolicyFromAccessConfigurationReq["InlinePolicyDocument"] = permissionsArg["permission_policy_document"] + } + + action := "AddPermissionPolicyToAccessConfiguration" + conn, err := client.NewCloudssoClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, AddPermissionPolicyFromAccessConfigurationReq, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"OperationConflict.Task"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, AddPermissionPolicyFromAccessConfigurationReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + } + + // Provisioning access configuration when permission policies has changed. + cloudssoService := CloudssoService{client} + objects, err := cloudssoService.DescribeCloudSsoAccessConfigurationProvisionings(fmt.Sprint(parts[0]), fmt.Sprint(parts[1])) + if err != nil { + return WrapError(err) + } + + for _, object := range objects { + err = cloudssoService.CloudssoServicAccessConfigurationProvisioning(fmt.Sprint(parts[0]), fmt.Sprint(parts[1]), fmt.Sprint(object["TargetType"]), fmt.Sprint(object["TargetId"])) + if err != nil { + return WrapError(err) + } + } + } + + update := false + updateAccessConfigurationReq := map[string]interface{}{ + "AccessConfigurationId": parts[1], + "DirectoryId": parts[0], + } + if d.HasChange("description") { + update = true + if v, ok := d.GetOk("description"); ok { + updateAccessConfigurationReq["NewDescription"] = v + } + } + if d.HasChange("relay_state") { + update = true + if v, ok := d.GetOk("relay_state"); ok { + updateAccessConfigurationReq["NewRelayState"] = v + } + } + + if d.HasChange("session_duration") { + update = true + if v, ok := d.GetOk("session_duration"); ok { + updateAccessConfigurationReq["NewSessionDuration"] = v + } + } + + if update { + action := "UpdateAccessConfiguration" + conn, err := client.NewCloudssoClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, updateAccessConfigurationReq, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"OperationConflict.Task"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, updateAccessConfigurationReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("description") + d.SetPartial("relay_state") + d.SetPartial("session_duration") + } + d.Partial(false) + return resourceAlicloudCloudSsoAccessConfigurationRead(d, meta) +} +func resourceAlicloudCloudSsoAccessConfigurationDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + var response map[string]interface{} + conn, err := client.NewCloudssoClient() + if err != nil { + return WrapError(err) + } + + if v, ok := d.GetOk("permission_policies"); ok { + removed := v.(*schema.Set).List() + if len(removed) > 0 { + for _, permissions := range removed { + RemovePermissionPolicyFromAccessConfigurationReq := map[string]interface{}{ + "AccessConfigurationId": parts[1], + "DirectoryId": parts[0], + } + + permissionsArg := permissions.(map[string]interface{}) + RemovePermissionPolicyFromAccessConfigurationReq["PermissionPolicyName"] = permissionsArg["permission_policy_name"] + RemovePermissionPolicyFromAccessConfigurationReq["PermissionPolicyType"] = permissionsArg["permission_policy_type"] + + action := "RemovePermissionPolicyFromAccessConfiguration" + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, RemovePermissionPolicyFromAccessConfigurationReq, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"OperationConflict.Task"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, RemovePermissionPolicyFromAccessConfigurationReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + } + } + + action := "DeleteAccessConfiguration" + request := map[string]interface{}{ + "AccessConfigurationId": parts[1], + "DirectoryId": parts[0], + } + + if v, ok := d.GetOk("force_remove_permission_policies"); ok { + request["ForceRemovePermissionPolicies"] = v + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"DeletionConflict.AccessConfiguration.Provisioning", "DeletionConflict.AccessConfiguration.AccessAssignment", "OperationConflict.Task", "DeletionConflict.AccessConfiguration.Task"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"EntityNotExists.AccessConfiguration"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_sso_access_configuration_provisioning.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_sso_access_configuration_provisioning.go new file mode 100644 index 00000000000..d6c3064aa3f --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_sso_access_configuration_provisioning.go @@ -0,0 +1,175 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudCloudSsoAccessConfigurationProvisioning() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudCloudSsoAccessConfigurationProvisioningCreate, + Read: resourceAlicloudCloudSsoAccessConfigurationProvisioningRead, + Update: resourceAlicloudCloudSsoAccessConfigurationProvisioningUpdate, + Delete: resourceAlicloudCloudSsoAccessConfigurationProvisioningDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "access_configuration_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "directory_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "target_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "target_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"RD-Account"}, false), + }, + "status": { + Type: schema.TypeString, + Computed: true, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"Provisioned"}, false), + }, + }, + } +} + +func resourceAlicloudCloudSsoAccessConfigurationProvisioningCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + cloudssoService := CloudssoService{client} + err := cloudssoService.CloudssoServicAccessConfigurationProvisioning(fmt.Sprint(d.Get("directory_id")), fmt.Sprint(d.Get("access_configuration_id")), fmt.Sprint(d.Get("target_type")), fmt.Sprint(d.Get("target_id"))) + if err != nil { + return WrapError(err) + } + d.SetId(fmt.Sprint(d.Get("directory_id"), ":", d.Get("access_configuration_id"), ":", d.Get("target_type"), ":", d.Get("target_id"))) + return resourceAlicloudCloudSsoAccessConfigurationProvisioningRead(d, meta) +} +func resourceAlicloudCloudSsoAccessConfigurationProvisioningRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + cloudssoService := CloudssoService{client} + object, err := cloudssoService.DescribeCloudSsoAccessConfigurationProvisioning(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_cloud_sso_access_configuration_provisioning cloudssoService.DescribeCloudSsoAccessConfigurationProvisioning Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + + parts, err := ParseResourceId(d.Id(), 4) + if err != nil { + return WrapError(err) + } + + d.Set("access_configuration_id", parts[1]) + d.Set("directory_id", parts[0]) + d.Set("target_id", parts[3]) + d.Set("target_type", parts[2]) + d.Set("status", object["Status"]) + return nil +} +func resourceAlicloudCloudSsoAccessConfigurationProvisioningUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + cloudssoService := CloudssoService{client} + + if d.HasChange("status") { + object, err := cloudssoService.DescribeCloudSsoAccessConfigurationProvisioning(d.Id()) + if err != nil && !NotFoundError(err) { + return WrapError(err) + } + + parts, err := ParseResourceId(d.Id(), 4) + if err != nil { + return WrapError(err) + } + + if v, ok := object["Status"]; !ok || fmt.Sprint(v) != "Provisioned" { + cloudssoService := CloudssoService{client} + err := cloudssoService.CloudssoServicAccessConfigurationProvisioning(fmt.Sprint(parts[0]), fmt.Sprint(parts[1]), fmt.Sprint(parts[2]), fmt.Sprint(parts[3])) + if err != nil { + return WrapError(err) + } + } + } + + return resourceAlicloudCloudSsoAccessConfigurationProvisioningRead(d, meta) +} +func resourceAlicloudCloudSsoAccessConfigurationProvisioningDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 4) + if err != nil { + return WrapError(err) + } + action := "DeprovisionAccessConfiguration" + var response map[string]interface{} + conn, err := client.NewCloudssoClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "AccessConfigurationId": parts[1], + "DirectoryId": parts[0], + "TargetId": parts[3], + "TargetType": parts[2], + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"OperationConflict.Task", "DeletionConflict.AccessConfigurationProvisioning.AccessAssignment"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"EntityNotExists.AccessConfigurationProvisioning"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Tasks", response) + if err != nil || len(v.([]interface{})) < 1 { + return WrapErrorf(err, IdMsg, d.Id()) + } + response = v.([]interface{})[0].(map[string]interface{}) + cloudssoService := CloudssoService{client} + _, err = cloudssoService.GetTaskStatus(fmt.Sprint(request["DirectoryId"]), fmt.Sprint(response["TaskId"])) + if err != nil { + if NotFoundError(err) { + return nil + } + return WrapError(err) + } + stateConf := BuildStateConf([]string{}, []string{"Success"}, d.Timeout(schema.TimeoutDelete), 5*time.Second, cloudssoService.CloudssoServiceAccessConfigurationProvisioningStateRefreshFunc(fmt.Sprint(request["DirectoryId"]), fmt.Sprint(response["TaskId"]), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_sso_directory.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_sso_directory.go new file mode 100644 index 00000000000..70ef67bd0c1 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_sso_directory.go @@ -0,0 +1,366 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudCloudSsoDirectory() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudCloudSsoDirectoryCreate, + Read: resourceAlicloudCloudSsoDirectoryRead, + Update: resourceAlicloudCloudSsoDirectoryUpdate, + Delete: resourceAlicloudCloudSsoDirectoryDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "directory_name": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-z0-9-]{1,64}$`), "The name of the resource. The name must be 2 to 64 characters in length and can contain lower case letters, digits, and hyphens (-)."), + }, + "mfa_authentication_status": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"Disabled", "Enabled"}, false), + }, + "saml_identity_provider_configuration": { + Type: schema.TypeSet, + Optional: true, + MaxItems: 1, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "encoded_metadata_document": { + Type: schema.TypeString, + Optional: true, + Sensitive: true, + Computed: true, + }, + "sso_status": { + Computed: true, + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"Disabled", "Enabled"}, false), + }, + }, + }, + ForceNew: true, + }, + "scim_synchronization_status": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"Disabled", "Enabled"}, false), + }, + }, + } +} + +func resourceAlicloudCloudSsoDirectoryCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateDirectory" + request := make(map[string]interface{}) + conn, err := client.NewCloudssoClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("directory_name"); ok { + request["DirectoryName"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_cloud_sso_directory", action, AlibabaCloudSdkGoERROR) + } + responseDirectory := response["Directory"].(map[string]interface{}) + d.SetId(fmt.Sprint(responseDirectory["DirectoryId"])) + + return resourceAlicloudCloudSsoDirectoryUpdate(d, meta) +} +func resourceAlicloudCloudSsoDirectoryRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + cloudssoService := CloudssoService{client} + getDirectoryObject, err := cloudssoService.DescribeCloudSsoDirectory(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_cloud_sso_directory cloudssoService.DescribeCloudSsoDirectory Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("directory_name", getDirectoryObject["DirectoryName"]) + d.Set("mfa_authentication_status", getDirectoryObject["MFAAuthenticationStatus"]) + d.Set("scim_synchronization_status", getDirectoryObject["SCIMSynchronizationStatus"]) + + if SAMLIdentityProviderConfiguration, ok := getDirectoryObject["SAMLIdentityProviderConfiguration"]; ok && len(SAMLIdentityProviderConfiguration.(map[string]interface{})) > 0 { + SAMLIdentityProviderConfigurationSli := make([]map[string]interface{}, 0) + SAMLIdentityProviderConfigurationMap := make(map[string]interface{}) + SAMLIdentityProviderConfigurationMap["sso_status"] = SAMLIdentityProviderConfiguration.(map[string]interface{})["SSOStatus"] + if v, ok := SAMLIdentityProviderConfiguration.(map[string]interface{})["EncodedMetadataDocument"]; ok { + SAMLIdentityProviderConfigurationMap["encoded_metadata_document"] = v + } + SAMLIdentityProviderConfigurationSli = append(SAMLIdentityProviderConfigurationSli, SAMLIdentityProviderConfigurationMap) + d.Set("saml_identity_provider_configuration", SAMLIdentityProviderConfigurationSli) + } + + return nil +} +func resourceAlicloudCloudSsoDirectoryUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + d.Partial(true) + + update := false + request := map[string]interface{}{ + "DirectoryId": d.Id(), + } + if d.HasChange("mfa_authentication_status") { + update = true + if v, ok := d.GetOk("mfa_authentication_status"); ok { + request["MFAAuthenticationStatus"] = v + } + } + if update { + action := "SetMFAAuthenticationStatus" + conn, err := client.NewCloudssoClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("mfa_authentication_status") + } + update = false + setSCIMSynchronizationStatusReq := map[string]interface{}{ + "DirectoryId": d.Id(), + } + if d.HasChange("scim_synchronization_status") { + update = true + if v, ok := d.GetOk("scim_synchronization_status"); ok { + setSCIMSynchronizationStatusReq["SCIMSynchronizationStatus"] = v + } + } + if update { + action := "SetSCIMSynchronizationStatus" + conn, err := client.NewCloudssoClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, setSCIMSynchronizationStatusReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, setSCIMSynchronizationStatusReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("scim_synchronization_status") + } + update = false + updateDirectoryReq := map[string]interface{}{ + "DirectoryId": d.Id(), + } + if !d.IsNewResource() && d.HasChange("directory_name") { + update = true + if v, ok := d.GetOk("directory_name"); ok { + updateDirectoryReq["NewDirectoryName"] = v + } + } + if update { + action := "UpdateDirectory" + conn, err := client.NewCloudssoClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, updateDirectoryReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, updateDirectoryReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("directory_name") + } + update = false + setExternalSAMLIdentityProviderReq := map[string]interface{}{ + "DirectoryId": d.Id(), + } + if d.HasChange("saml_identity_provider_configuration") { + update = true + if v, ok := d.GetOk("saml_identity_provider_configuration"); ok { + for _, setExternalSAMLIdentityProvider := range v.(*schema.Set).List() { + setExternalSAMLIdentityProviderArg := setExternalSAMLIdentityProvider.(map[string]interface{}) + if v, ok := setExternalSAMLIdentityProviderArg["sso_status"]; ok && v != "" { + setExternalSAMLIdentityProviderReq["SSOStatus"] = v + } + if v, ok := setExternalSAMLIdentityProviderArg["encoded_metadata_document"]; ok && v != "" { + setExternalSAMLIdentityProviderReq["EncodedMetadataDocument"] = v + } + } + } + } + if update { + action := "SetExternalSAMLIdentityProvider" + conn, err := client.NewCloudssoClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, setExternalSAMLIdentityProviderReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, setExternalSAMLIdentityProviderReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("saml_identity_provider_configuration") + } + d.Partial(false) + return resourceAlicloudCloudSsoDirectoryRead(d, meta) +} +func resourceAlicloudCloudSsoDirectoryDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + + if _, ok := d.GetOk("saml_identity_provider_configuration"); ok { + deleteExternalSAMLIdentityProviderReq := map[string]interface{}{ + "DirectoryId": d.Id(), + } + + deleteExternalSAMLIdentityProviderReq["SSOStatus"] = "Disabled" + action := "SetExternalSAMLIdentityProvider" + conn, err := client.NewCloudssoClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, deleteExternalSAMLIdentityProviderReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, deleteExternalSAMLIdentityProviderReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + + clearExternalSAMLIdentityProviderReq := map[string]interface{}{ + "DirectoryId": d.Id(), + } + action = "ClearExternalSAMLIdentityProvider" + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, clearExternalSAMLIdentityProviderReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, clearExternalSAMLIdentityProviderReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + + action := "DeleteDirectory" + conn, err := client.NewCloudssoClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "DirectoryId": d.Id(), + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"DeletionConflict.Directory.Task"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"EntityNotExists.Directory"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_sso_group.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_sso_group.go new file mode 100644 index 00000000000..c7cd7bf2d8e --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_sso_group.go @@ -0,0 +1,193 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudCloudSsoGroup() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudCloudSsoGroupCreate, + Read: resourceAlicloudCloudSsoGroupRead, + Update: resourceAlicloudCloudSsoGroupUpdate, + Delete: resourceAlicloudCloudSsoGroupDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "description": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(0, 1024), + }, + "directory_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "group_id": { + Type: schema.TypeString, + Computed: true, + }, + "group_name": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[\w-.]{1,128}$`), "The name of the resource. The name must be 1 to 128 characters in length and can contain letters, digits, periods (.), underscores (_), and hyphens (-)."), + }, + }, + } +} + +func resourceAlicloudCloudSsoGroupCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateGroup" + request := make(map[string]interface{}) + conn, err := client.NewCloudssoClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + request["DirectoryId"] = d.Get("directory_id") + request["GroupName"] = d.Get("group_name") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_cloud_sso_group", action, AlibabaCloudSdkGoERROR) + } + responseGroup := response["Group"].(map[string]interface{}) + d.SetId(fmt.Sprint(request["DirectoryId"], ":", responseGroup["GroupId"])) + + return resourceAlicloudCloudSsoGroupRead(d, meta) +} +func resourceAlicloudCloudSsoGroupRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + cloudssoService := CloudssoService{client} + object, err := cloudssoService.DescribeCloudSsoGroup(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_cloud_sso_group cloudssoService.DescribeCloudSsoGroup Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Set("directory_id", parts[0]) + d.Set("group_id", parts[1]) + d.Set("description", object["Description"]) + d.Set("group_name", object["GroupName"]) + return nil +} +func resourceAlicloudCloudSsoGroupUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + update := false + request := map[string]interface{}{ + "DirectoryId": parts[0], + "GroupId": parts[1], + } + if d.HasChange("description") { + update = true + if v, ok := d.GetOk("description"); ok { + request["NewDescription"] = v + } + } + if d.HasChange("group_name") { + update = true + if v, ok := d.GetOk("group_name"); ok { + request["NewGroupName"] = v + } + } + if update { + action := "UpdateGroup" + conn, err := client.NewCloudssoClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudCloudSsoGroupRead(d, meta) +} +func resourceAlicloudCloudSsoGroupDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + action := "DeleteGroup" + var response map[string]interface{} + conn, err := client.NewCloudssoClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "DirectoryId": parts[0], + "GroupId": parts[1], + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"DeletionConflict.Group.AccessAssigment"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"EntityNotExists.Group"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_sso_scim_server_credential.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_sso_scim_server_credential.go new file mode 100644 index 00000000000..864fa8d1eaa --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_sso_scim_server_credential.go @@ -0,0 +1,172 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudCloudSsoScimServerCredential() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudCloudSsoScimServerCredentialCreate, + Read: resourceAlicloudCloudSsoScimServerCredentialRead, + Update: resourceAlicloudCloudSsoScimServerCredentialUpdate, + Delete: resourceAlicloudCloudSsoScimServerCredentialDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "credential_id": { + Type: schema.TypeString, + Computed: true, + }, + "directory_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"Disabled", "Enabled"}, false), + }, + }, + } +} + +func resourceAlicloudCloudSsoScimServerCredentialCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateSCIMServerCredential" + request := make(map[string]interface{}) + conn, err := client.NewCloudssoClient() + if err != nil { + return WrapError(err) + } + request["DirectoryId"] = d.Get("directory_id") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_cloud_sso_scim_server_credential", action, AlibabaCloudSdkGoERROR) + } + responseSCIMServerCredential := response["SCIMServerCredential"].(map[string]interface{}) + d.SetId(fmt.Sprint(request["DirectoryId"], ":", responseSCIMServerCredential["CredentialId"])) + + return resourceAlicloudCloudSsoScimServerCredentialUpdate(d, meta) +} +func resourceAlicloudCloudSsoScimServerCredentialRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + cloudssoService := CloudssoService{client} + object, err := cloudssoService.DescribeCloudSsoScimServerCredential(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_cloud_sso_scim_server_credential cloudssoService.DescribeCloudSsoScimServerCredential Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Set("credential_id", parts[1]) + d.Set("directory_id", parts[0]) + d.Set("status", object["Status"]) + return nil +} +func resourceAlicloudCloudSsoScimServerCredentialUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "CredentialId": parts[1], + "DirectoryId": parts[0], + } + if d.HasChange("status") { + if v, ok := d.GetOk("status"); ok { + request["NewStatus"] = v + } + } + action := "UpdateSCIMServerCredentialStatus" + conn, err := client.NewCloudssoClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return resourceAlicloudCloudSsoScimServerCredentialRead(d, meta) +} +func resourceAlicloudCloudSsoScimServerCredentialDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + action := "DeleteSCIMServerCredential" + var response map[string]interface{} + conn, err := client.NewCloudssoClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "CredentialId": parts[1], + "DirectoryId": parts[0], + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"EntityNotExists.SCIMCredential"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_sso_user.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_sso_user.go new file mode 100644 index 00000000000..5afb52bb27f --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_sso_user.go @@ -0,0 +1,301 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudCloudSsoUser() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudCloudSsoUserCreate, + Read: resourceAlicloudCloudSsoUserRead, + Update: resourceAlicloudCloudSsoUserUpdate, + Delete: resourceAlicloudCloudSsoUserDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "description": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(0, 1024), + }, + "directory_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "display_name": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(0, 256), + }, + "email": { + Type: schema.TypeString, + Optional: true, + }, + "first_name": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(0, 64), + }, + "last_name": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(0, 64), + }, + "status": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"Disabled", "Enabled"}, false), + }, + "user_id": { + Type: schema.TypeString, + Computed: true, + }, + "user_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[\w-.@]{1,64}$`), "The name of the resource. The name must be 1 to 64 characters in length and can contain letters, digits, at signs (@), periods (.), underscores (_), and hyphens (-)."), + }, + }, + } +} + +func resourceAlicloudCloudSsoUserCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateUser" + request := make(map[string]interface{}) + conn, err := client.NewCloudssoClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + request["DirectoryId"] = d.Get("directory_id") + if v, ok := d.GetOk("display_name"); ok { + request["DisplayName"] = v + } + if v, ok := d.GetOk("email"); ok { + request["Email"] = v + } + if v, ok := d.GetOk("first_name"); ok { + request["FirstName"] = v + } + if v, ok := d.GetOk("last_name"); ok { + request["LastName"] = v + } + if v, ok := d.GetOk("status"); ok { + request["Status"] = v + } + if v, ok := d.GetOk("user_name"); ok { + request["UserName"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_cloud_sso_user", action, AlibabaCloudSdkGoERROR) + } + responseUser := response["User"].(map[string]interface{}) + d.SetId(fmt.Sprint(request["DirectoryId"], ":", responseUser["UserId"])) + + return resourceAlicloudCloudSsoUserRead(d, meta) +} +func resourceAlicloudCloudSsoUserRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + cloudssoService := CloudssoService{client} + object, err := cloudssoService.DescribeCloudSsoUser(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_cloud_sso_user cloudssoService.DescribeCloudSsoUser Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Set("directory_id", parts[0]) + d.Set("user_id", parts[1]) + d.Set("description", object["Description"]) + d.Set("display_name", object["DisplayName"]) + d.Set("email", object["Email"]) + d.Set("first_name", object["FirstName"]) + d.Set("last_name", object["LastName"]) + d.Set("status", object["Status"]) + d.Set("user_name", object["UserName"]) + return nil +} +func resourceAlicloudCloudSsoUserUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Partial(true) + + update := false + request := map[string]interface{}{ + "DirectoryId": parts[0], + "UserId": parts[1], + } + if d.HasChange("status") { + update = true + if v, ok := d.GetOk("status"); ok { + request["NewStatus"] = v + } + } + if update { + action := "UpdateUserStatus" + conn, err := client.NewCloudssoClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("status") + } + update = false + updateUserReq := map[string]interface{}{ + "DirectoryId": parts[0], + "UserId": parts[1], + } + if d.HasChange("description") { + update = true + if v, ok := d.GetOk("description"); ok { + updateUserReq["NewDescription"] = v + } + } + if d.HasChange("display_name") { + update = true + if v, ok := d.GetOk("display_name"); ok { + updateUserReq["NewDisplayName"] = v + } + } + if d.HasChange("email") { + update = true + if v, ok := d.GetOk("email"); ok { + updateUserReq["NewEmail"] = v + } + } + if d.HasChange("first_name") { + update = true + if v, ok := d.GetOk("first_name"); ok { + updateUserReq["NewFirstName"] = v + } + } + if d.HasChange("last_name") { + update = true + if v, ok := d.GetOk("last_name"); ok { + updateUserReq["NewLastName"] = v + } + } + if update { + action := "UpdateUser" + conn, err := client.NewCloudssoClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, updateUserReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, updateUserReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("description") + d.SetPartial("display_name") + d.SetPartial("email") + d.SetPartial("first_name") + d.SetPartial("last_name") + } + d.Partial(false) + return resourceAlicloudCloudSsoUserRead(d, meta) +} +func resourceAlicloudCloudSsoUserDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + action := "DeleteUser" + var response map[string]interface{} + conn, err := client.NewCloudssoClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "DirectoryId": parts[0], + "UserId": parts[1], + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"DeletionConflict.User.AccessAssigment"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"EntityNotExists.User"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_sso_user_attachment.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_sso_user_attachment.go new file mode 100644 index 00000000000..c5bef6fb5b3 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_sso_user_attachment.go @@ -0,0 +1,138 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudCloudSsoUserAttachment() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudCloudSsoUserAttachmentCreate, + Read: resourceAlicloudCloudSsoUserAttachmentRead, + Delete: resourceAlicloudCloudSsoUserAttachmentDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "directory_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "group_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "user_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudCloudSsoUserAttachmentCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "AddUserToGroup" + request := make(map[string]interface{}) + conn, err := client.NewCloudssoClient() + if err != nil { + return WrapError(err) + } + + request["DirectoryId"] = d.Get("directory_id") + request["GroupId"] = d.Get("group_id") + request["UserId"] = d.Get("user_id") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + + if NeedRetry(err) { + + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_cloud_sso_user_attachment", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["DirectoryId"], ":", request["GroupId"], ":", request["UserId"])) + + return resourceAlicloudCloudSsoUserAttachmentRead(d, meta) +} +func resourceAlicloudCloudSsoUserAttachmentRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + cloudssoService := CloudssoService{client} + _, err := cloudssoService.DescribeCloudSsoUserAttachment(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_cloud_sso_user_attachment cloudssoService.DescribeCloudSsoUserAttachment Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + d.Set("directory_id", parts[0]) + d.Set("group_id", parts[1]) + d.Set("user_id", parts[2]) + return nil +} +func resourceAlicloudCloudSsoUserAttachmentDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + action := "RemoveUserFromGroup" + var response map[string]interface{} + conn, err := client.NewCloudssoClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "DirectoryId": parts[0], + "GroupId": parts[1], + "UserId": parts[2], + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + + if NeedRetry(err) { + + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_storage_gateway_express_sync.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_storage_gateway_express_sync.go new file mode 100644 index 00000000000..4ad4d3fd766 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_storage_gateway_express_sync.go @@ -0,0 +1,164 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudCloudStorageGatewayExpressSync() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudCloudStorageGatewayExpressSyncCreate, + Read: resourceAlicloudCloudStorageGatewayExpressSyncRead, + Delete: resourceAlicloudCloudStorageGatewayExpressSyncDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Delete: schema.DefaultTimeout(5 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "bucket_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "bucket_prefix": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "bucket_region": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "description": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(0, 255), + }, + "express_sync_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile("^[\u4e00-\u9fa5a-zA-Z][\u4e00-\u9fa5a-zA-Z0-9-_.]{0,127}$"), "The length of the name is limited to `1` to `128` characters. It can contain uppercase and lowercase letters, Chinese characters, numbers, English periods (.), underscores (_), or hyphens (-), and must start with letters."), + }, + }, + } +} + +func resourceAlicloudCloudStorageGatewayExpressSyncCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateExpressSync" + request := make(map[string]interface{}) + conn, err := client.NewHcsSgwClient() + if err != nil { + return WrapError(err) + } + request["BucketName"] = d.Get("bucket_name") + if v, ok := d.GetOk("bucket_prefix"); ok { + request["BucketPrefix"] = v + } + request["BucketRegion"] = d.Get("bucket_region") + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + request["Name"] = d.Get("express_sync_name") + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-05-11"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_cloud_storage_gateway_express_sync", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + + d.SetId(fmt.Sprint(response["ExpressSyncId"])) + return resourceAlicloudCloudStorageGatewayExpressSyncRead(d, meta) +} +func resourceAlicloudCloudStorageGatewayExpressSyncRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + sgwService := SgwService{client} + object, err := sgwService.DescribeExpressSyncs(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_cloud_storage_gateway_express_sync sgwService.DescribeExpressSyncs Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + + d.Set("bucket_name", object["BucketName"]) + d.Set("bucket_prefix", object["BucketPrefix"]) + d.Set("bucket_region", object["BucketRegion"]) + d.Set("description", object["Description"]) + d.Set("express_sync_name", object["Name"]) + return nil +} + +func resourceAlicloudCloudStorageGatewayExpressSyncDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + sgwService := SgwService{client} + action := "DeleteExpressSync" + var response map[string]interface{} + conn, err := client.NewHcsSgwClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "ExpressSyncId": d.Id(), + } + + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-05-11"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"ExpressSyncNotExist"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + + stateConf := BuildStateConf([]string{}, []string{"task.state.completed"}, d.Timeout(schema.TimeoutDelete), 1*time.Second, sgwService.CloudStorageGatewayTaskStateRefreshFunc(d.Id(), fmt.Sprint(response["TaskId"]), []string{"task.state.failed"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_storage_gateway_express_sync_share_attachment.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_storage_gateway_express_sync_share_attachment.go new file mode 100644 index 00000000000..bed1c6805ef --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_storage_gateway_express_sync_share_attachment.go @@ -0,0 +1,166 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudCloudStorageGatewayExpressSyncShareAttachment() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudCloudStorageGatewayExpressSyncShareAttachmentCreate, + Read: resourceAlicloudCloudStorageGatewayExpressSyncShareAttachmentRead, + Delete: resourceAlicloudCloudStorageGatewayExpressSyncShareAttachmentDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(5 * time.Minute), + Delete: schema.DefaultTimeout(5 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "express_sync_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "gateway_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "share_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudCloudStorageGatewayExpressSyncShareAttachmentCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + sgwService := SgwService{client} + var response map[string]interface{} + action := "AddSharesToExpressSync" + request := make(map[string]interface{}) + conn, err := client.NewHcsSgwClient() + if err != nil { + return WrapError(err) + } + request["ExpressSyncId"] = d.Get("express_sync_id") + sharesMaps := make(map[string]interface{}) + gatewayId := fmt.Sprint(d.Get("gateway_id")) + shareName := fmt.Sprint(d.Get("share_name")) + sharesMaps[gatewayId] = shareName + + if v, err := convertMaptoJsonString(sharesMaps); err != nil { + return WrapError(err) + } else { + request["GatewayShares"] = v + } + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-05-11"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_cloud_storage_gateway_express_sync_share_attachment", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + + stateConf := BuildStateConf([]string{}, []string{"task.state.completed"}, d.Timeout(schema.TimeoutCreate), 1*time.Second, sgwService.CloudStorageGatewayTaskStateRefreshFunc(fmt.Sprint(request["ExpressSyncId"]), fmt.Sprint(response["TaskId"]), []string{"task.state.failed"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + d.SetId(fmt.Sprint(request["ExpressSyncId"], ":", gatewayId, ":", shareName)) + return resourceAlicloudCloudStorageGatewayExpressSyncShareAttachmentRead(d, meta) +} +func resourceAlicloudCloudStorageGatewayExpressSyncShareAttachmentRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + sgwService := SgwService{client} + object, err := sgwService.DescribeExpressSyncShares(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_cloud_storage_gateway_express_sync sgwService.DescribeExpressSyncShares Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + + d.Set("express_sync_id", object["ExpressSyncId"]) + d.Set("gateway_id", object["GatewayId"]) + d.Set("share_name", object["ShareName"]) + return nil +} +func resourceAlicloudCloudStorageGatewayExpressSyncShareAttachmentDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + sgwService := SgwService{client} + var response map[string]interface{} + action := "RemoveSharesFromExpressSync" + request := make(map[string]interface{}) + conn, err := client.NewHcsSgwClient() + if err != nil { + return WrapError(err) + } + + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + + request["ExpressSyncId"] = parts[0] + sharesMaps := make(map[string]interface{}) + gatewayId := fmt.Sprint(parts[1]) + shareName := fmt.Sprint(parts[2]) + sharesMaps[gatewayId] = shareName + + if v, err := convertMaptoJsonString(sharesMaps); err != nil { + return WrapError(err) + } else { + request["GatewayShares"] = v + } + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-05-11"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"ExpressSyncNotExist", "GatewayNotExist"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + stateConf := BuildStateConf([]string{}, []string{"task.state.completed"}, d.Timeout(schema.TimeoutDelete), 1*time.Second, sgwService.CloudStorageGatewayTaskStateRefreshFunc(parts[0], fmt.Sprint(response["TaskId"]), []string{"task.state.failed"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_storage_gateway_gateway.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_storage_gateway_gateway.go index 473eb13ef56..a5f34abd3bd 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_storage_gateway_gateway.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_storage_gateway_gateway.go @@ -114,7 +114,6 @@ func resourceAlicloudCloudStorageGatewayGatewayCreate(d *schema.ResourceData, me } request["Location"] = d.Get("location") request["Name"] = d.Get("gateway_name") - fmt.Sprintf("gateway_name = %d\n", request["Name"]) if v, ok := d.GetOk("payment_type"); ok { request["PostPaid"] = convertCsgGatewayPaymentTypeReq(v.(string)) } @@ -454,6 +453,8 @@ func convertCsgGatewayPaymentTypeResp(source interface{}) interface{} { switch source { case true: return "PayAsYouGo" + case false: + return "Subscription" } return source } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_storage_gateway_gateway_block_volume.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_storage_gateway_gateway_block_volume.go new file mode 100644 index 00000000000..ee0c84b1809 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_storage_gateway_gateway_block_volume.go @@ -0,0 +1,367 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudCloudStorageGatewayGatewayBlockVolume() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudCloudStorageGatewayGatewayBlockVolumeCreate, + Read: resourceAlicloudCloudStorageGatewayGatewayBlockVolumeRead, + Update: resourceAlicloudCloudStorageGatewayGatewayBlockVolumeUpdate, + Delete: resourceAlicloudCloudStorageGatewayGatewayBlockVolumeDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(10 * time.Minute), + Delete: schema.DefaultTimeout(10 * time.Minute), + Update: schema.DefaultTimeout(10 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "cache_mode": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Cache", "WriteThrough"}, false), + }, + "chap_enabled": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "chap_in_password": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(12, 16), + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOkExists("chap_enabled"); ok && v.(bool) { + return false + } + return true + }, + }, + "chap_in_user": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[A-Za-z0-9]{0,32}$`), "The chap_in_user must be 1 to 32 characters in length, and can contain letters and digits."), + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOkExists("chap_enabled"); ok && v.(bool) { + return false + } + return true + }, + }, + "chunk_size": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + ForceNew: true, + ValidateFunc: validation.IntInSlice([]int{131072, 16384, 32768, 65536, 8192}), + }, + "gateway_block_volume_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-z][a-z0-9]{0,31}$`), "The name must be 1 to 32 characters in length, and can contain lower case letters and digits."), + }, + "gateway_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "index_id": { + Type: schema.TypeString, + Computed: true, + }, + "is_source_deletion": { + Type: schema.TypeBool, + Optional: true, + }, + "local_path": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("cache_mode"); ok && v.(string) == "Cache" { + return false + } + return true + }, + }, + "oss_bucket_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "oss_bucket_ssl": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + ForceNew: true, + }, + "oss_endpoint": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "protocol": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "recovery": { + Type: schema.TypeBool, + Optional: true, + }, + "size": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + ValidateFunc: validation.IntBetween(1, 262144), + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudCloudStorageGatewayGatewayBlockVolumeCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateGatewayBlockVolume" + request := make(map[string]interface{}) + conn, err := client.NewHcsSgwClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("cache_mode"); ok { + request["CacheMode"] = v + } + if v, ok := d.GetOkExists("chap_enabled"); ok { + request["ChapEnabled"] = v + } + if v, ok := d.GetOk("chap_in_user"); ok { + request["ChapInUser"] = v + } + if v, ok := d.GetOk("chap_in_password"); ok { + request["ChapInPassword"] = v + } + if v, ok := d.GetOk("chunk_size"); ok { + request["ChunkSize"] = v + } + request["Name"] = d.Get("gateway_block_volume_name") + request["GatewayId"] = d.Get("gateway_id") + if v, ok := d.GetOk("local_path"); ok { + request["LocalFilePath"] = v + } + request["OssBucketName"] = d.Get("oss_bucket_name") + if v, ok := d.GetOkExists("oss_bucket_ssl"); ok { + request["OssBucketSsl"] = v + } + request["OssEndpoint"] = d.Get("oss_endpoint") + request["VolumeProtocol"] = d.Get("protocol") + if v, ok := d.GetOkExists("recovery"); ok { + request["Recovery"] = v + } + if v, ok := d.GetOk("size"); ok { + request["Size"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-05-11"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_cloud_storage_gateway_gateway_block_volume", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + + sgwService := SgwService{client} + stateConf := BuildStateConf([]string{}, []string{"task.state.completed"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, sgwService.CloudStorageGatewayTaskStateRefreshFunc(request["GatewayId"].(string), response["TaskId"].(string), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + response, err = sgwService.DescribeTasks(request["GatewayId"].(string), response["TaskId"].(string)) + if err != nil { + d.SetId("") + return WrapError(err) + } + d.SetId(fmt.Sprint(request["GatewayId"], ":", response["RelatedResourceId"])) + return resourceAlicloudCloudStorageGatewayGatewayBlockVolumeRead(d, meta) +} +func resourceAlicloudCloudStorageGatewayGatewayBlockVolumeRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + sgwService := SgwService{client} + object, err := sgwService.DescribeCloudStorageGatewayGatewayBlockVolume(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_cloud_storage_gateway_gateway_block_volume sgwService.DescribeCloudStorageGatewayGatewayBlockVolume Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Set("gateway_id", parts[0]) + d.Set("index_id", parts[1]) + d.Set("cache_mode", object["CacheMode"]) + d.Set("chap_enabled", object["ChapEnabled"]) + d.Set("chap_in_user", object["ChapInUser"]) + if v, ok := object["ChunkSize"]; ok && fmt.Sprint(v) != "0" { + d.Set("chunk_size", formatInt(v)) + } + d.Set("gateway_block_volume_name", object["Name"]) + d.Set("local_path", object["LocalPath"]) + d.Set("oss_bucket_name", object["OssBucketName"]) + d.Set("oss_bucket_ssl", object["OssBucketSsl"]) + d.Set("oss_endpoint", object["OssEndpoint"]) + d.Set("protocol", object["Protocol"]) + d.Set("status", fmt.Sprint(formatInt(object["VolumeState"]))) + return nil +} +func resourceAlicloudCloudStorageGatewayGatewayBlockVolumeUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + update := false + request := map[string]interface{}{ + "GatewayId": parts[0], + "IndexId": parts[1], + } + if v, ok := d.GetOkExists("chap_enabled"); ok { + request["ChapEnabled"] = v + } + if d.HasChange("chap_enabled") { + update = true + } + if v, ok := d.GetOk("chap_in_password"); ok { + request["ChapInPassword"] = v + } + if d.HasChange("chap_in_password") { + update = true + } + if v, ok := d.GetOk("chap_in_user"); ok { + request["ChapInUser"] = v + } + if d.HasChange("chap_in_user") { + update = true + } + if d.HasChange("size") { + update = true + if v, ok := d.GetOk("size"); ok { + request["Size"] = v + } + } + if update { + action := "UpdateGatewayBlockVolume" + conn, err := client.NewHcsSgwClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-05-11"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + + sgwService := SgwService{client} + stateConf := BuildStateConf([]string{}, []string{"task.state.completed"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, sgwService.CloudStorageGatewayTaskStateRefreshFunc(request["GatewayId"].(string), response["TaskId"].(string), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + return resourceAlicloudCloudStorageGatewayGatewayBlockVolumeRead(d, meta) +} +func resourceAlicloudCloudStorageGatewayGatewayBlockVolumeDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + action := "DeleteGatewayBlockVolumes" + var response map[string]interface{} + conn, err := client.NewHcsSgwClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "GatewayId": parts[0], + "IndexId": parts[1], + } + + if v, ok := d.GetOkExists("is_source_deletion"); ok { + request["IsSourceDeletion"] = v + } else { + request["IsSourceDeletion"] = true + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-05-11"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + + sgwService := SgwService{client} + stateConf := BuildStateConf([]string{}, []string{"task.state.completed"}, d.Timeout(schema.TimeoutDelete), 5*time.Second, sgwService.CloudStorageGatewayTaskStateRefreshFunc(request["GatewayId"].(string), response["TaskId"].(string), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_storage_gateway_gateway_cache_disk.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_storage_gateway_gateway_cache_disk.go new file mode 100644 index 00000000000..1b6c6363ca2 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_storage_gateway_gateway_cache_disk.go @@ -0,0 +1,228 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudCloudStorageGatewayGatewayCacheDisk() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudCloudStorageGatewayGatewayCacheDiskCreate, + Read: resourceAlicloudCloudStorageGatewayGatewayCacheDiskRead, + Update: resourceAlicloudCloudStorageGatewayGatewayCacheDiskUpdate, + Delete: resourceAlicloudCloudStorageGatewayGatewayCacheDiskDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "cache_disk_category": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"cloud_efficiency", "cloud_ssd"}, false), + }, + "cache_disk_size_in_gb": { + Type: schema.TypeInt, + Required: true, + ValidateFunc: validation.IntBetween(20, 32768), + }, + "cache_id": { + Type: schema.TypeString, + Computed: true, + }, + "gateway_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "local_file_path": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeInt, + Computed: true, + }, + }, + } +} + +func resourceAlicloudCloudStorageGatewayGatewayCacheDiskCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + sgwService := SgwService{client} + var response map[string]interface{} + action := "CreateGatewayCacheDisk" + request := make(map[string]interface{}) + conn, err := client.NewHcsSgwClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("cache_disk_category"); ok { + request["CacheDiskCategory"] = v + } + request["CacheDiskSizeInGB"] = d.Get("cache_disk_size_in_gb") + request["GatewayId"] = d.Get("gateway_id") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-05-11"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_cloud_storage_gateway_gateway_cache_disk", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + + stateConf := BuildStateConf([]string{}, []string{"task.state.completed"}, d.Timeout(schema.TimeoutCreate), 1*time.Second, sgwService.CloudStorageGatewayTaskStateRefreshFunc(fmt.Sprint(request["GatewayId"]), fmt.Sprint(response["TaskId"]), []string{"task.state.failed"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + task, err := sgwService.DescribeTasks(fmt.Sprint(request["GatewayId"]), fmt.Sprint(response["TaskId"])) + if err != nil { + return nil + } + object, err := sgwService.DescribeCloudStorageGatewayGatewayCacheDisk(fmt.Sprint(request["GatewayId"], ":", task["RelatedResourceId"], ":")) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_cloud_storage_gateway_gateway_cache_disk sgwService.DescribeCloudStorageGatewayGatewayCacheDisk Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + + d.SetId(fmt.Sprint(request["GatewayId"], ":", task["RelatedResourceId"], ":", object["LocalFilePath"])) + + return resourceAlicloudCloudStorageGatewayGatewayCacheDiskRead(d, meta) +} +func resourceAlicloudCloudStorageGatewayGatewayCacheDiskRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + sgwService := SgwService{client} + object, err := sgwService.DescribeCloudStorageGatewayGatewayCacheDisk(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_cloud_storage_gateway_gateway_cache_disk sgwService.DescribeCloudStorageGatewayGatewayCacheDisk Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + d.Set("gateway_id", parts[0]) + d.Set("local_file_path", object["LocalFilePath"]) + d.Set("cache_disk_category", object["CacheType"]) + d.Set("cache_disk_size_in_gb", formatInt(object["SizeInGB"])) + d.Set("cache_id", object["CacheId"]) + d.Set("status", formatInt(object["ExpireStatus"])) + return nil +} +func resourceAlicloudCloudStorageGatewayGatewayCacheDiskUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + sgwService := SgwService{client} + var response map[string]interface{} + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + if d.HasChange("cache_disk_size_in_gb") { + request := map[string]interface{}{ + "GatewayId": parts[0], + "LocalFilePath": parts[2], + "NewSizeInGB": d.Get("cache_disk_size_in_gb"), + } + action := "ExpandCacheDisk" + conn, err := client.NewHcsSgwClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-05-11"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + stateConf := BuildStateConf([]string{}, []string{"task.state.completed"}, d.Timeout(schema.TimeoutCreate), 1*time.Second, sgwService.CloudStorageGatewayTaskStateRefreshFunc(fmt.Sprint(request["GatewayId"]), fmt.Sprint(response["TaskId"]), []string{"task.state.failed"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + + return resourceAlicloudCloudStorageGatewayGatewayCacheDiskRead(d, meta) +} +func resourceAlicloudCloudStorageGatewayGatewayCacheDiskDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + sgwService := SgwService{client} + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + action := "DeleteGatewayCacheDisk" + var response map[string]interface{} + conn, err := client.NewHcsSgwClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "GatewayId": parts[0], + "CacheId": parts[1], + "LocalFilePath": parts[2], + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-05-11"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + stateConf := BuildStateConf([]string{}, []string{"task.state.completed"}, d.Timeout(schema.TimeoutCreate), 1*time.Second, sgwService.CloudStorageGatewayTaskStateRefreshFunc(fmt.Sprint(request["GatewayId"]), fmt.Sprint(response["TaskId"]), []string{"task.state.failed"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_storage_gateway_gateway_file_share.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_storage_gateway_gateway_file_share.go new file mode 100644 index 00000000000..e294d18b986 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_storage_gateway_gateway_file_share.go @@ -0,0 +1,681 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudCloudStorageGatewayGatewayFileShare() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudCloudStorageGatewayGatewayFileShareCreate, + Read: resourceAlicloudCloudStorageGatewayGatewayFileShareRead, + Update: resourceAlicloudCloudStorageGatewayGatewayFileShareUpdate, + Delete: resourceAlicloudCloudStorageGatewayGatewayFileShareDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(5 * time.Minute), + Update: schema.DefaultTimeout(5 * time.Minute), + Delete: schema.DefaultTimeout(5 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "access_based_enumeration": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("protocol"); ok && v.(string) == "SMB" { + if _, ok := d.GetOkExists("windows_acl"); ok { + return false + } + } + return true + }, + }, + "backend_limit": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + ValidateFunc: validation.IntBetween(0, 1280), + }, + "browsable": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("protocol"); ok && v.(string) == "SMB" { + return false + } + return true + }, + }, + "cache_mode": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"Cache", "Sync"}, false), + }, + "direct_io": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + ForceNew: true, + }, + "download_limit": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + ValidateFunc: validation.IntBetween(0, 1280), + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("cache_mode"); ok && v.(string) == "Sync" { + return false + } + return true + }, + }, + "fast_reclaim": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "fe_limit": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + ValidateFunc: validation.IntBetween(0, 1280), + }, + "gateway_file_share_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-z][A-Za-z0-9\\_\\.\\-]{1,254}$`), "Length from `1` to `255` characters can contain lowercase letters, digits, (.), (_) Or (-), at the same time, must start with a lowercase letter."), + }, + "gateway_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "ignore_delete": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "in_place": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + ForceNew: true, + }, + "index_id": { + Type: schema.TypeString, + Computed: true, + }, + "lag_period": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + ValidateFunc: validation.IntBetween(5, 120), + }, + "local_path": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "nfs_v4_optimization": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("protocol"); ok && v.(string) == "NFS" { + return false + } + return true + }, + }, + "oss_bucket_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "oss_bucket_ssl": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + ForceNew: true, + }, + "oss_endpoint": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "partial_sync_paths": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "path_prefix": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "polling_interval": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validation.IntBetween(0, 36000), + }, + "protocol": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"NFS", "SMB"}, false), + }, + "remote_sync": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "remote_sync_download": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("cache_mode"); ok && v.(string) == "Sync" { + + return false + } + return true + }, + }, + "ro_client_list": { + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("protocol"); ok && v.(string) == "NFS" { + return false + } + return true + }, + }, + "ro_user_list": { + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("protocol"); ok && v.(string) == "SMB" { + return false + } + return true + }, + }, + "rw_client_list": { + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("protocol"); ok && v.(string) == "NFS" { + return false + } + return true + }, + }, + "rw_user_list": { + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("protocol"); ok && v.(string) == "SMB" { + return false + } + return true + }, + }, + "squash": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"all_anonymous", "all_squash", "none", "root_squash"}, false), + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("protocol"); ok && v.(string) == "NFS" { + return false + } + return true + }, + }, + "support_archive": { + Type: schema.TypeBool, + Optional: true, + ForceNew: true, + Computed: true, + }, + "transfer_acceleration": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "windows_acl": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("protocol"); ok && v.(string) == "SMB" { + return false + } + return true + }, + }, + "bypass_cache_read": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + }, + } +} + +func resourceAlicloudCloudStorageGatewayGatewayFileShareCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + sgwService := SgwService{client} + var response map[string]interface{} + action := "CreateGatewayFileShare" + request := make(map[string]interface{}) + conn, err := client.NewHcsSgwClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOkExists("access_based_enumeration"); ok { + request["AccessBasedEnumeration"] = v + } + if v, ok := d.GetOk("backend_limit"); ok { + request["BackendLimit"] = v + } + if v, ok := d.GetOkExists("browsable"); ok { + request["Browsable"] = v + } + if v, ok := d.GetOk("cache_mode"); ok { + request["CacheMode"] = v + } + if v, ok := d.GetOkExists("direct_io"); ok { + request["DirectIO"] = v + } + if v, ok := d.GetOk("download_limit"); ok { + request["DownloadLimit"] = v + } + if v, ok := d.GetOkExists("fast_reclaim"); ok { + request["FastReclaim"] = v + } + if v, ok := d.GetOk("fe_limit"); ok { + request["FrontendLimit"] = v + } + if v, ok := d.GetOkExists("bypass_cache_read"); ok { + request["BypassCacheRead"] = v + } + request["Name"] = d.Get("gateway_file_share_name") + request["GatewayId"] = d.Get("gateway_id") + if v, ok := d.GetOkExists("ignore_delete"); ok { + request["IgnoreDelete"] = v + } + if v, ok := d.GetOkExists("in_place"); ok { + request["InPlace"] = v + } + if v, ok := d.GetOk("lag_period"); ok { + request["LagPeriod"] = v + } + request["LocalFilePath"] = d.Get("local_path") + if v, ok := d.GetOkExists("nfs_v4_optimization"); ok { + request["NfsV4Optimization"] = v + } + request["OssBucketName"] = d.Get("oss_bucket_name") + if v, ok := d.GetOkExists("oss_bucket_ssl"); ok { + request["OssBucketSsl"] = v + } + request["OssEndpoint"] = d.Get("oss_endpoint") + if v, ok := d.GetOk("partial_sync_paths"); ok { + request["PartialSyncPaths"] = v + } + if v, ok := d.GetOk("path_prefix"); ok { + request["PathPrefix"] = v + } + if v, ok := d.GetOk("polling_interval"); ok { + request["PollingInterval"] = v + } + request["ShareProtocol"] = d.Get("protocol") + if v, ok := d.GetOkExists("remote_sync"); ok { + request["RemoteSync"] = v + } + if v, ok := d.GetOkExists("remote_sync_download"); ok { + request["RemoteSyncDownload"] = v + } + if v, ok := d.GetOk("ro_client_list"); ok { + request["ReadOnlyClientList"] = v + } + if v, ok := d.GetOk("ro_user_list"); ok { + request["ReadOnlyUserList"] = v + } + if v, ok := d.GetOk("rw_client_list"); ok { + request["ReadWriteClientList"] = v + } + if v, ok := d.GetOk("rw_user_list"); ok { + request["ReadWriteUserList"] = v + } + if v, ok := d.GetOk("squash"); ok { + request["Squash"] = v + } + if v, ok := d.GetOkExists("support_archive"); ok { + request["SupportArchive"] = v + } + if v, ok := d.GetOkExists("transfer_acceleration"); ok { + request["TransferAcceleration"] = v + } + if v, ok := d.GetOkExists("windows_acl"); ok { + request["WindowsAcl"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-05-11"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_cloud_storage_gateway_gateway_file_share", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + + stateConf := BuildStateConf([]string{}, []string{"task.state.completed"}, d.Timeout(schema.TimeoutCreate), 1*time.Second, sgwService.CloudStorageGatewayTaskStateRefreshFunc(fmt.Sprint(request["GatewayId"]), fmt.Sprint(response["TaskId"]), []string{"task.state.failed"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + object, err := sgwService.DescribeTasks(fmt.Sprint(request["GatewayId"]), fmt.Sprint(response["TaskId"])) + if err != nil { + return nil + } + + d.SetId(fmt.Sprint(request["GatewayId"], ":", object["RelatedResourceId"])) + + return resourceAlicloudCloudStorageGatewayGatewayFileShareRead(d, meta) +} +func resourceAlicloudCloudStorageGatewayGatewayFileShareRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + sgwService := SgwService{client} + object, err := sgwService.DescribeCloudStorageGatewayGatewayFileShare(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_cloud_storage_gateway_gateway_file_share sgwService.DescribeCloudStorageGatewayGatewayFileShare Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Set("gateway_id", parts[0]) + d.Set("index_id", parts[1]) + d.Set("access_based_enumeration", object["AccessBasedEnumeration"]) + d.Set("backend_limit", formatInt(object["BeLimit"])) + d.Set("browsable", object["Browsable"]) + d.Set("cache_mode", object["CacheMode"]) + d.Set("direct_io", object["DirectIO"]) + d.Set("download_limit", formatInt(object["DownloadLimit"])) + d.Set("fast_reclaim", object["FastReclaim"]) + d.Set("fe_limit", formatInt(object["FeLimit"])) + d.Set("gateway_file_share_name", object["Name"]) + d.Set("ignore_delete", object["IgnoreDelete"]) + d.Set("in_place", object["InPlace"]) + d.Set("lag_period", formatInt(object["LagPeriod"])) + d.Set("local_path", object["LocalPath"]) + d.Set("nfs_v4_optimization", object["NfsV4Optimization"]) + d.Set("oss_bucket_name", object["OssBucketName"]) + d.Set("oss_bucket_ssl", object["OssBucketSsl"]) + d.Set("oss_endpoint", object["OssEndpoint"]) + d.Set("partial_sync_paths", object["PartialSyncPaths"]) + d.Set("path_prefix", object["PathPrefix"]) + if v, ok := object["PollingInterval"]; ok && fmt.Sprint(v) != "0" { + d.Set("polling_interval", formatInt(v)) + } + d.Set("protocol", object["Protocol"]) + d.Set("bypass_cache_read", object["BypassCacheRead"]) + d.Set("remote_sync", object["RemoteSync"]) + d.Set("remote_sync_download", object["RemoteSyncDownload"]) + d.Set("ro_client_list", object["RoClientList"]) + d.Set("ro_user_list", object["RoUserList"]) + d.Set("rw_client_list", object["RwClientList"]) + d.Set("rw_user_list", object["RwUserList"]) + d.Set("squash", object["Squash"]) + d.Set("support_archive", object["SupportArchive"]) + d.Set("transfer_acceleration", object["TransferAcceleration"]) + d.Set("windows_acl", object["WindowsAcl"]) + return nil +} +func resourceAlicloudCloudStorageGatewayGatewayFileShareUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + sgwService := SgwService{client} + var response map[string]interface{} + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + update := false + request := map[string]interface{}{ + "GatewayId": parts[0], + "IndexId": parts[1], + } + request["Name"] = d.Get("gateway_file_share_name") + if d.HasChange("access_based_enumeration") || d.IsNewResource() { + update = true + } + if v, ok := d.GetOkExists("access_based_enumeration"); ok { + request["AccessBasedEnumeration"] = v + } + if v, ok := d.GetOkExists("backend_limit"); ok { + request["BackendLimit"] = v + } + if d.HasChange("backend_limit") { + update = true + } + if d.HasChange("browsable") || d.IsNewResource() { + update = true + } + if v, ok := d.GetOkExists("browsable"); ok { + request["Browsable"] = v + } + if d.HasChange("bypass_cache_read") { + update = true + } + if v, ok := d.GetOkExists("bypass_cache_read"); ok { + request["BypassCacheRead"] = v + } + if v, ok := d.GetOk("cache_mode"); ok { + request["CacheMode"] = v + } + if d.HasChange("download_limit") { + update = true + } + if v, ok := d.GetOkExists("download_limit"); ok { + request["DownloadLimit"] = v + } + if d.HasChange("fast_reclaim") || d.IsNewResource() { + update = true + } + if v, ok := d.GetOkExists("fast_reclaim"); ok { + request["FastReclaim"] = v + } + if d.HasChange("fe_limit") { + update = true + } + if v, ok := d.GetOkExists("fe_limit"); ok { + request["FrontendLimit"] = v + } + if d.HasChange("ignore_delete") || d.IsNewResource() { + update = true + } + if v, ok := d.GetOkExists("ignore_delete"); ok { + request["IgnoreDelete"] = v + } + if v, ok := d.GetOkExists("in_place"); ok { + request["InPlace"] = v + } + if d.HasChange("lag_period") { + update = true + } + if v, ok := d.GetOk("lag_period"); ok { + request["LagPeriod"] = v + } + if d.HasChange("nfs_v4_optimization") || d.IsNewResource() { + update = true + } + if v, ok := d.GetOkExists("nfs_v4_optimization"); ok { + request["NfsV4Optimization"] = v + } + if d.HasChange("polling_interval") { + update = true + } + if v, ok := d.GetOkExists("polling_interval"); ok { + request["PollingInterval"] = v + } + if d.HasChange("remote_sync") || d.IsNewResource() { + update = true + } + if v, ok := d.GetOkExists("remote_sync"); ok { + request["RemoteSync"] = v + } + if d.HasChange("remote_sync_download") || d.IsNewResource() { + update = true + } + if v, ok := d.GetOkExists("remote_sync_download"); ok { + request["RemoteSyncDownload"] = v + } + if d.HasChange("ro_client_list") { + update = true + } + if v, ok := d.GetOk("ro_client_list"); ok { + request["ReadOnlyClientList"] = v + } + if d.HasChange("ro_user_list") { + update = true + } + if v, ok := d.GetOk("ro_user_list"); ok { + request["ReadOnlyUserList"] = v + } + if d.HasChange("rw_client_list") { + update = true + } + if v, ok := d.GetOk("rw_client_list"); ok { + request["ReadWriteClientList"] = v + } + if d.HasChange("rw_user_list") { + update = true + } + if v, ok := d.GetOk("rw_user_list"); ok { + request["ReadWriteUserList"] = v + } + if d.HasChange("squash") { + update = true + } + if v, ok := d.GetOk("squash"); ok { + request["Squash"] = v + } + if d.HasChange("transfer_acceleration") || d.IsNewResource() { + update = true + } + if v, ok := d.GetOkExists("transfer_acceleration"); ok { + request["TransferAcceleration"] = v + } + if d.HasChange("windows_acl") || d.IsNewResource() { + update = true + } + if v, ok := d.GetOkExists("windows_acl"); ok { + request["WindowsAcl"] = v + } + if update { + action := "UpdateGatewayFileShare" + conn, err := client.NewHcsSgwClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-05-11"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + stateConf := BuildStateConf([]string{}, []string{"task.state.completed"}, d.Timeout(schema.TimeoutUpdate), 1*time.Second, sgwService.CloudStorageGatewayTaskStateRefreshFunc(fmt.Sprint(request["GatewayId"]), fmt.Sprint(response["TaskId"]), []string{"task.state.failed"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + return resourceAlicloudCloudStorageGatewayGatewayFileShareRead(d, meta) +} +func resourceAlicloudCloudStorageGatewayGatewayFileShareDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + sgwService := SgwService{client} + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + action := "DeleteGatewayFileShares" + var response map[string]interface{} + conn, err := client.NewHcsSgwClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "GatewayId": parts[0], + "IndexId": parts[1], + "Force": true, + } + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-05-11"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"GatewayDeletionError"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + stateConf := BuildStateConf([]string{}, []string{"task.state.completed"}, d.Timeout(schema.TimeoutDelete), 1*time.Second, sgwService.CloudStorageGatewayTaskStateRefreshFunc(fmt.Sprint(request["GatewayId"]), fmt.Sprint(response["TaskId"]), []string{"task.state.failed"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_storage_gateway_gateway_logging.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_storage_gateway_gateway_logging.go new file mode 100644 index 00000000000..1982b114cb9 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_storage_gateway_gateway_logging.go @@ -0,0 +1,223 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudCloudStorageGatewayGatewayLogging() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudCloudStorageGatewayGatewayLoggingCreate, + Read: resourceAlicloudCloudStorageGatewayGatewayLoggingRead, + Update: resourceAlicloudCloudStorageGatewayGatewayLoggingUpdate, + Delete: resourceAlicloudCloudStorageGatewayGatewayLoggingDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "gateway_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "sls_logstore": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "sls_project": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"Enabled", "Disabled"}, false), + }, + }, + } +} + +func resourceAlicloudCloudStorageGatewayGatewayLoggingCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateGatewayLogging" + request := make(map[string]interface{}) + conn, err := client.NewHcsSgwClient() + if err != nil { + return WrapError(err) + } + request["GatewayId"] = d.Get("gateway_id") + request["SlsLogstore"] = d.Get("sls_logstore") + request["SlsProject"] = d.Get("sls_project") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-05-11"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_cloud_storage_gateway_gateway_logging", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + + d.SetId(fmt.Sprint(request["GatewayId"])) + + return resourceAlicloudCloudStorageGatewayGatewayLoggingUpdate(d, meta) +} +func resourceAlicloudCloudStorageGatewayGatewayLoggingRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + sgwService := SgwService{client} + object, err := sgwService.DescribeCloudStorageGatewayGatewayLogging(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_cloud_storage_gateway_gateway_logging sgwService.DescribeCloudStorageGatewayGatewayLogging Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + + d.Set("gateway_id", d.Id()) + d.Set("sls_logstore", object["SlsLogstore"]) + d.Set("sls_project", object["SlsProject"]) + d.Set("status", object["GatewayLoggingStatus"]) + return nil +} +func resourceAlicloudCloudStorageGatewayGatewayLoggingUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + sgwService := SgwService{client} + var response map[string]interface{} + d.Partial(true) + + if d.HasChange("status") { + object, err := sgwService.DescribeCloudStorageGatewayGatewayLogging(d.Id()) + if err != nil { + return WrapError(err) + } + target := d.Get("status").(string) + if object["GatewayLoggingStatus"].(string) != target { + if target == "Disabled" { + request := map[string]interface{}{ + "GatewayId": d.Id(), + } + action := "DisableGatewayLogging" + conn, err := client.NewHcsSgwClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-05-11"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + + if NeedRetry(err) { + + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + } + if target == "Enabled" { + request := map[string]interface{}{ + "GatewayId": d.Id(), + } + action := "EnableGatewayLogging" + conn, err := client.NewHcsSgwClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-05-11"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + + if NeedRetry(err) { + + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + } + d.SetPartial("status") + } + } + d.Partial(false) + return resourceAlicloudCloudStorageGatewayGatewayLoggingRead(d, meta) +} +func resourceAlicloudCloudStorageGatewayGatewayLoggingDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteGatewayLogging" + var response map[string]interface{} + conn, err := client.NewHcsSgwClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "GatewayId": d.Id(), + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-05-11"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + + if NeedRetry(err) { + + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_storage_gateway_gateway_smb_user.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_storage_gateway_gateway_smb_user.go new file mode 100644 index 00000000000..3703651fe5e --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloud_storage_gateway_gateway_smb_user.go @@ -0,0 +1,150 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudCloudStorageGatewayGatewaySmbUser() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudCloudStorageGatewayGatewaySmbUserCreate, + Read: resourceAlicloudCloudStorageGatewayGatewaySmbUserRead, + Delete: resourceAlicloudCloudStorageGatewayGatewaySmbUserDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(1 * time.Minute), + Delete: schema.DefaultTimeout(1 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "gateway_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "password": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Sensitive: true, + }, + "username": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudCloudStorageGatewayGatewaySmbUserCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + sgwService := SgwService{client} + var response map[string]interface{} + action := "CreateGatewaySMBUser" + request := make(map[string]interface{}) + conn, err := client.NewHcsSgwClient() + if err != nil { + return WrapError(err) + } + request["GatewayId"] = d.Get("gateway_id") + request["Password"] = d.Get("password") + request["Username"] = d.Get("username") + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-05-11"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_cloud_storage_gateway_gateway_smb_user", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + + d.SetId(fmt.Sprint(request["GatewayId"], ":", request["Username"])) + + stateConf := BuildStateConf([]string{}, []string{"task.state.completed"}, d.Timeout(schema.TimeoutCreate), 1*time.Second, sgwService.CloudStorageGatewayTaskStateRefreshFunc(fmt.Sprint(request["GatewayId"]), fmt.Sprint(response["TaskId"]), []string{"task.state.Failed"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudCloudStorageGatewayGatewaySmbUserRead(d, meta) +} + +func resourceAlicloudCloudStorageGatewayGatewaySmbUserRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + sgwService := SgwService{client} + _, err := sgwService.DescribeCloudStorageGatewayGatewaySmbUser(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_cloud_storage_gateway_gateway_smb_user sgwService.DescribeCloudStorageGatewayGatewaySmbUser Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Set("gateway_id", parts[0]) + d.Set("username", parts[1]) + return nil +} + +func resourceAlicloudCloudStorageGatewayGatewaySmbUserDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + sgwService := SgwService{client} + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + action := "DeleteGatewaySMBUser" + var response map[string]interface{} + conn, err := client.NewHcsSgwClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "GatewayId": parts[0], + "Username": parts[1], + } + + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-05-11"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"InternalError"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + stateConf := BuildStateConf([]string{}, []string{"task.state.completed"}, d.Timeout(schema.TimeoutCreate), 1*time.Second, sgwService.CloudStorageGatewayTaskStateRefreshFunc(fmt.Sprint(request["GatewayId"]), fmt.Sprint(response["TaskId"]), []string{"task.state.Failed"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloudauth_face_config.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloudauth_face_config.go new file mode 100644 index 00000000000..0f28b3221b7 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cloudauth_face_config.go @@ -0,0 +1,131 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudCloudauthFaceConfig() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudCloudauthFaceConfigCreate, + Read: resourceAlicloudCloudauthFaceConfigRead, + Update: resourceAlicloudCloudauthFaceConfigUpdate, + Delete: resourceAlicloudCloudauthFaceConfigDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "biz_name": { + Type: schema.TypeString, + Required: true, + }, + "biz_type": { + Type: schema.TypeString, + Required: true, + }, + "gmt_modified": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudCloudauthFaceConfigCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateFaceConfig" + request := make(map[string]interface{}) + conn, err := client.NewCloudauthClient() + if err != nil { + return WrapError(err) + } + request["BizName"] = d.Get("biz_name") + request["BizType"] = d.Get("biz_type") + request["SourceIp"] = buildClientToken(action) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-03-07"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_cloudauth_face_config", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["BizType"])) + + return resourceAlicloudCloudauthFaceConfigRead(d, meta) +} +func resourceAlicloudCloudauthFaceConfigRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + cloudauthService := CloudauthService{client} + object, err := cloudauthService.DescribeCloudauthFaceConfig(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_cloudauth_face_config cloudauthService.DescribeCloudauthFaceConfig Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + + d.Set("biz_name", object["BizName"]) + d.Set("biz_type", object["BizType"]) + d.Set("gmt_modified", object["GmtUpdated"]) + return nil +} +func resourceAlicloudCloudauthFaceConfigUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "BizType": d.Id(), + } + if d.HasChange("biz_name") { + update = true + } + request["BizName"] = d.Get("biz_name") + if update { + action := "UpdateFaceConfig" + request["SourceIp"] = buildClientToken(action) + conn, err := client.NewCloudauthClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-03-07"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudCloudauthFaceConfigRead(d, meta) +} +func resourceAlicloudCloudauthFaceConfigDelete(d *schema.ResourceData, meta interface{}) error { + log.Printf("[WARN] Cannot destroy resourceAlicloudCloudauthFaceConfig. Terraform will remove this resource from the state file, however resources may remain.") + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cms_dynamic_tag_group.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cms_dynamic_tag_group.go new file mode 100644 index 00000000000..8943131b639 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cms_dynamic_tag_group.go @@ -0,0 +1,189 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudCmsDynamicTagGroup() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudCmsDynamicTagGroupCreate, + Read: resourceAlicloudCmsDynamicTagGroupRead, + Delete: resourceAlicloudCmsDynamicTagGroupDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "contact_group_list": { + Type: schema.TypeList, + Required: true, + Elem: &schema.Schema{Type: schema.TypeString}, + ForceNew: true, + }, + "tag_key": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "match_express": { + Type: schema.TypeSet, + Required: true, + ForceNew: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "tag_value": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "tag_value_match_function": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + }, + }, + "match_express_filter_relation": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + }, + "template_id_list": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudCmsDynamicTagGroupCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateDynamicTagGroup" + request := make(map[string]interface{}) + conn, err := client.NewCmsClient() + if err != nil { + return WrapError(err) + } + request["ContactGroupList"] = d.Get("contact_group_list") + + if v, ok := d.GetOk("match_express"); ok { + for matchExpressPtr, matchExpress := range v.(*schema.Set).List() { + matchExpressArg := matchExpress.(map[string]interface{}) + request["MatchExpress."+fmt.Sprint(matchExpressPtr+1)+".TagValue"] = matchExpressArg["tag_value"] + request["MatchExpress."+fmt.Sprint(matchExpressPtr+1)+".TagValueMatchFunction"] = matchExpressArg["tag_value_match_function"] + } + } + if v, ok := d.GetOk("match_express_filter_relation"); ok { + request["MatchExpressFilterRelation"] = v + } + request["TagRegionId"] = client.RegionId + request["TagKey"] = d.Get("tag_key") + if v, ok := d.GetOk("template_id_list"); ok { + request["TemplateIdList"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_cms_dynamic_tag_group", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + + d.SetId(fmt.Sprint(response["Id"])) + + return resourceAlicloudCmsDynamicTagGroupRead(d, meta) +} + +func resourceAlicloudCmsDynamicTagGroupRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + cmsService := CmsService{client} + object, err := cmsService.DescribeCmsDynamicTagGroup(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_cms_dynamic_tag_group cmsService.DescribeCmsDynamicTagGroup Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("status", object["Status"]) + d.Set("match_express_filter_relation", object["MatchExpressFilterRelation"]) + + d.Set("template_id_list", object["TemplateIdList"]) + + if matchExpressMap, ok := object["MatchExpress"]; ok && matchExpressMap != nil { + resourceData := make([]map[string]interface{}, 0) + for _, matchExpressListItem := range matchExpressMap.(map[string]interface{}) { + for _, val := range matchExpressListItem.([]interface{}) { + matchExpressObject := make(map[string]interface{}, 0) + matchExpressObject["tag_value"] = val.(map[string]interface{})["TagValue"] + matchExpressObject["tag_value_match_function"] = val.(map[string]interface{})["TagValueMatchFunction"] + resourceData = append(resourceData, matchExpressObject) + } + } + d.Set("match_express", resourceData) + } + + d.Set("tag_key", object["TagKey"]) + return nil +} +func resourceAlicloudCmsDynamicTagGroupDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteDynamicTagGroup" + var response map[string]interface{} + conn, err := client.NewCmsClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "DynamicTagRuleId": d.Id(), + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cms_metric_rule_template.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cms_metric_rule_template.go new file mode 100644 index 00000000000..ecaa738612b --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cms_metric_rule_template.go @@ -0,0 +1,556 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudCmsMetricRuleTemplate() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudCmsMetricRuleTemplateCreate, + Read: resourceAlicloudCmsMetricRuleTemplateRead, + Update: resourceAlicloudCmsMetricRuleTemplateUpdate, + Delete: resourceAlicloudCmsMetricRuleTemplateDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "alert_templates": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "category": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"ecs", "rds", "ads", "slb", "vpc", "apigateway", "cdn", "cs", "dcdn", "ddos", "eip", "elasticsearch", "emr", "ess", "hbase", "iot_edge", "kvstore_sharding", "kvstore_splitrw", "kvstore_standard", "memcache", "mns", "mongodb", "mongodb_cluster", "mongodb_sharding", "mq_topic", "ocs", "opensearch", "oss", "polardb", "petadata", "scdn", "sharebandwidthpackages", "sls", "vpn"}, false), + }, + "escalations": { + Type: schema.TypeSet, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "critical": { + Type: schema.TypeSet, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "comparison_operator": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"GreaterThanOrEqualToThreshold", "GreaterThanThreshold", "LessThanOrEqualToThreshold", "LessThanThreshold", "NotEqualToThreshold", "GreaterThanYesterday", "LessThanYesterday", "GreaterThanLastWeek", "LessThanLastWeek", "GreaterThanLastPeriod", "LessThanLastPeriod"}, false), + }, + "statistics": { + Type: schema.TypeString, + Optional: true, + }, + "threshold": { + Type: schema.TypeString, + Optional: true, + }, + "times": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "info": { + Type: schema.TypeSet, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "comparison_operator": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"GreaterThanOrEqualToThreshold", "GreaterThanThreshold", "LessThanOrEqualToThreshold", "LessThanThreshold", "NotEqualToThreshold", "GreaterThanYesterday", "LessThanYesterday", "GreaterThanLastWeek", "LessThanLastWeek", "GreaterThanLastPeriod", "LessThanLastPeriod"}, false), + }, + "statistics": { + Type: schema.TypeString, + Optional: true, + }, + "threshold": { + Type: schema.TypeString, + Optional: true, + }, + "times": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "warn": { + Type: schema.TypeSet, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "comparison_operator": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"GreaterThanOrEqualToThreshold", "GreaterThanThreshold", "LessThanOrEqualToThreshold", "LessThanThreshold", "NotEqualToThreshold", "GreaterThanYesterday", "LessThanYesterday", "GreaterThanLastWeek", "LessThanLastWeek", "GreaterThanLastPeriod", "LessThanLastPeriod"}, false), + }, + "statistics": { + Type: schema.TypeString, + Optional: true, + }, + "threshold": { + Type: schema.TypeString, + Optional: true, + }, + "times": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + }, + }, + }, + "metric_name": { + Type: schema.TypeString, + Required: true, + }, + "namespace": { + Type: schema.TypeString, + Required: true, + }, + "rule_name": { + Type: schema.TypeString, + Required: true, + }, + "webhook": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "apply_mode": { + Type: schema.TypeString, + Optional: true, + }, + "description": { + Type: schema.TypeString, + Optional: true, + }, + "enable_end_time": { + Type: schema.TypeString, + Optional: true, + }, + "enable_start_time": { + Type: schema.TypeString, + Optional: true, + }, + "group_id": { + Type: schema.TypeString, + Optional: true, + }, + "metric_rule_template_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "notify_level": { + Type: schema.TypeString, + Optional: true, + }, + "rest_version": { + Type: schema.TypeString, + Computed: true, + ForceNew: true, + }, + "silence_time": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validation.IntBetween(0, 86400), + }, + "webhook": { + Type: schema.TypeString, + Optional: true, + }, + }, + } +} + +func resourceAlicloudCmsMetricRuleTemplateCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateMetricRuleTemplate" + request := make(map[string]interface{}) + conn, err := client.NewCmsClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("alert_templates"); ok { + alertTemplatesMaps := make([]map[string]interface{}, 0) + for _, alertTemplates := range v.(*schema.Set).List() { + alertTemplatesArg := alertTemplates.(map[string]interface{}) + alertTemplatesMap := map[string]interface{}{} + alertTemplatesMap["Category"] = alertTemplatesArg["category"] + if escalationsMaps, ok := alertTemplatesArg["escalations"]; ok { + escalationsMap := map[string]interface{}{} + for _, escalationsArg := range escalationsMaps.(*schema.Set).List() { + if criticalMaps, ok := escalationsArg.(map[string]interface{})["critical"]; ok { + requestCriticalArg := map[string]interface{}{} + for _, criticalMap := range criticalMaps.(*schema.Set).List() { + criticalArg := criticalMap.(map[string]interface{}) + requestCriticalArg["ComparisonOperator"] = criticalArg["comparison_operator"] + requestCriticalArg["Statistics"] = criticalArg["statistics"] + requestCriticalArg["Threshold"] = criticalArg["threshold"] + requestCriticalArg["Times"] = criticalArg["times"] + } + escalationsMap["Critical"] = requestCriticalArg + } + if infoMaps, ok := escalationsArg.(map[string]interface{})["info"]; ok { + requestInfoArg := map[string]interface{}{} + for _, infoMap := range infoMaps.(*schema.Set).List() { + infoArg := infoMap.(map[string]interface{}) + requestInfoArg["ComparisonOperator"] = infoArg["comparison_operator"] + requestInfoArg["Statistics"] = infoArg["statistics"] + requestInfoArg["Threshold"] = infoArg["threshold"] + requestInfoArg["Times"] = infoArg["times"] + } + escalationsMap["Info"] = requestInfoArg + } + if warnMaps, ok := escalationsArg.(map[string]interface{})["warn"]; ok { + requestWarnArg := map[string]interface{}{} + for _, warnMap := range warnMaps.(*schema.Set).List() { + warnArg := warnMap.(map[string]interface{}) + requestWarnArg["ComparisonOperator"] = warnArg["comparison_operator"] + requestWarnArg["Statistics"] = warnArg["statistics"] + requestWarnArg["Threshold"] = warnArg["threshold"] + requestWarnArg["Times"] = warnArg["times"] + } + escalationsMap["Warn"] = requestWarnArg + } + } + alertTemplatesMap["Escalations"] = escalationsMap + } + alertTemplatesMap["MetricName"] = alertTemplatesArg["metric_name"] + alertTemplatesMap["Namespace"] = alertTemplatesArg["namespace"] + alertTemplatesMap["RuleName"] = alertTemplatesArg["rule_name"] + alertTemplatesMap["Webhook"] = alertTemplatesArg["webhook"] + alertTemplatesMaps = append(alertTemplatesMaps, alertTemplatesMap) + } + + request["AlertTemplates"] = alertTemplatesMaps + } + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + request["Name"] = d.Get("metric_rule_template_name") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_cms_metric_rule_template", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + + d.SetId(fmt.Sprint(response["Id"])) + + return resourceAlicloudCmsMetricRuleTemplateUpdate(d, meta) +} +func resourceAlicloudCmsMetricRuleTemplateRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + cmsService := CmsService{client} + object, err := cmsService.DescribeCmsMetricRuleTemplate(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_cms_metric_rule_template cmsService.DescribeCmsMetricRuleTemplate Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + if alertTemplatesMap, ok := object["AlertTemplates"].(map[string]interface{}); ok && alertTemplatesMap != nil { + if alertTemplateList, ok := alertTemplatesMap["AlertTemplate"]; ok && alertTemplateList != nil { + alertTemplatesMaps := make([]map[string]interface{}, 0) + for _, alertTemplateListItem := range alertTemplateList.([]interface{}) { + if alertTemplateListItemMap, ok := alertTemplateListItem.(map[string]interface{}); ok { + alertTempArg := make(map[string]interface{}, 0) + alertTempArg["category"] = alertTemplateListItemMap["Category"] + alertTempArg["metric_name"] = alertTemplateListItemMap["MetricName"] + alertTempArg["namespace"] = alertTemplateListItemMap["Namespace"] + alertTempArg["rule_name"] = alertTemplateListItemMap["RuleName"] + alertTempArg["webhook"] = alertTemplateListItemMap["Webhook"] + escalationsMaps := make([]map[string]interface{}, 0) + escalationsMap := map[string]interface{}{} + if EscalationsMap, ok := alertTemplateListItemMap["Escalations"].(map[string]interface{}); ok && len(EscalationsMap) > 0 { + EscalationsArg := EscalationsMap + + if criticalMap, ok := EscalationsArg["Critical"].(map[string]interface{}); ok && len(criticalMap) > 0 { + criticalMaps := make([]map[string]interface{}, 0) + criticalArg := map[string]interface{}{} + criticalArg["comparison_operator"] = criticalMap["ComparisonOperator"] + criticalArg["statistics"] = criticalMap["Statistics"] + criticalArg["threshold"] = criticalMap["Threshold"] + criticalArg["times"] = criticalMap["Times"] + criticalMaps = append(criticalMaps, criticalArg) + escalationsMap["critical"] = criticalMaps + } + + if infoMap, ok := EscalationsArg["Info"].(map[string]interface{}); ok && len(infoMap) > 0 { + infoMaps := make([]map[string]interface{}, 0) + infoArg := map[string]interface{}{} + infoArg["comparison_operator"] = infoMap["ComparisonOperator"] + infoArg["statistics"] = infoMap["Statistics"] + infoArg["threshold"] = infoMap["Threshold"] + infoArg["times"] = infoMap["Times"] + infoMaps = append(infoMaps, infoArg) + escalationsMap["info"] = infoMaps + } + + if warnMap, ok := EscalationsArg["Warn"].(map[string]interface{}); ok && len(warnMap) > 0 { + warnMaps := make([]map[string]interface{}, 0) + warnArg := make(map[string]interface{}, 0) + warnArg["comparison_operator"] = warnMap["ComparisonOperator"] + warnArg["statistics"] = warnMap["Statistics"] + warnArg["threshold"] = warnMap["Threshold"] + warnArg["times"] = warnMap["Times"] + warnMaps = append(warnMaps, warnArg) + escalationsMap["warn"] = warnMaps + } + } + escalationsMaps = append(escalationsMaps, escalationsMap) + + alertTempArg["escalations"] = escalationsMaps + alertTemplatesMaps = append(alertTemplatesMaps, alertTempArg) + } + } + d.Set("alert_templates", alertTemplatesMaps) + } + } + d.Set("description", object["Description"]) + d.Set("metric_rule_template_name", object["Name"]) + d.Set("rest_version", object["RestVersion"]) + return nil +} +func resourceAlicloudCmsMetricRuleTemplateUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + d.Partial(true) + + update := false + request := map[string]interface{}{ + "TemplateIds": d.Id(), + } + if d.HasChange("group_id") { + update = true + } + if v, ok := d.GetOk("group_id"); ok { + request["GroupId"] = v + } + if update { + if v, ok := d.GetOk("apply_mode"); ok { + request["ApplyMode"] = v + } + if v, ok := d.GetOk("enable_end_time"); ok { + request["EnableEndTime"] = v + } + if v, ok := d.GetOk("enable_start_time"); ok { + request["EnableStartTime"] = v + } + if v, ok := d.GetOk("notify_level"); ok { + request["NotifyLevel"] = v + } + if v, ok := d.GetOk("silence_time"); ok { + request["SilenceTime"] = v + } + if v, ok := d.GetOk("webhook"); ok { + request["Webhook"] = v + } + action := "ApplyMetricRuleTemplate" + conn, err := client.NewCmsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + d.SetPartial("group_id") + } + update = false + modifyMetricRuleTemplateReq := map[string]interface{}{ + "TemplateId": d.Id(), + } + + if v, ok := d.GetOk("rest_version"); ok { + modifyMetricRuleTemplateReq["RestVersion"] = v + } + if !d.IsNewResource() && d.HasChange("alert_templates") { + update = true + if v, ok := d.GetOk("alert_templates"); ok { + alertTemplatesMaps := make([]map[string]interface{}, 0) + for _, alertTemplates := range v.(*schema.Set).List() { + alertTemplatesArg := alertTemplates.(map[string]interface{}) + alertTemplatesMap := map[string]interface{}{} + alertTemplatesMap["Category"] = alertTemplatesArg["category"] + if escalationsMaps, ok := alertTemplatesArg["escalations"]; ok { + escalationsMap := map[string]interface{}{} + for _, escalationsArg := range escalationsMaps.(*schema.Set).List() { + if criticalMaps, ok := escalationsArg.(map[string]interface{})["critical"]; ok { + requestCriticalArg := map[string]interface{}{} + for _, criticalMap := range criticalMaps.(*schema.Set).List() { + criticalArg := criticalMap.(map[string]interface{}) + requestCriticalArg["ComparisonOperator"] = criticalArg["comparison_operator"] + requestCriticalArg["Statistics"] = criticalArg["statistics"] + requestCriticalArg["Threshold"] = criticalArg["threshold"] + requestCriticalArg["Times"] = criticalArg["times"] + } + escalationsMap["Critical"] = requestCriticalArg + } + if infoMaps, ok := escalationsArg.(map[string]interface{})["info"]; ok { + requestInfoArg := map[string]interface{}{} + for _, infoMap := range infoMaps.(*schema.Set).List() { + infoArg := infoMap.(map[string]interface{}) + requestInfoArg["ComparisonOperator"] = infoArg["comparison_operator"] + requestInfoArg["Statistics"] = infoArg["statistics"] + requestInfoArg["Threshold"] = infoArg["threshold"] + requestInfoArg["Times"] = infoArg["times"] + } + escalationsMap["Info"] = requestInfoArg + } + if warnMaps, ok := escalationsArg.(map[string]interface{})["warn"]; ok { + requestWarnArg := map[string]interface{}{} + for _, warnMap := range warnMaps.(*schema.Set).List() { + warnArg := warnMap.(map[string]interface{}) + requestWarnArg["ComparisonOperator"] = warnArg["comparison_operator"] + requestWarnArg["Statistics"] = warnArg["statistics"] + requestWarnArg["Threshold"] = warnArg["threshold"] + requestWarnArg["Times"] = warnArg["times"] + } + escalationsMap["Warn"] = requestWarnArg + } + } + alertTemplatesMap["Escalations"] = escalationsMap + } + alertTemplatesMap["MetricName"] = alertTemplatesArg["metric_name"] + alertTemplatesMap["Namespace"] = alertTemplatesArg["namespace"] + alertTemplatesMap["RuleName"] = alertTemplatesArg["rule_name"] + alertTemplatesMap["Webhook"] = alertTemplatesArg["webhook"] + alertTemplatesMaps = append(alertTemplatesMaps, alertTemplatesMap) + } + modifyMetricRuleTemplateReq["AlertTemplates"] = alertTemplatesMaps + } + } + if !d.IsNewResource() && d.HasChange("description") { + update = true + if v, ok := d.GetOk("description"); ok { + modifyMetricRuleTemplateReq["Description"] = v + } + } + if !d.IsNewResource() && d.HasChange("metric_rule_template_name") { + update = true + modifyMetricRuleTemplateReq["Name"] = d.Get("metric_rule_template_name") + } + if update { + action := "ModifyMetricRuleTemplate" + conn, err := client.NewCmsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-01-01"), StringPointer("AK"), nil, modifyMetricRuleTemplateReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, modifyMetricRuleTemplateReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + d.SetPartial("rest_version") + d.SetPartial("alert_templates") + d.SetPartial("description") + d.SetPartial("metric_rule_template_name") + } + d.Partial(false) + return resourceAlicloudCmsMetricRuleTemplateRead(d, meta) +} +func resourceAlicloudCmsMetricRuleTemplateDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteMetricRuleTemplate" + var response map[string]interface{} + conn, err := client.NewCmsClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "TemplateId": d.Id(), + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if IsExpectedErrorCodes(fmt.Sprint(response["Code"]), []string{"ResourceNotFound"}) { + return nil + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cms_monitor_group.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cms_monitor_group.go index 8762a8bf859..c14b6fbdbe9 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cms_monitor_group.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cms_monitor_group.go @@ -30,26 +30,62 @@ func resourceAlicloudCmsMonitorGroup() *schema.Resource { }, "monitor_group_name": { Type: schema.TypeString, - Required: true, + Optional: true, + Computed: true, }, "tags": tagsSchema(), + "resource_group_id": { + Type: schema.TypeString, + Optional: true, + }, + "resource_group_name": { + Type: schema.TypeString, + Optional: true, + }, }, } } func resourceAlicloudCmsMonitorGroupCreate(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) + conn, err := client.NewCmsClient() var response map[string]interface{} - action := "CreateMonitorGroup" request := make(map[string]interface{}) - conn, err := client.NewCmsClient() + if v, exist := d.GetOk("resource_group_id"); exist { + action := "CreateMonitorGroupByResourceGroupId" + request["RegionId"] = client.RegionId + request["ResourceGroupId"] = v.(string) + request["ResourceGroupName"] = d.Get("resource_group_name") + for k, v := range d.Get("contact_groups").([]interface{}) { + request[fmt.Sprintf("ContactGroupList.%d", k+1)] = v.(string) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + addDebug(action, response, request) + return nil + }) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_cms_monitor_group", action, AlibabaCloudSdkGoERROR) + } + d.SetId(fmt.Sprint(response["Id"])) + return resourceAlicloudCmsMonitorGroupUpdate(d, meta) + } + + action := "CreateMonitorGroup" if err != nil { return WrapError(err) } if v, ok := d.GetOk("contact_groups"); ok && v != nil { request["ContactGroups"] = convertListToCommaSeparate(v.([]interface{})) } - request["GroupName"] = d.Get("monitor_group_name") wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { @@ -93,6 +129,7 @@ func resourceAlicloudCmsMonitorGroupRead(d *schema.ResourceData, meta interface{ contactGroups = append(contactGroups, contactGroup.(map[string]interface{})["Name"]) } } + d.Set("contact_groups", contactGroups) d.Set("monitor_group_name", object["GroupName"]) d.Set("tags", tagsToMap(object["Tags"].(map[string]interface{})["Tag"])) return nil @@ -111,7 +148,7 @@ func resourceAlicloudCmsMonitorGroupUpdate(d *schema.ResourceData, meta interfac update = true request["ContactGroups"] = convertListToCommaSeparate(d.Get("contact_groups").([]interface{})) } - if !d.IsNewResource() && d.HasChange("monitor_group_name") { + if d.HasChange("monitor_group_name") { update = true request["GroupName"] = d.Get("monitor_group_name") } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cms_monitor_group_instances.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cms_monitor_group_instances.go index 90c0eaec91b..85791e63b31 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cms_monitor_group_instances.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cms_monitor_group_instances.go @@ -114,21 +114,15 @@ func resourceAlicloudCmsMonitorGroupInstancesRead(d *schema.ResourceData, meta i } d.Set("group_id", d.Id()) - resourceMap := make([]map[string]interface{}, 0) - if resourceMapList, ok := object["Resources"].(map[string]interface{})["Resource"].([]interface{}); ok { - for _, v := range resourceMapList { - if m1, ok := v.(map[string]interface{}); ok { - temp1 := map[string]interface{}{ - "category": strings.ToLower(m1["Category"].(string)), - "instance_id": m1["InstanceId"], - "instance_name": m1["InstanceName"], - "region_id": m1["RegionId"], - } - resourceMap = append(resourceMap, temp1) - - } + for _, v := range object { + temp1 := map[string]interface{}{ + "category": strings.ToLower(v["Category"].(string)), + "instance_id": v["InstanceId"], + "instance_name": v["InstanceName"], + "region_id": v["RegionId"], } + resourceMap = append(resourceMap, temp1) } if err := d.Set("instances", resourceMap); err != nil { return WrapError(err) diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_config_aggregate_compliance_pack.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_config_aggregate_compliance_pack.go index 8287b96a4d5..883b62744f4 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_config_aggregate_compliance_pack.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_config_aggregate_compliance_pack.go @@ -29,7 +29,6 @@ func resourceAlicloudConfigAggregateCompliancePack() *schema.Resource { "aggregate_compliance_pack_name": { Type: schema.TypeString, Required: true, - ForceNew: true, }, "aggregator_id": { Type: schema.TypeString, @@ -38,26 +37,28 @@ func resourceAlicloudConfigAggregateCompliancePack() *schema.Resource { }, "compliance_pack_template_id": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "config_rules": { - Type: schema.TypeSet, - Required: true, + Type: schema.TypeSet, + Optional: true, + Deprecated: "Field 'config_rules' has been deprecated from provider version 1.141.0. New field 'config_rule_ids' instead.", + ConflictsWith: []string{"config_rule_ids"}, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "config_rule_parameters": { Type: schema.TypeSet, - Required: true, + Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "parameter_name": { Type: schema.TypeString, - Required: true, + Optional: true, }, "parameter_value": { Type: schema.TypeString, - Required: true, + Optional: true, }, }, }, @@ -69,6 +70,19 @@ func resourceAlicloudConfigAggregateCompliancePack() *schema.Resource { }, }, }, + "config_rule_ids": { + Type: schema.TypeSet, + Optional: true, + ConflictsWith: []string{"config_rules"}, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "config_rule_id": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, "description": { Type: schema.TypeString, Required: true, @@ -98,25 +112,38 @@ func resourceAlicloudConfigAggregateCompliancePackCreate(d *schema.ResourceData, } request["CompliancePackName"] = d.Get("aggregate_compliance_pack_name") request["AggregatorId"] = d.Get("aggregator_id") - request["CompliancePackTemplateId"] = d.Get("compliance_pack_template_id") + if v, ok := d.GetOk("compliance_pack_template_id"); ok { + request["CompliancePackTemplateId"] = v + } configRulesMaps := make([]map[string]interface{}, 0) - for _, configRules := range d.Get("config_rules").(*schema.Set).List() { - configRulesArg := configRules.(map[string]interface{}) - configRulesMap := map[string]interface{}{ - "ManagedRuleIdentifier": configRulesArg["managed_rule_identifier"], + if _, ok := d.GetOk("config_rules"); ok { + for _, configRules := range d.Get("config_rules").(*schema.Set).List() { + configRulesArg := configRules.(map[string]interface{}) + configRulesMap := map[string]interface{}{ + "ManagedRuleIdentifier": configRulesArg["managed_rule_identifier"], + } + configRuleParametersMaps := make([]map[string]interface{}, 0) + for _, configRuleParameters := range configRulesArg["config_rule_parameters"].(*schema.Set).List() { + configRuleParametersArg := configRuleParameters.(map[string]interface{}) + configRuleParametersMap := map[string]interface{}{ + "ParameterName": configRuleParametersArg["parameter_name"], + "ParameterValue": configRuleParametersArg["parameter_value"], + } + configRuleParametersMaps = append(configRuleParametersMaps, configRuleParametersMap) + } + configRulesMap["ConfigRuleParameters"] = configRuleParametersMaps + configRulesMaps = append(configRulesMaps, configRulesMap) } - configRuleParametersMaps := make([]map[string]interface{}, 0) - for _, configRuleParameters := range configRulesArg["config_rule_parameters"].(*schema.Set).List() { - configRuleParametersArg := configRuleParameters.(map[string]interface{}) - configRuleParametersMap := map[string]interface{}{ - "ParameterName": configRuleParametersArg["parameter_name"], - "ParameterValue": configRuleParametersArg["parameter_value"], + } else { + for _, configRuleIds := range d.Get("config_rule_ids").(*schema.Set).List() { + configRulesIdArg := configRuleIds.(map[string]interface{}) + configRuleIdMap := map[string]interface{}{ + "ConfigRuleId": configRulesIdArg["config_rule_id"], } - configRuleParametersMaps = append(configRuleParametersMaps, configRuleParametersMap) + configRulesMaps = append(configRulesMaps, configRuleIdMap) } - configRulesMap["ConfigRuleParameters"] = configRuleParametersMaps - configRulesMaps = append(configRulesMaps, configRulesMap) } + if v, err := convertArrayObjectToJsonString(configRulesMaps); err == nil { request["ConfigRules"] = v } else { @@ -145,7 +172,7 @@ func resourceAlicloudConfigAggregateCompliancePackCreate(d *schema.ResourceData, } d.SetId(fmt.Sprint(request["AggregatorId"], ":", response["CompliancePackId"])) - stateConf := BuildStateConf([]string{}, []string{"ACTIVE"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, configService.ConfigAggregateCompliancePackStateRefreshFunc(d.Id(), []string{"CREATING"})) + stateConf := BuildStateConf([]string{}, []string{"ACTIVE"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, configService.ConfigAggregateCompliancePackStateRefreshFunc(d.Id(), []string{})) if _, err := stateConf.WaitForState(); err != nil { return WrapErrorf(err, IdMsg, d.Id()) } @@ -172,33 +199,48 @@ func resourceAlicloudConfigAggregateCompliancePackRead(d *schema.ResourceData, m d.Set("aggregate_compliance_pack_name", object["CompliancePackName"]) d.Set("compliance_pack_template_id", object["CompliancePackTemplateId"]) - configRules := make([]map[string]interface{}, 0) - if configRulesList, ok := object["ConfigRules"].([]interface{}); ok { - for _, v := range configRulesList { - if m1, ok := v.(map[string]interface{}); ok { - temp1 := map[string]interface{}{ - "managed_rule_identifier": m1["ManagedRuleIdentifier"], - } - if m1["ConfigRuleParameters"] != nil { - configRuleParametersMaps := make([]map[string]interface{}, 0) - for _, configRuleParametersValue := range m1["ConfigRuleParameters"].([]interface{}) { - configRuleParameters := configRuleParametersValue.(map[string]interface{}) - configRuleParametersMap := map[string]interface{}{ - "parameter_name": configRuleParameters["ParameterName"], - "parameter_value": configRuleParameters["ParameterValue"], + if _, ok := d.GetOk("config_rules"); ok { + configRules := make([]map[string]interface{}, 0) + if configRulesList, ok := object["ConfigRules"].([]interface{}); ok { + for _, v := range configRulesList { + if m1, ok := v.(map[string]interface{}); ok { + temp1 := map[string]interface{}{ + "managed_rule_identifier": m1["ManagedRuleIdentifier"], + } + if m1["ConfigRuleParameters"] != nil { + configRuleParametersMaps := make([]map[string]interface{}, 0) + for _, configRuleParametersValue := range m1["ConfigRuleParameters"].([]interface{}) { + configRuleParameters := configRuleParametersValue.(map[string]interface{}) + configRuleParametersMap := map[string]interface{}{ + "parameter_name": configRuleParameters["ParameterName"], + "parameter_value": configRuleParameters["ParameterValue"], + } + configRuleParametersMaps = append(configRuleParametersMaps, configRuleParametersMap) } - configRuleParametersMaps = append(configRuleParametersMaps, configRuleParametersMap) + temp1["config_rule_parameters"] = configRuleParametersMaps } - temp1["config_rule_parameters"] = configRuleParametersMaps + configRules = append(configRules, temp1) + } - configRules = append(configRules, temp1) + } + } + d.Set("config_rules", configRules) + } else { + configRuleIds := make([]map[string]interface{}, 0) + if configRuleIdsList, ok := object["ConfigRules"].([]interface{}); ok { + for _, v := range configRuleIdsList { + if m1, ok := v.(map[string]interface{}); ok { + temp1 := map[string]interface{}{ + "config_rule_id": m1["ConfigRuleId"], + } + configRuleIds = append(configRuleIds, temp1) + } } } + d.Set("config_rule_ids", configRuleIds) } - if err := d.Set("config_rules", configRules); err != nil { - return WrapError(err) - } + d.Set("description", object["Description"]) d.Set("risk_level", formatInt(object["RiskLevel"])) d.Set("status", object["Status"]) @@ -208,6 +250,7 @@ func resourceAlicloudConfigAggregateCompliancePackUpdate(d *schema.ResourceData, client := meta.(*connectivity.AliyunClient) configService := ConfigService{client} var response map[string]interface{} + d.Partial(true) parts, err := ParseResourceId(d.Id(), 2) if err != nil { return WrapError(err) @@ -217,32 +260,38 @@ func resourceAlicloudConfigAggregateCompliancePackUpdate(d *schema.ResourceData, "CompliancePackId": parts[1], "AggregatorId": parts[0], } - if d.HasChange("config_rules") { - update = true - } - configRulesMaps := make([]map[string]interface{}, 0) - for _, configRules := range d.Get("config_rules").(*schema.Set).List() { - configRulesArg := configRules.(map[string]interface{}) - configRulesMap := map[string]interface{}{ - "ManagedRuleIdentifier": configRulesArg["managed_rule_identifier"], - } - configRuleParametersMaps := make([]map[string]interface{}, 0) - for _, configRuleParameters := range configRulesArg["config_rule_parameters"].(*schema.Set).List() { - configRuleParametersArg := configRuleParameters.(map[string]interface{}) - configRuleParametersMap := map[string]interface{}{ - "ParameterName": configRuleParametersArg["parameter_name"], - "ParameterValue": configRuleParametersArg["parameter_value"], + + if _, ok := d.GetOk("config_rules"); ok { + configRulesMaps := make([]map[string]interface{}, 0) + if d.HasChange("config_rules") { + update = true + for _, configRules := range d.Get("config_rules").(*schema.Set).List() { + configRulesArg := configRules.(map[string]interface{}) + configRulesMap := map[string]interface{}{ + "ConfigRuleName": configRulesArg["config_rule_name"], + "ManagedRuleIdentifier": configRulesArg["managed_rule_identifier"], + } + configRuleParametersMaps := make([]map[string]interface{}, 0) + for _, configRuleParameters := range configRulesArg["config_rule_parameters"].(*schema.Set).List() { + configRuleParametersArg := configRuleParameters.(map[string]interface{}) + configRuleParametersMap := map[string]interface{}{ + "ParameterName": configRuleParametersArg["parameter_name"], + "ParameterValue": configRuleParametersArg["parameter_value"], + } + configRuleParametersMaps = append(configRuleParametersMaps, configRuleParametersMap) + } + configRulesMap["ConfigRuleParameters"] = configRuleParametersMaps + configRulesMaps = append(configRulesMaps, configRulesMap) } - configRuleParametersMaps = append(configRuleParametersMaps, configRuleParametersMap) } - configRulesMap["ConfigRuleParameters"] = configRuleParametersMaps - configRulesMaps = append(configRulesMaps, configRulesMap) - } - if v, err := convertArrayObjectToJsonString(configRulesMaps); err == nil { - request["ConfigRules"] = v - } else { - return WrapError(err) + + if v, err := convertArrayObjectToJsonString(configRulesMaps); err == nil { + request["ConfigRules"] = v + } else { + return WrapError(err) + } } + if d.HasChange("description") { update = true } @@ -251,6 +300,11 @@ func resourceAlicloudConfigAggregateCompliancePackUpdate(d *schema.ResourceData, update = true } request["RiskLevel"] = d.Get("risk_level") + + if d.HasChange("aggregate_compliance_pack_name") { + update = true + } + request["CompliancePackName"] = d.Get("aggregate_compliance_pack_name") if update { action := "UpdateAggregateCompliancePack" conn, err := client.NewConfigClient() @@ -276,11 +330,108 @@ func resourceAlicloudConfigAggregateCompliancePackUpdate(d *schema.ResourceData, if err != nil { return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) } - stateConf := BuildStateConf([]string{}, []string{"ACTIVE"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, configService.ConfigAggregateCompliancePackStateRefreshFunc(d.Id(), []string{"CREATING"})) + stateConf := BuildStateConf([]string{}, []string{"ACTIVE"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, configService.ConfigAggregateCompliancePackStateRefreshFunc(d.Id(), []string{})) if _, err := stateConf.WaitForState(); err != nil { return WrapErrorf(err, IdMsg, d.Id()) } + + d.SetPartial("risk_level") + d.SetPartial("description") + d.SetPartial("config_rules") } + + if d.HasChange("config_rule_ids") { + + oraw, nraw := d.GetChange("config_rule_ids") + remove := oraw.(*schema.Set).Difference(nraw.(*schema.Set)).List() + create := nraw.(*schema.Set).Difference(oraw.(*schema.Set)).List() + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + + if len(remove) > 0 { + removeRulesReq := map[string]interface{}{ + "AggregatorId": parts[0], + "CompliancePackId": parts[1], + } + + ruleMaps := make([]interface{}, 0) + for _, rule := range remove { + ruleArg := rule.(map[string]interface{}) + ruleMaps = append(ruleMaps, ruleArg["config_rule_id"].(string)) + } + removeRulesReq["ConfigRuleIds"] = convertListToCommaSeparate(ruleMaps) + + action := "DetachAggregateConfigRuleToCompliancePack" + conn, err := client.NewConfigClient() + if err != nil { + return WrapError(err) + } + removeRulesReq["ClientToken"] = buildClientToken("DetachAggregateConfigRuleToCompliancePack") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-07"), StringPointer("AK"), nil, removeRulesReq, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, removeRulesReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + + if len(create) > 0 { + addRulesReq := map[string]interface{}{ + "AggregatorId": parts[0], + "CompliancePackId": parts[1], + } + + ruleMaps := make([]interface{}, 0) + for _, rule := range create { + ruleArg := rule.(map[string]interface{}) + ruleMaps = append(ruleMaps, ruleArg["config_rule_id"].(string)) + } + addRulesReq["ConfigRuleIds"] = convertListToCommaSeparate(ruleMaps) + + action := "AttachAggregateConfigRuleToCompliancePack" + conn, err := client.NewConfigClient() + if err != nil { + return WrapError(err) + } + addRulesReq["ClientToken"] = buildClientToken("AttachAggregateConfigRuleToCompliancePack") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-07"), StringPointer("AK"), nil, addRulesReq, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, addRulesReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + + d.SetPartial("config_rule_ids") + } + + d.Partial(false) return resourceAlicloudConfigAggregateCompliancePackRead(d, meta) } func resourceAlicloudConfigAggregateCompliancePackDelete(d *schema.ResourceData, meta interface{}) error { diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_config_aggregate_config_rule.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_config_aggregate_config_rule.go index e75528870ea..5038ee28bf7 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_config_aggregate_config_rule.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_config_aggregate_config_rule.go @@ -36,6 +36,10 @@ func resourceAlicloudConfigAggregateConfigRule() *schema.Resource { Required: true, ForceNew: true, }, + "config_rule_id": { + Type: schema.TypeString, + Computed: true, + }, "config_rule_trigger_types": { Type: schema.TypeString, Required: true, @@ -95,8 +99,10 @@ func resourceAlicloudConfigAggregateConfigRule() *schema.Resource { ValidateFunc: validation.StringInSlice([]string{"ALIYUN", "CUSTOM_FC"}, false), }, "status": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"ACTIVE", "INACTIVE"}, false), + Computed: true, }, "tag_key_scope": { Type: schema.TypeString, @@ -112,7 +118,6 @@ func resourceAlicloudConfigAggregateConfigRule() *schema.Resource { func resourceAlicloudConfigAggregateConfigRuleCreate(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) - configService := ConfigService{client} var response map[string]interface{} action := "CreateAggregateConfigRule" request := make(map[string]interface{}) @@ -176,12 +181,8 @@ func resourceAlicloudConfigAggregateConfigRuleCreate(d *schema.ResourceData, met } d.SetId(fmt.Sprint(request["AggregatorId"], ":", response["ConfigRuleId"])) - stateConf := BuildStateConf([]string{}, []string{"ACTIVE"}, d.Timeout(schema.TimeoutCreate), 10*time.Second, configService.ConfigAggregateConfigRuleStateRefreshFunc(d.Id(), []string{})) - if _, err := stateConf.WaitForState(); err != nil { - return WrapErrorf(err, IdMsg, d.Id()) - } - return resourceAlicloudConfigAggregateConfigRuleRead(d, meta) + return resourceAlicloudConfigAggregateConfigRuleUpdate(d, meta) } func resourceAlicloudConfigAggregateConfigRuleRead(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) @@ -200,6 +201,7 @@ func resourceAlicloudConfigAggregateConfigRuleRead(d *schema.ResourceData, meta return WrapError(err) } d.Set("aggregator_id", parts[0]) + d.Set("config_rule_id", parts[1]) d.Set("aggregate_config_rule_name", object["ConfigRuleName"]) d.Set("config_rule_trigger_types", object["ConfigRuleTriggerTypes"]) d.Set("description", object["Description"]) @@ -220,6 +222,7 @@ func resourceAlicloudConfigAggregateConfigRuleRead(d *schema.ResourceData, meta func resourceAlicloudConfigAggregateConfigRuleUpdate(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) configService := ConfigService{client} + d.Partial(true) var response map[string]interface{} parts, err := ParseResourceId(d.Id(), 2) if err != nil { @@ -230,27 +233,27 @@ func resourceAlicloudConfigAggregateConfigRuleUpdate(d *schema.ResourceData, met "AggregatorId": parts[0], "ConfigRuleId": parts[1], } - if d.HasChange("config_rule_trigger_types") { + if !d.IsNewResource() && d.HasChange("config_rule_trigger_types") { update = true } request["ConfigRuleTriggerTypes"] = d.Get("config_rule_trigger_types") - if d.HasChange("resource_types_scope") { + if !d.IsNewResource() && d.HasChange("resource_types_scope") { update = true } request["ResourceTypesScope"] = convertListToCommaSeparate(d.Get("resource_types_scope").([]interface{})) - if d.HasChange("risk_level") { + if !d.IsNewResource() && d.HasChange("risk_level") { update = true } request["RiskLevel"] = d.Get("risk_level") - if d.HasChange("description") { + if !d.IsNewResource() && d.HasChange("description") { update = true request["Description"] = d.Get("description") } - if d.HasChange("exclude_resource_ids_scope") { + if !d.IsNewResource() && d.HasChange("exclude_resource_ids_scope") { update = true request["ExcludeResourceIdsScope"] = d.Get("exclude_resource_ids_scope") } - if d.HasChange("input_parameters") { + if !d.IsNewResource() && d.HasChange("input_parameters") { update = true if v, err := convertMaptoJsonString(d.Get("input_parameters").(map[string]interface{})); err == nil { request["InputParameters"] = v @@ -258,23 +261,23 @@ func resourceAlicloudConfigAggregateConfigRuleUpdate(d *schema.ResourceData, met return WrapError(err) } } - if d.HasChange("maximum_execution_frequency") { + if !d.IsNewResource() && d.HasChange("maximum_execution_frequency") { update = true request["MaximumExecutionFrequency"] = d.Get("maximum_execution_frequency") } - if d.HasChange("region_ids_scope") { + if !d.IsNewResource() && d.HasChange("region_ids_scope") { update = true request["RegionIdsScope"] = d.Get("region_ids_scope") } - if d.HasChange("resource_group_ids_scope") { + if !d.IsNewResource() && d.HasChange("resource_group_ids_scope") { update = true request["ResourceGroupIdsScope"] = d.Get("resource_group_ids_scope") } - if d.HasChange("tag_key_scope") { + if !d.IsNewResource() && d.HasChange("tag_key_scope") { update = true request["TagKeyScope"] = d.Get("tag_key_scope") } - if d.HasChange("tag_value_scope") { + if !d.IsNewResource() && d.HasChange("tag_value_scope") { update = true request["TagValueScope"] = d.Get("tag_value_scope") } @@ -303,11 +306,40 @@ func resourceAlicloudConfigAggregateConfigRuleUpdate(d *schema.ResourceData, met if err != nil { return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) } - stateConf := BuildStateConf([]string{}, []string{"ACTIVE"}, d.Timeout(schema.TimeoutUpdate), 10*time.Second, configService.ConfigAggregateConfigRuleStateRefreshFunc(d.Id(), []string{})) - if _, err := stateConf.WaitForState(); err != nil { - return WrapErrorf(err, IdMsg, d.Id()) + } + update = false + if d.HasChange("status") { + update = true + } + if update { + configService := ConfigService{client} + object, err := configService.DescribeConfigAggregateConfigRule(d.Id()) + if err != nil { + return WrapError(err) + } + target := d.Get("status").(string) + if value, exist := object["ConfigRuleState"]; exist && value.(string) != target { + if target == "ACTIVE" { + err := configService.ActiveAggregateConfigRules(parts[1], parts[0]) + if err != nil { + return WrapError(err) + } + } + if target == "INACTIVE" { + err := configService.DeactiveAggregateConfigRules(parts[1], parts[0]) + if err != nil { + return WrapError(err) + } + } } + d.SetPartial("status") } + d.Partial(false) + stateConf := BuildStateConf([]string{}, []string{"ACTIVE", "INACTIVE"}, d.Timeout(schema.TimeoutCreate), 10*time.Second, configService.ConfigAggregateConfigRuleStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return resourceAlicloudConfigAggregateConfigRuleRead(d, meta) } func resourceAlicloudConfigAggregateConfigRuleDelete(d *schema.ResourceData, meta interface{}) error { diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_config_aggregator.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_config_aggregator.go index 9a85ee7d5bf..89f7abf5fce 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_config_aggregator.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_config_aggregator.go @@ -27,7 +27,8 @@ func resourceAlicloudConfigAggregator() *schema.Resource { Schema: map[string]*schema.Schema{ "aggregator_accounts": { Type: schema.TypeSet, - Required: true, + Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "account_id": { @@ -119,7 +120,7 @@ func resourceAlicloudConfigAggregatorCreate(d *schema.ResourceData, meta interfa } d.SetId(fmt.Sprint(response["AggregatorId"])) - stateConf := BuildStateConf([]string{}, []string{"1"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, configService.ConfigAggregatorStateRefreshFunc(d.Id(), []string{"0"})) + stateConf := BuildStateConf([]string{}, []string{"1"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, configService.ConfigAggregatorStateRefreshFunc(d.Id(), []string{})) if _, err := stateConf.WaitForState(); err != nil { return WrapErrorf(err, IdMsg, d.Id()) } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_config_compliance_pack.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_config_compliance_pack.go index a7c903bfbc2..3cf05c242d0 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_config_compliance_pack.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_config_compliance_pack.go @@ -29,26 +29,27 @@ func resourceAlicloudConfigCompliancePack() *schema.Resource { "compliance_pack_name": { Type: schema.TypeString, Required: true, - ForceNew: true, }, "compliance_pack_template_id": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "config_rules": { - Type: schema.TypeSet, - Required: true, + Type: schema.TypeSet, + Optional: true, + Deprecated: "Field 'config_rules' has been deprecated from provider version 1.141.0. New field 'config_rule_ids' instead.", + ConflictsWith: []string{"config_rule_ids"}, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "config_rule_parameters": { Type: schema.TypeSet, - Required: true, + Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "parameter_name": { Type: schema.TypeString, - Required: true, + Optional: true, }, "parameter_value": { Type: schema.TypeString, @@ -64,6 +65,20 @@ func resourceAlicloudConfigCompliancePack() *schema.Resource { }, }, }, + "config_rule_ids": { + Type: schema.TypeSet, + Optional: true, + ConflictsWith: []string{"config_rules"}, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "config_rule_id": { + Type: schema.TypeString, + + Optional: true, + }, + }, + }, + }, "description": { Type: schema.TypeString, Required: true, @@ -92,25 +107,39 @@ func resourceAlicloudConfigCompliancePackCreate(d *schema.ResourceData, meta int return WrapError(err) } request["CompliancePackName"] = d.Get("compliance_pack_name") - request["CompliancePackTemplateId"] = d.Get("compliance_pack_template_id") + if v, ok := d.GetOk("compliance_pack_template_id"); ok { + request["CompliancePackTemplateId"] = v + } + configRulesMaps := make([]map[string]interface{}, 0) - for _, configRules := range d.Get("config_rules").(*schema.Set).List() { - configRulesArg := configRules.(map[string]interface{}) - configRulesMap := map[string]interface{}{ - "ManagedRuleIdentifier": configRulesArg["managed_rule_identifier"], + if _, ok := d.GetOk("config_rules"); ok { + for _, configRules := range d.Get("config_rules").(*schema.Set).List() { + configRulesArg := configRules.(map[string]interface{}) + configRulesMap := map[string]interface{}{ + "ManagedRuleIdentifier": configRulesArg["managed_rule_identifier"], + } + configRuleParametersMaps := make([]map[string]interface{}, 0) + for _, configRuleParameters := range configRulesArg["config_rule_parameters"].(*schema.Set).List() { + configRuleParametersArg := configRuleParameters.(map[string]interface{}) + configRuleParametersMap := map[string]interface{}{ + "ParameterName": configRuleParametersArg["parameter_name"], + "ParameterValue": configRuleParametersArg["parameter_value"], + } + configRuleParametersMaps = append(configRuleParametersMaps, configRuleParametersMap) + } + configRulesMap["ConfigRuleParameters"] = configRuleParametersMaps + configRulesMaps = append(configRulesMaps, configRulesMap) } - configRuleParametersMaps := make([]map[string]interface{}, 0) - for _, configRuleParameters := range configRulesArg["config_rule_parameters"].(*schema.Set).List() { - configRuleParametersArg := configRuleParameters.(map[string]interface{}) - configRuleParametersMap := map[string]interface{}{ - "ParameterName": configRuleParametersArg["parameter_name"], - "ParameterValue": configRuleParametersArg["parameter_value"], + } else { + for _, configRuleIds := range d.Get("config_rule_ids").(*schema.Set).List() { + configRulesIdArg := configRuleIds.(map[string]interface{}) + configRuleIdMap := map[string]interface{}{ + "ConfigRuleId": configRulesIdArg["config_rule_id"], } - configRuleParametersMaps = append(configRuleParametersMaps, configRuleParametersMap) + configRulesMaps = append(configRulesMaps, configRuleIdMap) } - configRulesMap["ConfigRuleParameters"] = configRuleParametersMaps - configRulesMaps = append(configRulesMaps, configRulesMap) } + if v, err := convertArrayObjectToJsonString(configRulesMaps); err == nil { request["ConfigRules"] = v } else { @@ -125,7 +154,7 @@ func resourceAlicloudConfigCompliancePackCreate(d *schema.ResourceData, meta int err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-07"), StringPointer("AK"), nil, request, &runtime) if err != nil { - if IsExpectedErrors(err, []string{"ServiceUnavailable"}) || NeedRetry(err) { + if NeedRetry(err) { wait() return resource.RetryableError(err) } @@ -139,7 +168,7 @@ func resourceAlicloudConfigCompliancePackCreate(d *schema.ResourceData, meta int } d.SetId(fmt.Sprint(response["CompliancePackId"])) - stateConf := BuildStateConf([]string{}, []string{"ACTIVE"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, configService.ConfigCompliancePackStateRefreshFunc(d.Id(), []string{"CREATING"})) + stateConf := BuildStateConf([]string{}, []string{"ACTIVE"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, configService.ConfigCompliancePackStateRefreshFunc(d.Id(), []string{})) if _, err := stateConf.WaitForState(); err != nil { return WrapErrorf(err, IdMsg, d.Id()) } @@ -161,33 +190,46 @@ func resourceAlicloudConfigCompliancePackRead(d *schema.ResourceData, meta inter d.Set("compliance_pack_name", object["CompliancePackName"]) d.Set("compliance_pack_template_id", object["CompliancePackTemplateId"]) - configRules := make([]map[string]interface{}, 0) - if configRulesList, ok := object["ConfigRules"].([]interface{}); ok { - for _, v := range configRulesList { - if m1, ok := v.(map[string]interface{}); ok { - temp1 := map[string]interface{}{ - "managed_rule_identifier": m1["ManagedRuleIdentifier"], - } - if m1["ConfigRuleParameters"] != nil { - configRuleParametersMaps := make([]map[string]interface{}, 0) - for _, configRuleParametersValue := range m1["ConfigRuleParameters"].([]interface{}) { - configRuleParameters := configRuleParametersValue.(map[string]interface{}) - configRuleParametersMap := map[string]interface{}{ - "parameter_name": configRuleParameters["ParameterName"], - "parameter_value": configRuleParameters["ParameterValue"], + if _, ok := d.GetOk("config_rules"); ok { + configRules := make([]map[string]interface{}, 0) + if configRulesList, ok := object["ConfigRules"].([]interface{}); ok { + for _, v := range configRulesList { + if m1, ok := v.(map[string]interface{}); ok { + temp1 := map[string]interface{}{ + "managed_rule_identifier": m1["ManagedRuleIdentifier"], + } + if m1["ConfigRuleParameters"] != nil { + configRuleParametersMaps := make([]map[string]interface{}, 0) + for _, configRuleParametersValue := range m1["ConfigRuleParameters"].([]interface{}) { + configRuleParameters := configRuleParametersValue.(map[string]interface{}) + configRuleParametersMap := map[string]interface{}{ + "parameter_name": configRuleParameters["ParameterName"], + "parameter_value": configRuleParameters["ParameterValue"], + } + configRuleParametersMaps = append(configRuleParametersMaps, configRuleParametersMap) } - configRuleParametersMaps = append(configRuleParametersMaps, configRuleParametersMap) + temp1["config_rule_parameters"] = configRuleParametersMaps } - temp1["config_rule_parameters"] = configRuleParametersMaps + configRules = append(configRules, temp1) } - configRules = append(configRules, temp1) - } } + d.Set("config_rules", configRules) + } else { + configRuleIds := make([]map[string]interface{}, 0) + if configRuleIdsList, ok := object["ConfigRules"].([]interface{}); ok { + for _, v := range configRuleIdsList { + if m1, ok := v.(map[string]interface{}); ok { + temp1 := map[string]interface{}{ + "config_rule_id": m1["ConfigRuleId"], + } + configRuleIds = append(configRuleIds, temp1) + } + } + } + d.Set("config_rule_ids", configRuleIds) } - if err := d.Set("config_rules", configRules); err != nil { - return WrapError(err) - } + d.Set("description", object["Description"]) d.Set("risk_level", formatInt(object["RiskLevel"])) d.Set("status", object["Status"]) @@ -197,37 +239,44 @@ func resourceAlicloudConfigCompliancePackUpdate(d *schema.ResourceData, meta int client := meta.(*connectivity.AliyunClient) configService := ConfigService{client} var response map[string]interface{} + d.Partial(true) + update := false request := map[string]interface{}{ "CompliancePackId": d.Id(), } - if d.HasChange("config_rules") { - update = true - } - configRulesMaps := make([]map[string]interface{}, 0) - for _, configRules := range d.Get("config_rules").(*schema.Set).List() { - configRulesArg := configRules.(map[string]interface{}) - configRulesMap := map[string]interface{}{ - "ConfigRuleName": configRulesArg["config_rule_name"], - "ManagedRuleIdentifier": configRulesArg["managed_rule_identifier"], - } - configRuleParametersMaps := make([]map[string]interface{}, 0) - for _, configRuleParameters := range configRulesArg["config_rule_parameters"].(*schema.Set).List() { - configRuleParametersArg := configRuleParameters.(map[string]interface{}) - configRuleParametersMap := map[string]interface{}{ - "ParameterName": configRuleParametersArg["parameter_name"], - "ParameterValue": configRuleParametersArg["parameter_value"], + + if _, ok := d.GetOk("config_rules"); ok { + configRulesMaps := make([]map[string]interface{}, 0) + if d.HasChange("config_rules") { + update = true + for _, configRules := range d.Get("config_rules").(*schema.Set).List() { + configRulesArg := configRules.(map[string]interface{}) + configRulesMap := map[string]interface{}{ + "ConfigRuleName": configRulesArg["config_rule_name"], + "ManagedRuleIdentifier": configRulesArg["managed_rule_identifier"], + } + configRuleParametersMaps := make([]map[string]interface{}, 0) + for _, configRuleParameters := range configRulesArg["config_rule_parameters"].(*schema.Set).List() { + configRuleParametersArg := configRuleParameters.(map[string]interface{}) + configRuleParametersMap := map[string]interface{}{ + "ParameterName": configRuleParametersArg["parameter_name"], + "ParameterValue": configRuleParametersArg["parameter_value"], + } + configRuleParametersMaps = append(configRuleParametersMaps, configRuleParametersMap) + } + configRulesMap["ConfigRuleParameters"] = configRuleParametersMaps + configRulesMaps = append(configRulesMaps, configRulesMap) } - configRuleParametersMaps = append(configRuleParametersMaps, configRuleParametersMap) } - configRulesMap["ConfigRuleParameters"] = configRuleParametersMaps - configRulesMaps = append(configRulesMaps, configRulesMap) - } - if v, err := convertArrayObjectToJsonString(configRulesMaps); err == nil { - request["ConfigRules"] = v - } else { - return WrapError(err) + + if v, err := convertArrayObjectToJsonString(configRulesMaps); err == nil { + request["ConfigRules"] = v + } else { + return WrapError(err) + } } + if d.HasChange("description") { update = true } @@ -236,6 +285,10 @@ func resourceAlicloudConfigCompliancePackUpdate(d *schema.ResourceData, meta int update = true } request["RiskLevel"] = d.Get("risk_level") + if !d.IsNewResource() && d.HasChange("compliance_pack_name") { + update = true + } + request["CompliancePackName"] = d.Get("compliance_pack_name") if update { action := "UpdateCompliancePack" conn, err := client.NewConfigClient() @@ -261,11 +314,102 @@ func resourceAlicloudConfigCompliancePackUpdate(d *schema.ResourceData, meta int if err != nil { return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) } - stateConf := BuildStateConf([]string{}, []string{"ACTIVE"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, configService.ConfigCompliancePackStateRefreshFunc(d.Id(), []string{"CREATING"})) + stateConf := BuildStateConf([]string{}, []string{"ACTIVE"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, configService.ConfigCompliancePackStateRefreshFunc(d.Id(), []string{})) if _, err := stateConf.WaitForState(); err != nil { return WrapErrorf(err, IdMsg, d.Id()) } + + d.SetPartial("risk_level") + d.SetPartial("description") + d.SetPartial("config_rules") } + + if d.HasChange("config_rule_ids") { + + oraw, nraw := d.GetChange("config_rule_ids") + remove := oraw.(*schema.Set).Difference(nraw.(*schema.Set)).List() + create := nraw.(*schema.Set).Difference(oraw.(*schema.Set)).List() + + if len(remove) > 0 { + removeRulesReq := map[string]interface{}{ + "CompliancePackId": d.Id(), + } + + ruleMaps := make([]interface{}, 0) + for _, rule := range remove { + ruleArg := rule.(map[string]interface{}) + ruleMaps = append(ruleMaps, ruleArg["config_rule_id"].(string)) + } + removeRulesReq["ConfigRuleIds"] = convertListToCommaSeparate(ruleMaps) + + action := "DetachConfigRuleToCompliancePack" + conn, err := client.NewConfigClient() + if err != nil { + return WrapError(err) + } + removeRulesReq["ClientToken"] = buildClientToken("DetachConfigRuleToCompliancePack") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-07"), StringPointer("AK"), nil, removeRulesReq, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, removeRulesReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + + if len(create) > 0 { + addRulesReq := map[string]interface{}{ + "CompliancePackId": d.Id(), + } + + ruleMaps := make([]interface{}, 0) + for _, rule := range create { + ruleArg := rule.(map[string]interface{}) + ruleMaps = append(ruleMaps, ruleArg["config_rule_id"].(string)) + } + addRulesReq["ConfigRuleIds"] = convertListToCommaSeparate(ruleMaps) + + action := "AttachConfigRuleToCompliancePack" + conn, err := client.NewConfigClient() + if err != nil { + return WrapError(err) + } + addRulesReq["ClientToken"] = buildClientToken("AttachConfigRuleToCompliancePack") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-07"), StringPointer("AK"), nil, addRulesReq, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, addRulesReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + + d.SetPartial("config_rule_ids") + } + + d.Partial(false) return resourceAlicloudConfigCompliancePackRead(d, meta) } func resourceAlicloudConfigCompliancePackDelete(d *schema.ResourceData, meta interface{}) error { diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_config_configuration_recorder.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_config_configuration_recorder.go index e677f68026a..79ba5987453 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_config_configuration_recorder.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_config_configuration_recorder.go @@ -27,7 +27,7 @@ func resourceAlicloudConfigConfigurationRecorder() *schema.Resource { Type: schema.TypeBool, Optional: true, ForceNew: true, - Default: false, + Computed: true, }, "organization_enable_status": { Type: schema.TypeString, diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_config_rule.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_config_rule.go index 2aa56bc9871..ec67124423f 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_config_rule.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_config_rule.go @@ -139,8 +139,10 @@ func resourceAlicloudConfigRule() *schema.Resource { ValidateFunc: validation.StringInSlice([]string{"ALIYUN", "CUSTOM_FC"}, false), }, "status": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"ACTIVE", "INACTIVE"}, false), + Computed: true, }, "tag_key_scope": { Type: schema.TypeString, @@ -156,7 +158,6 @@ func resourceAlicloudConfigRule() *schema.Resource { func resourceAlicloudConfigRuleCreate(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) - configService := ConfigService{client} var response map[string]interface{} action := "CreateConfigRule" request := make(map[string]interface{}) @@ -233,12 +234,8 @@ func resourceAlicloudConfigRuleCreate(d *schema.ResourceData, meta interface{}) } d.SetId(fmt.Sprint(response["ConfigRuleId"])) - stateConf := BuildStateConf([]string{}, []string{"ACTIVE"}, d.Timeout(schema.TimeoutCreate), 10*time.Second, configService.ConfigRuleStateRefreshFunc(d.Id(), []string{})) - if _, err := stateConf.WaitForState(); err != nil { - return WrapErrorf(err, IdMsg, d.Id()) - } - return resourceAlicloudConfigRuleRead(d, meta) + return resourceAlicloudConfigRuleUpdate(d, meta) } func resourceAlicloudConfigRuleRead(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) @@ -277,12 +274,16 @@ func resourceAlicloudConfigRuleRead(d *schema.ResourceData, meta interface{}) er func resourceAlicloudConfigRuleUpdate(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) configService := ConfigService{client} + d.Partial(true) var response map[string]interface{} update := false request := map[string]interface{}{ "ConfigRuleId": d.Id(), } - if d.HasChange("config_rule_trigger_types") || d.HasChange("source_detail_message_type") { + if !d.IsNewResource() && (d.HasChange("config_rule_trigger_types") || d.HasChange("source_detail_message_type")) { + update = true + } + if !d.IsNewResource() && (d.HasChange("config_rule_trigger_types") || d.HasChange("source_detail_message_type")) { update = true } if _, ok := d.GetOk("config_rule_trigger_types"); ok { @@ -290,7 +291,7 @@ func resourceAlicloudConfigRuleUpdate(d *schema.ResourceData, meta interface{}) } else { request["ConfigRuleTriggerTypes"] = d.Get("source_detail_message_type") } - if d.HasChange("resource_types_scope") || d.HasChange("scope_compliance_resource_types") { + if !d.IsNewResource() && (d.HasChange("resource_types_scope") || d.HasChange("scope_compliance_resource_types")) { update = true } if _, ok := d.GetOk("resource_types_scope"); ok { @@ -298,19 +299,19 @@ func resourceAlicloudConfigRuleUpdate(d *schema.ResourceData, meta interface{}) } else { request["ResourceTypesScope"] = convertListToCommaSeparate(d.Get("scope_compliance_resource_types").([]interface{})) } - if d.HasChange("risk_level") { + if !d.IsNewResource() && d.HasChange("risk_level") { update = true } request["RiskLevel"] = d.Get("risk_level") - if d.HasChange("description") { + if !d.IsNewResource() && d.HasChange("description") { update = true request["Description"] = d.Get("description") } - if d.HasChange("exclude_resource_ids_scope") { + if !d.IsNewResource() && d.HasChange("exclude_resource_ids_scope") { update = true request["ExcludeResourceIdsScope"] = d.Get("exclude_resource_ids_scope") } - if d.HasChange("input_parameters") { + if !d.IsNewResource() && d.HasChange("input_parameters") { update = true if v, err := convertMaptoJsonString(d.Get("input_parameters").(map[string]interface{})); err == nil { request["InputParameters"] = v @@ -318,7 +319,7 @@ func resourceAlicloudConfigRuleUpdate(d *schema.ResourceData, meta interface{}) return WrapError(err) } } - if d.HasChange("maximum_execution_frequency") || d.HasChange("source_maximum_execution_frequency") { + if !d.IsNewResource() && d.HasChange("maximum_execution_frequency") || d.HasChange("source_maximum_execution_frequency") { update = true if _, ok := d.GetOk("maximum_execution_frequency"); ok { request["MaximumExecutionFrequency"] = d.Get("maximum_execution_frequency") @@ -326,19 +327,19 @@ func resourceAlicloudConfigRuleUpdate(d *schema.ResourceData, meta interface{}) request["MaximumExecutionFrequency"] = d.Get("source_maximum_execution_frequency") } } - if d.HasChange("region_ids_scope") { + if !d.IsNewResource() && d.HasChange("region_ids_scope") { update = true request["RegionIdsScope"] = d.Get("region_ids_scope") } - if d.HasChange("resource_group_ids_scope") { + if !d.IsNewResource() && d.HasChange("resource_group_ids_scope") { update = true request["ResourceGroupIdsScope"] = d.Get("resource_group_ids_scope") } - if d.HasChange("tag_key_scope") { + if !d.IsNewResource() && d.HasChange("tag_key_scope") { update = true request["TagKeyScope"] = d.Get("tag_key_scope") } - if d.HasChange("tag_value_scope") { + if !d.IsNewResource() && d.HasChange("tag_value_scope") { update = true request["TagValueScope"] = d.Get("tag_value_scope") } @@ -372,6 +373,39 @@ func resourceAlicloudConfigRuleUpdate(d *schema.ResourceData, meta interface{}) return WrapErrorf(err, IdMsg, d.Id()) } } + + update = false + if d.HasChange("status") { + update = true + } + if update { + configService := ConfigService{client} + object, err := configService.DescribeConfigRule(d.Id()) + if err != nil { + return WrapError(err) + } + target := d.Get("status").(string) + if value, exist := object["ConfigRuleState"]; exist && value.(string) != target { + if target == "ACTIVE" { + err := configService.ActiveConfigRule(d.Id()) + if err != nil { + return WrapError(err) + } + } + if target == "INACTIVE" { + err := configService.StopConfigRule(d.Id()) + if err != nil { + return WrapError(err) + } + } + } + d.SetPartial("status") + } + d.Partial(false) + stateConf := BuildStateConf([]string{}, []string{"ACTIVE", "INACTIVE"}, d.Timeout(schema.TimeoutCreate), 10*time.Second, configService.ConfigRuleStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } return resourceAlicloudConfigRuleRead(d, meta) } func resourceAlicloudConfigRuleDelete(d *schema.ResourceData, meta interface{}) error { diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cr_chart_namespace.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cr_chart_namespace.go new file mode 100644 index 00000000000..9db101ee403 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cr_chart_namespace.go @@ -0,0 +1,195 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudCrChartNamespace() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudCrChartNamespaceCreate, + Read: resourceAlicloudCrChartNamespaceRead, + Update: resourceAlicloudCrChartNamespaceUpdate, + Delete: resourceAlicloudCrChartNamespaceDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "auto_create_repo": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "default_repo_type": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"PRIVATE", "PUBLIC"}, false), + }, + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "namespace_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudCrChartNamespaceCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateChartNamespace" + request := make(map[string]interface{}) + conn, err := client.NewAcrClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOkExists("auto_create_repo"); ok { + request["AutoCreateRepo"] = v + } + if v, ok := d.GetOk("default_repo_type"); ok { + request["DefaultRepoType"] = v + } + request["InstanceId"] = d.Get("instance_id") + request["NamespaceName"] = d.Get("namespace_name") + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-12-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_cr_chart_namespace", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["InstanceId"], ":", request["NamespaceName"])) + return resourceAlicloudCrChartNamespaceRead(d, meta) +} +func resourceAlicloudCrChartNamespaceRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + crService := CrService{client} + object, err := crService.DescribeCrChartNamespace(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_cr_chart_namespace crService.DescribeCrChartNamespace Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Set("instance_id", parts[0]) + d.Set("namespace_name", parts[1]) + d.Set("auto_create_repo", object["AutoCreateRepo"]) + d.Set("default_repo_type", object["DefaultRepoType"]) + return nil +} +func resourceAlicloudCrChartNamespaceUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + conn, err := client.NewAcrClient() + if err != nil { + return WrapError(err) + } + var response map[string]interface{} + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + update := false + request := map[string]interface{}{ + "InstanceId": parts[0], + "NamespaceName": parts[1], + } + request["RegionId"] = client.RegionId + if d.HasChange("auto_create_repo") { + update = true + if v, ok := d.GetOkExists("auto_create_repo"); ok { + request["AutoCreateRepo"] = v + } + } + if d.HasChange("default_repo_type") { + update = true + if v, ok := d.GetOk("default_repo_type"); ok { + request["DefaultRepoType"] = v + } + } + if update { + action := "UpdateChartNamespace" + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-12-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudCrChartNamespaceRead(d, meta) +} +func resourceAlicloudCrChartNamespaceDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + action := "DeleteChartNamespace" + var response map[string]interface{} + conn, err := client.NewAcrClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "InstanceId": parts[0], + "NamespaceName": parts[1], + } + + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-12-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cr_chart_repository.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cr_chart_repository.go new file mode 100644 index 00000000000..a8db9e5302b --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cr_chart_repository.go @@ -0,0 +1,204 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudCrChartRepository() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudCrChartRepositoryCreate, + Read: resourceAlicloudCrChartRepositoryRead, + Update: resourceAlicloudCrChartRepositoryUpdate, + Delete: resourceAlicloudCrChartRepositoryDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "repo_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "repo_namespace_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "repo_type": { + Type: schema.TypeString, + Computed: true, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"PRIVATE", "PUBLIC"}, false), + }, + "summary": { + Type: schema.TypeString, + Optional: true, + }, + }, + } +} + +func resourceAlicloudCrChartRepositoryCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateChartRepository" + request := make(map[string]interface{}) + conn, err := client.NewAcrClient() + if err != nil { + return WrapError(err) + } + request["InstanceId"] = d.Get("instance_id") + request["RepoName"] = d.Get("repo_name") + request["RepoNamespaceName"] = d.Get("repo_namespace_name") + if v, ok := d.GetOk("repo_type"); ok { + request["RepoType"] = v + } + if v, ok := d.GetOk("summary"); ok { + request["Summary"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-12-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_cr_chart_repository", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["InstanceId"], ":", request["RepoNamespaceName"], ":", request["RepoName"])) + + return resourceAlicloudCrChartRepositoryRead(d, meta) +} +func resourceAlicloudCrChartRepositoryRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + crService := CrService{client} + object, err := crService.DescribeCrChartRepository(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_cr_chart_repository crService.DescribeCrChartRepository Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + d.Set("repo_name", parts[2]) + d.Set("repo_namespace_name", parts[1]) + d.Set("instance_id", parts[0]) + d.Set("repo_type", object["RepoType"]) + d.Set("summary", object["Summary"]) + return nil +} +func resourceAlicloudCrChartRepositoryUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + conn, err := client.NewAcrClient() + if err != nil { + return WrapError(err) + } + var response map[string]interface{} + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + update := false + request := map[string]interface{}{ + "RepoName": parts[2], + "RepoNamespaceName": parts[1], + "InstanceId": parts[0], + } + + if d.HasChange("repo_type") { + update = true + } + if v, ok := d.GetOk("repo_type"); ok { + request["RepoType"] = v + } + if d.HasChange("summary") { + update = true + if v, ok := d.GetOk("summary"); ok { + request["Summary"] = v + } + } + if update { + action := "UpdateChartRepository" + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-12-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudCrChartRepositoryRead(d, meta) +} +func resourceAlicloudCrChartRepositoryDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + action := "DeleteChartRepository" + var response map[string]interface{} + conn, err := client.NewAcrClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "RepoName": parts[2], + "RepoNamespaceName": parts[1], + "InstanceId": parts[0], + } + + request["InstanceId"] = d.Get("instance_id") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-12-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cr_ee_instance.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cr_ee_instance.go index 6d9f48b6318..554f907376a 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cr_ee_instance.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cr_ee_instance.go @@ -158,7 +158,8 @@ func resourceAlicloudCrEEInstanceCreate(d *schema.ResourceData, meta interface{} // if account site is international, should route to ap-southeast-1 if serverErr, ok := errCreate.(*errors.ServerError); ok && serverErr.ErrorCode() == "NotApplicable" { request.RegionId = "ap-southeast-1" - request.Domain = "" + request.Domain = "business.ap-southeast-1.aliyuncs.com" + request.ProductType = "acr_ee_public_intl" resp, errCreate = bssopenapiClient.CreateInstance(request) } } @@ -218,7 +219,8 @@ func resourceAlicloudCrEEInstanceRead(d *schema.ResourceData, meta interface{}) if regionRedirect { // if account site is international, should route to ap-southeast-1 request.RegionId = "ap-southeast-1" - request.Domain = "" + request.Domain = "business.ap-southeast-1.aliyuncs.com" + request.ProductType = "acr_ee_public_intl" resp, errQuery = bssopenapiClient.QueryAvailableInstances(request) } return resp, errQuery diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cr_endpoint_acl_policy.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cr_endpoint_acl_policy.go new file mode 100644 index 00000000000..43f0f0d196c --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cr_endpoint_acl_policy.go @@ -0,0 +1,159 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudCrEndpointAclPolicy() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudCrEndpointAclPolicyCreate, + Read: resourceAlicloudCrEndpointAclPolicyRead, + Delete: resourceAlicloudCrEndpointAclPolicyDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(10 * time.Minute), + Delete: schema.DefaultTimeout(10 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "description": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "endpoint_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"internet"}, false), + }, + "entry": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "module_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Registry"}, false), + }, + }, + } +} + +func resourceAlicloudCrEndpointAclPolicyCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateInstanceEndpointAclPolicy" + request := make(map[string]interface{}) + conn, err := client.NewAcrClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("description"); ok { + request["Comment"] = v + } + request["EndpointType"] = d.Get("endpoint_type") + request["Entry"] = d.Get("entry") + request["InstanceId"] = d.Get("instance_id") + if v, ok := d.GetOk("module_name"); ok { + request["ModuleName"] = v + } + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-12-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"SLB_SERVICE_ERROR"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_cr_instance_endpoint_acl_policy", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["InstanceId"], ":", request["EndpointType"], ":", request["Entry"])) + + return resourceAlicloudCrEndpointAclPolicyRead(d, meta) +} +func resourceAlicloudCrEndpointAclPolicyRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + crService := CrService{client} + object, err := crService.DescribeCrEndpointAclPolicy(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_cr_instance_endpoint_acl_policy crService.DescribeCrEndpointAclPolicy Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + d.Set("endpoint_type", parts[1]) + d.Set("entry", parts[2]) + d.Set("instance_id", parts[0]) + d.Set("description", object["Comment"]) + return nil +} +func resourceAlicloudCrEndpointAclPolicyDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + action := "DeleteInstanceEndpointAclPolicy" + var response map[string]interface{} + conn, err := client.NewAcrClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "EndpointType": parts[1], + "Entry": parts[2], + "InstanceId": parts[0], + } + + if v, ok := d.GetOk("module_name"); ok { + request["ModuleName"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-12-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"SLB_SERVICE_ERROR"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cs_edge_kubernetes.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cs_edge_kubernetes.go index a09a5aef4c9..07493fa7f64 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cs_edge_kubernetes.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cs_edge_kubernetes.go @@ -269,6 +269,7 @@ func resourceAlicloudCSEdgeKubernetes() *schema.Resource { "resource_group_id": { Type: schema.TypeString, Optional: true, + Computed: true, }, // computed parameters start "certificate_authority": { @@ -392,6 +393,13 @@ func resourceAlicloudCSEdgeKubernetes() *schema.Resource { Type: schema.TypeMap, Optional: true, }, + "retain_resources": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, }, } } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cs_kubernetes.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cs_kubernetes.go index 6794af05c35..233d372be45 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cs_kubernetes.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cs_kubernetes.go @@ -9,6 +9,9 @@ import ( "strings" "time" + roacs "github.com/alibabacloud-go/cs-20151215/v2/client" + "github.com/alibabacloud-go/tea/tea" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" @@ -752,6 +755,13 @@ func resourceAlicloudCSKubernetes() *schema.Resource { Optional: true, Computed: true, }, + "retain_resources": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, }, } } @@ -1365,33 +1375,23 @@ func resourceAlicloudCSKubernetesRead(d *schema.ResourceData, meta interface{}) } func resourceAlicloudCSKubernetesDelete(d *schema.ResourceData, meta interface{}) error { - client := meta.(*connectivity.AliyunClient) - csService := CsService{client} - invoker := NewInvoker() + csService := CsService{meta.(*connectivity.AliyunClient)} + client, err := meta.(*connectivity.AliyunClient).NewRoaCsClient() + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, ResourceName, "InitializeClient", err) + } - var response interface{} - err := resource.Retry(30*time.Minute, func() *resource.RetryError { - if err := invoker.Run(func() error { - raw, err := client.WithCsClient(func(csClient *cs.Client) (interface{}, error) { - return nil, csClient.DeleteKubernetesCluster(d.Id()) - }) - response = raw - return err - }); err != nil { - return resource.RetryableError(err) - } - if debugOn() { - requestMap := make(map[string]interface{}) - requestMap["ClusterId"] = d.Id() - addDebug("DeleteCluster", response, d.Id(), requestMap) - } - return nil - }) + args := &roacs.DeleteClusterRequest{} + if v := d.Get("retain_resources"); len(v.([]interface{})) > 0 { + args.RetainResources = tea.StringSlice(expandStringList(v.([]interface{}))) + } + + _, err = client.DeleteCluster(tea.String(d.Id()), args) if err != nil { if IsExpectedErrors(err, []string{"ErrorClusterNotFound"}) { return nil } - return WrapErrorf(err, DefaultErrorMsg, d.Id(), "DeleteCluster", DenverdinoAliyungo) + return WrapErrorf(err, DefaultErrorMsg, ResourceName, "DeleteCluster", AliyunTablestoreGoSdk) } stateConf := BuildStateConf([]string{"running", "deleting"}, []string{}, d.Timeout(schema.TimeoutDelete), 10*time.Second, csService.CsKubernetesInstanceStateRefreshFunc(d.Id(), []string{})) @@ -1679,6 +1679,19 @@ func buildKubernetesArgs(d *schema.ResourceData, meta interface{}) (*cs.Delicate creationArgs.MaintenanceWindow = expandMaintenanceWindowConfig(v.([]interface{})) } + // Configure control plane log. Effective only in the professional managed cluster + if v, ok := d.GetOk("control_plane_log_components"); ok { + creationArgs.ControlplaneComponents = expandStringList(v.([]interface{})) + // ttl default is 30 days + creationArgs.ControlplaneLogTTL = "30" + } + if v, ok := d.GetOk("control_plane_log_ttl"); ok { + creationArgs.ControlplaneLogTTL = v.(string) + } + if v, ok := d.GetOk("control_plane_log_project"); ok { + creationArgs.ControlplaneLogProject = v.(string) + } + return creationArgs, nil } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cs_kubernetes_addon.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cs_kubernetes_addon.go new file mode 100644 index 00000000000..5a5e5f633a8 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cs_kubernetes_addon.go @@ -0,0 +1,178 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +const ResourceAlicloudCSKubernetesAddon = "resourceAlicloudCSKubernetesAddon" + +func resourceAlicloudCSKubernetesAddon() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudCSKubernetesAddonCreate, + Read: resourceAlicloudCSKubernetesAddonRead, + Update: resourceAlicloudCSKubernetesAddonUpdate, + Delete: resourceAlicloudCSKubernetesAddonDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(10 * time.Minute), + Update: schema.DefaultTimeout(10 * time.Minute), + Delete: schema.DefaultTimeout(10 * time.Minute), + }, + + Schema: map[string]*schema.Schema{ + "cluster_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "version": { + Type: schema.TypeString, + Required: true, + }, + "next_version": { + Type: schema.TypeString, + Computed: true, + }, + "can_upgrade": { + Type: schema.TypeBool, + Computed: true, + }, + "required": { + Type: schema.TypeBool, + Computed: true, + }, + }, + } +} + +func resourceAlicloudCSKubernetesAddonRead(d *schema.ResourceData, meta interface{}) error { + client, err := meta.(*connectivity.AliyunClient).NewRoaCsClient() + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, ResourceAlicloudCSKubernetesAddon, "InitializeClient", err) + } + csClient := CsClient{client} + + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + + addon, err := csClient.DescribeCsKubernetesAddon(d.Id()) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, ResourceAlicloudCSKubernetesAddon, "DescribeCsKubernetesAddon", err) + } + + d.Set("cluster_id", parts[0]) + d.Set("name", addon.ComponentName) + d.Set("version", addon.Version) + d.Set("next_version", addon.NextVersion) + d.Set("can_upgrade", addon.CanUpgrade) + d.Set("required", addon.Required) + + return nil +} + +func resourceAlicloudCSKubernetesAddonCreate(d *schema.ResourceData, meta interface{}) error { + clusterId := d.Get("cluster_id").(string) + name := d.Get("name").(string) + version := d.Get("version").(string) + + client, err := meta.(*connectivity.AliyunClient).NewRoaCsClient() + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, ResourceAlicloudCSKubernetesAddon, "InitializeClient", err) + } + csClient := CsClient{client} + + status, err := csClient.DescribeCsKubernetesAddonStatus(clusterId, name) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, ResourceAlicloudCSKubernetesAddon, "DescribeCsKubernetesAddonStatus", err) + } + + changed := false + + if status.Version == "" { + // Addon not installed + changed = true + err := csClient.installAddon(d) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, ResourceAlicloudCSKubernetesAddon, "installAddon", err) + } + } else if status.Version != "" && status.Version != version { + // Addon has been installed + changed = true + err := csClient.upgradeAddon(d) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, ResourceAlicloudCSKubernetesAddon, "upgradeAddon", err) + } + } + + d.SetId(fmt.Sprintf("%s%s%s", clusterId, COLON_SEPARATED, name)) + + stateConf := BuildStateConf([]string{"running", "Upgrading", "Pause"}, []string{"Success"}, d.Timeout(schema.TimeoutCreate), 10*time.Second, csClient.CsKubernetesAddonStateRefreshFunc(clusterId, name, []string{"Failed", "Canceled"})) + if changed { + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, DefaultErrorMsg, ResourceAlicloudCSKubernetesAddon, "WaitForSuccessAfterCreate", d.Id()) + } + } + return resourceAlicloudCSKubernetesAddonRead(d, meta) +} + +func resourceAlicloudCSKubernetesAddonUpdate(d *schema.ResourceData, meta interface{}) error { + client, err := meta.(*connectivity.AliyunClient).NewRoaCsClient() + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, ResourceAlicloudCSKubernetesAddon, "InitializeClient", err) + } + csClient := CsClient{client} + + if d.HasChange("version") { + clusterId := d.Get("cluster_id").(string) + name := d.Get("name").(string) + + err := csClient.upgradeAddon(d) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, ResourceAlicloudCSKubernetesAddon, "upgradeAddon", err) + } + + stateConf := BuildStateConf([]string{"running", "Upgrading", "Pause"}, []string{"Success"}, d.Timeout(schema.TimeoutUpdate), 10*time.Second, csClient.CsKubernetesAddonStateRefreshFunc(clusterId, name, []string{"Failed", "Canceled"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, DefaultErrorMsg, ResourceAlicloudCSKubernetesAddon, "WaitForSuccessAfterUpdate", d.Id()) + } + } + + return resourceAlicloudCSKubernetesAddonRead(d, meta) +} + +func resourceAlicloudCSKubernetesAddonDelete(d *schema.ResourceData, meta interface{}) error { + clusterId := d.Get("cluster_id").(string) + name := d.Get("name").(string) + + client, err := meta.(*connectivity.AliyunClient).NewRoaCsClient() + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, ResourceAlicloudCSKubernetesAddon, "InitializeClient", err) + } + csClient := CsClient{client} + + err = csClient.uninstallAddon(d) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, ResourceAlicloudCSKubernetesAddon, "uninstallAddon", err) + } + + stateConf := BuildStateConf([]string{"running", "Upgrading", "Pause"}, []string{"Success"}, d.Timeout(schema.TimeoutDelete), 10*time.Second, csClient.CsKubernetesAddonStateRefreshFunc(clusterId, name, []string{"Failed", "Canceled"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, DefaultErrorMsg, ResourceAlicloudCSKubernetesAddon, "WaitForSuccessAfterDelete", d.Id()) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cs_kubernetes_node_pool.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cs_kubernetes_node_pool.go index 63640c1ffee..6dc82f71c30 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cs_kubernetes_node_pool.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cs_kubernetes_node_pool.go @@ -3,6 +3,7 @@ package alicloud import ( "encoding/base64" "fmt" + "log" "regexp" "time" @@ -88,9 +89,10 @@ func resourceAlicloudCSKubernetesNodePool() *schema.Resource { ConflictsWith: []string{"password", "key_name"}, }, "security_group_id": { - Type: schema.TypeString, - Optional: true, - Computed: true, + Type: schema.TypeString, + Optional: true, + Computed: true, + Deprecated: "Field 'security_group_id' has been deprecated from provider version 1.145.0. New field 'security_group_ids' instead", }, "system_disk_category": { Type: schema.TypeString, @@ -114,6 +116,7 @@ func resourceAlicloudCSKubernetesNodePool() *schema.Resource { Optional: true, Computed: true, ValidateFunc: validation.StringInSlice([]string{"AliyunLinux", "Windows", "CentOS", "WindowsCore"}, false), + Deprecated: "Field 'platform' has been deprecated from provider version 1.145.0. New field 'image_type' instead", }, "image_id": { Type: schema.TypeString, @@ -298,7 +301,6 @@ func resourceAlicloudCSKubernetesNodePool() *schema.Resource { "scaling_config": { Type: schema.TypeList, Optional: true, - Computed: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -405,6 +407,39 @@ func resourceAlicloudCSKubernetesNodePool() *schema.Resource { Optional: true, Computed: true, }, + "security_group_ids": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + MaxItems: 5, + Computed: true, + }, + "image_type": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"AliyunLinux", "AliyunLinux3", "AliyunLinux3Arm64", "AliyunLinuxUEFI", "CentOS", "Windows", "WindowsCore", "AliyunLinux Qboot", "ContainerOS"}, false), + }, + "runtime_name": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + }, + "runtime_version": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + }, + "deployment_set_id": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + }, }, } } @@ -539,14 +574,16 @@ func resourceAlicloudCSNodePoolUpdate(d *schema.ResourceData, meta interface{}) } } + if v, ok := d.GetOk("install_cloud_monitor"); ok && v != nil { + args.CmsEnabled = v.(bool) + } if d.HasChange("install_cloud_monitor") { update = true args.CmsEnabled = d.Get("install_cloud_monitor").(bool) } - if d.HasChange("unschedulable") { - update = true - args.Unschedulable = d.Get("unschedulable").(bool) + if v, ok := d.GetOk("unschedulable"); ok { + args.Unschedulable = v.(bool) } if d.HasChange("instance_types") { @@ -617,6 +654,14 @@ func resourceAlicloudCSNodePoolUpdate(d *schema.ResourceData, meta interface{}) args.KubernetesConfig.NodeNameMode = d.Get("node_name_mode").(string) } + if v, ok := d.GetOk("user_data"); ok && v != nil { + _, base64DecodeError := base64.StdEncoding.DecodeString(v.(string)) + if base64DecodeError == nil { + args.KubernetesConfig.UserData = v.(string) + } else { + args.KubernetesConfig.UserData = base64.StdEncoding.EncodeToString([]byte(v.(string))) + } + } if d.HasChange("user_data") { update = true if v := d.Get("user_data").(string); v != "" { @@ -629,6 +674,9 @@ func resourceAlicloudCSNodePoolUpdate(d *schema.ResourceData, meta interface{}) } } + if v, ok := d.GetOk("scaling_config"); ok && v != nil { + args.AutoScaling = setAutoScalingConfig(v.([]interface{})) + } if d.HasChange("scaling_config") { update = true if v, ok := d.GetOk("scaling_config"); ok { @@ -692,7 +740,7 @@ func resourceAlicloudCSNodePoolUpdate(d *schema.ResourceData, meta interface{}) addDebug("UpdateKubernetesNodePool", resoponse, resizeRequestMap) } - stateConf := BuildStateConf([]string{"scaling", "updating"}, []string{"active"}, d.Timeout(schema.TimeoutUpdate), 30*time.Second, csService.CsKubernetesNodePoolStateRefreshFunc(d.Id(), []string{"deleting", "failed"})) + stateConf := BuildStateConf([]string{"scaling", "updating"}, []string{"active"}, d.Timeout(schema.TimeoutUpdate), 10*time.Second, csService.CsKubernetesNodePoolStateRefreshFunc(d.Id(), []string{"deleting", "failed"})) if _, err := stateConf.WaitForState(); err != nil { return WrapErrorf(err, IdMsg, d.Id()) @@ -718,6 +766,21 @@ func resourceAlicloudCSNodePoolUpdate(d *schema.ResourceData, meta interface{}) } } + _ = resource.Retry(10*time.Minute, func() *resource.RetryError { + log.Printf("[DEBUG] Start retry fetch node pool info: %s", d.Id()) + nodePoolDetail, err := csService.DescribeCsKubernetesNodePool(d.Id()) + if err != nil { + return resource.NonRetryableError(err) + } + + if nodePoolDetail.TotalNodes != d.Get("node_count").(int) { + time.Sleep(20 * time.Second) + return resource.RetryableError(Error("[ERROR] The number of nodes is inconsistent %s", d.Id())) + } + + return resource.NonRetryableError(Error("[DEBUG] The number of nodes is the same")) + }) + update = false d.Partial(false) return resourceAlicloudCSNodePoolRead(d, meta) @@ -759,6 +822,11 @@ func resourceAlicloudCSNodePoolRead(d *schema.ResourceData, meta interface{}) er d.Set("internet_charge_type", object.InternetChargeType) d.Set("internet_max_bandwidth_out", object.InternetMaxBandwidthOut) d.Set("install_cloud_monitor", object.CmsEnabled) + d.Set("image_type", object.ScalingGroup.ImageType) + d.Set("security_group_ids", object.ScalingGroup.SecurityGroupIds) + d.Set("runtime_name", object.Runtime) + d.Set("runtime_version", object.RuntimeVersion) + d.Set("deployment_set_id", object.DeploymentSetId) if object.InstanceChargeType == "PrePaid" { d.Set("period", object.Period) d.Set("period_unit", object.PeriodUnit) @@ -929,6 +997,10 @@ func buildNodePoolArgs(d *schema.ResourceData, meta interface{}) (*cs.CreateNode } } + if v, ok := d.GetOk("deployment_set_id"); ok { + creationArgs.DeploymentSetId = v.(string) + } + if v, ok := d.GetOk("install_cloud_monitor"); ok { creationArgs.CmsEnabled = v.(bool) } @@ -987,6 +1059,22 @@ func buildNodePoolArgs(d *schema.ResourceData, meta interface{}) (*cs.CreateNode creationArgs.InternetMaxBandwidthOut = v.(int) } + if v, ok := d.GetOk("security_group_ids"); ok { + creationArgs.SecurityGroupIds = expandStringList(v.([]interface{})) + } + + if v, ok := d.GetOk("image_type"); ok { + creationArgs.ImageType = v.(string) + } + + if v, ok := d.GetOk("runtime_name"); ok { + creationArgs.Runtime = v.(string) + } + + if v, ok := d.GetOk("runtime_version"); ok { + creationArgs.RuntimeVersion = v.(string) + } + return creationArgs, nil } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cs_managed_kubernetes.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cs_managed_kubernetes.go index e1875de1c30..f29c14d25a4 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cs_managed_kubernetes.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cs_managed_kubernetes.go @@ -16,10 +16,6 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) -const ( - ManagedKubernetesCreationDefaultTimeoutInMinute = 60 -) - func resourceAlicloudCSManagedKubernetes() *schema.Resource { return &schema.Resource{ Create: resourceAlicloudCSManagedKubernetesCreate, @@ -656,6 +652,32 @@ func resourceAlicloudCSManagedKubernetes() *schema.Resource { }, }, }, + "control_plane_log_ttl": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "control_plane_log_project": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "control_plane_log_components": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + MinItems: 1, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "retain_resources": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, }, } } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cs_serverless_kubernetes.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cs_serverless_kubernetes.go index 33b8e7d2aac..f9462621349 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cs_serverless_kubernetes.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_cs_serverless_kubernetes.go @@ -5,6 +5,9 @@ import ( "regexp" "time" + roacs "github.com/alibabacloud-go/cs-20151215/v2/client" + "github.com/alibabacloud-go/tea/tea" + util "github.com/alibabacloud-go/tea-utils/service" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" @@ -205,6 +208,13 @@ func resourceAlicloudCSServerlessKubernetes() *schema.Resource { Computed: true, ForceNew: true, }, + "retain_resources": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, }, } } @@ -350,6 +360,11 @@ func resourceAlicloudCSServerlessKubernetesRead(d *schema.ResourceData, meta int client := meta.(*connectivity.AliyunClient) csService := CsService{client} invoker := NewInvoker() + rosClient, err := client.NewRoaCsClient() + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, ResourceName, "InitializeClient", err) + } + object, err := csService.DescribeCsServerlessKubernetes(d.Id()) if err != nil { if NotFoundError(err) { @@ -359,9 +374,18 @@ func resourceAlicloudCSServerlessKubernetesRead(d *schema.ResourceData, meta int return WrapError(err) } + vswitchIds := []string{} + resources, _ := rosClient.DescribeClusterResources(tea.String(d.Id())) + for _, resource := range resources.Body { + if tea.StringValue(resource.ResourceType) == "VSWITCH" { + vswitchIds = append(vswitchIds, tea.StringValue(resource.InstanceId)) + } + } + d.Set("name", object.Name) d.Set("vpc_id", object.VpcId) d.Set("vswitch_id", object.VSwitchId) + d.Set("vswitch_ids", vswitchIds) d.Set("security_group_id", object.SecurityGroupId) d.Set("deletion_protection", object.DeletionProtection) d.Set("version", object.CurrentVersion) @@ -467,25 +491,23 @@ func resourceAlicloudCSServerlessKubernetesUpdate(d *schema.ResourceData, meta i } func resourceAlicloudCSServerlessKubernetesDelete(d *schema.ResourceData, meta interface{}) error { - client := meta.(*connectivity.AliyunClient) - csService := CsService{client} - var requestInfo *cs.Client - invoker := NewInvoker() - var response interface{} + csService := CsService{meta.(*connectivity.AliyunClient)} + client, err := meta.(*connectivity.AliyunClient).NewRoaCsClient() + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, ResourceName, "InitializeClient", err) + } - if err := invoker.Run(func() error { - raw, err := client.WithCsClient(func(csClient *cs.Client) (interface{}, error) { - return nil, csClient.DeleteCluster(d.Id()) - }) - response = raw - return err - }); err != nil { - return WrapErrorf(err, DefaultErrorMsg, d.Id(), "DeleteCluster", DenverdinoAliyungo) + args := &roacs.DeleteClusterRequest{} + if v := d.Get("retain_resources"); len(v.([]interface{})) > 0 { + args.RetainResources = tea.StringSlice(expandStringList(v.([]interface{}))) } - if debugOn() { - requestMap := make(map[string]interface{}) - requestMap["ClusterId"] = d.Id() - addDebug("DeleteCluster", response, requestInfo, requestMap) + + _, err = client.DeleteCluster(tea.String(d.Id()), args) + if err != nil { + if IsExpectedErrors(err, []string{"ErrorClusterNotFound"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, ResourceName, "DeleteCluster", AliyunTablestoreGoSdk) } stateConf := BuildStateConf([]string{"running", "deleting"}, []string{}, d.Timeout(schema.TimeoutDelete), 30*time.Second, csService.CsServerlessKubernetesInstanceStateRefreshFunc(d.Id(), []string{})) diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_database_gateway_gateway.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_database_gateway_gateway.go new file mode 100644 index 00000000000..1772f6658a2 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_database_gateway_gateway.go @@ -0,0 +1,172 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudDatabaseGatewayGateway() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudDatabaseGatewayGatewayCreate, + Read: resourceAlicloudDatabaseGatewayGatewayRead, + Update: resourceAlicloudDatabaseGatewayGatewayUpdate, + Delete: resourceAlicloudDatabaseGatewayGatewayDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "gateway_desc": { + Type: schema.TypeString, + Optional: true, + }, + "gateway_name": { + Type: schema.TypeString, + Required: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudDatabaseGatewayGatewayCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateGateway" + request := make(map[string]interface{}) + conn, err := client.NewDgClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("gateway_desc"); ok { + request["GatewayDesc"] = v + } + request["GatewayName"] = d.Get("gateway_name") + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-03-27"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_database_gateway_gateway", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + + d.SetId(fmt.Sprint(response["Data"])) + + return resourceAlicloudDatabaseGatewayGatewayRead(d, meta) +} +func resourceAlicloudDatabaseGatewayGatewayRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + dgService := DgService{client} + object, err := dgService.DescribeDatabaseGatewayGateway(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_database_gateway_gateway dgService.DescribeDatabaseGatewayGateway Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("gateway_desc", object["gatewayDesc"]) + d.Set("gateway_name", object["gatewayName"]) + d.Set("status", object["status"]) + return nil +} +func resourceAlicloudDatabaseGatewayGatewayUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "GatewayId": d.Id(), + } + if d.HasChange("gateway_desc") { + update = true + } + if v, ok := d.GetOk("gateway_desc"); ok { + request["GatewayDesc"] = v + } + if d.HasChange("gateway_name") { + update = true + } + request["GatewayName"] = d.Get("gateway_name") + if update { + action := "ModifyGateway" + conn, err := client.NewDgClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-03-27"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + } + return resourceAlicloudDatabaseGatewayGatewayRead(d, meta) +} +func resourceAlicloudDatabaseGatewayGatewayDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteGateway" + var response map[string]interface{} + conn, err := client.NewDgClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "GatewayId": d.Id(), + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-03-27"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_db_backup_policy.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_db_backup_policy.go index ace1febd99f..715f1e4d242 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_db_backup_policy.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_db_backup_policy.go @@ -167,6 +167,12 @@ func resourceAlicloudDBBackupPolicy() *schema.Resource { Optional: true, DiffSuppressFunc: enableBackupLogDiffSuppressFunc, }, + "released_keep_policy": { + Type: schema.TypeString, + ValidateFunc: validation.StringInSlice([]string{"None", "Lastest", "All"}, false), + Optional: true, + Computed: true, + }, }, } } @@ -202,6 +208,7 @@ func resourceAlicloudDBBackupPolicyRead(d *schema.ResourceData, meta interface{} d.Set("log_backup_retention_period", formatInt(object["LogBackupRetentionPeriod"])) d.Set("local_log_retention_hours", formatInt(object["LocalLogRetentionHours"])) d.Set("local_log_retention_space", formatInt(object["LocalLogRetentionSpace"])) + d.Set("released_keep_policy", object["ReleasedKeepPolicy"]) instance, err := rdsService.DescribeDBInstance(d.Id()) if err != nil { if NotFoundError(err) { @@ -233,7 +240,7 @@ func resourceAlicloudDBBackupPolicyUpdate(d *schema.ResourceData, meta interface if d.HasChange("backup_period") || d.HasChange("backup_time") || d.HasChange("retention_period") || d.HasChange("preferred_backup_period") || d.HasChange("preferred_backup_time") || d.HasChange("backup_retention_period") || d.HasChange("compress_type") || d.HasChange("log_backup_frequency") || d.HasChange("archive_backup_retention_period") || - d.HasChange("archive_backup_keep_count") || d.HasChange("archive_backup_keep_policy") { + d.HasChange("archive_backup_keep_count") || d.HasChange("archive_backup_keep_policy") || d.HasChange("released_keep_policy") { updateForData = true } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_db_instance.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_db_instance.go index 57780e19f7a..d1c0e0e5c22 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_db_instance.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_db_instance.go @@ -98,6 +98,12 @@ func resourceAlicloudDBInstance() *schema.Resource { Computed: true, }, + "db_time_zone": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "vswitch_id": { Type: schema.TypeString, ForceNew: true, @@ -281,6 +287,7 @@ func resourceAlicloudDBInstance() *schema.Resource { "zone_id_slave_a": { Type: schema.TypeString, Optional: true, + Computed: true, ForceNew: true, }, "zone_id_slave_b": { @@ -384,6 +391,15 @@ func resourceAlicloudDBInstance() *schema.Resource { return true }, }, + "released_keep_policy": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"None", "Lastest", "All"}, false), + }, + "fresh_white_list_readins": { + Type: schema.TypeString, + Optional: true, + }, }, } } @@ -895,6 +911,9 @@ func resourceAlicloudDBInstanceUpdate(d *schema.ResourceData, meta interface{}) if v, ok := d.GetOk("modify_mode"); ok && v.(string) != "" { request["ModifyMode"] = v } + if v, ok := d.GetOk("fresh_white_list_readins"); ok && v.(string) != "" { + request["FreshWhiteListReadins"] = v + } var response map[string]interface{} wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { @@ -913,7 +932,7 @@ func resourceAlicloudDBInstanceUpdate(d *schema.ResourceData, meta interface{}) return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) } addDebug(action, response, request) - stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutUpdate), 3*time.Minute, rdsService.RdsDBInstanceStateRefreshFunc(d.Id(), []string{"Deleting"})) + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutUpdate), 1*time.Second, rdsService.RdsDBInstanceStateRefreshFunc(d.Id(), []string{"Deleting"})) if _, err := stateConf.WaitForState(); err != nil { return WrapErrorf(err, IdMsg, d.Id()) } @@ -1163,7 +1182,12 @@ func resourceAlicloudDBInstanceRead(d *schema.ResourceData, meta interface{}) er return WrapError(err) } - ips, err := rdsService.GetSecurityIps(d.Id()) + dbInstanceIpArrayName := "default" + if v, ok := d.GetOk("db_instance_ip_array_name"); ok { + dbInstanceIpArrayName = v.(string) + } + + ips, err := rdsService.GetSecurityIps(d.Id(), dbInstanceIpArrayName) if err != nil { return WrapError(err) } @@ -1255,7 +1279,9 @@ func resourceAlicloudDBInstanceRead(d *schema.ResourceData, meta interface{}) er if err = rdsService.RefreshParameters(d, "parameters"); err != nil { return WrapError(err) } - + if err = rdsService.SetTimeZone(d); err != nil { + return WrapError(err) + } if instance["PayType"] == string(Prepaid) { action := "DescribeInstanceAutoRenewalAttribute" request := map[string]interface{}{ @@ -1291,8 +1317,10 @@ func resourceAlicloudDBInstanceRead(d *schema.ResourceData, meta interface{}) er if err != nil { return WrapError(err) } - d.Set("security_group_id", strings.Join(groups, COMMA_SEPARATED)) - d.Set("security_group_ids", groups) + if len(groups) > 0 { + d.Set("security_group_id", strings.Join(groups, COMMA_SEPARATED)) + d.Set("security_group_ids", groups) + } sslAction, err := rdsService.DescribeDBInstanceSSL(d.Id()) if err != nil && !IsExpectedErrors(err, []string{"InvaildEngineInRegion.ValueNotSupported", "InstanceEngineType.NotSupport", "OperationDenied.DBInstanceType"}) { @@ -1344,6 +1372,9 @@ func resourceAlicloudDBInstanceDelete(d *schema.ResourceData, meta interface{}) "DBInstanceId": d.Id(), "SourceIp": client.SourceIp, } + if v, ok := d.GetOk("released_keep_policy"); ok && v.(string) != "" { + request["ReleasedKeepPolicy"] = v + } conn, err := client.NewRdsClient() if err != nil { return WrapError(err) @@ -1471,6 +1502,10 @@ func buildDBCreateRequest(d *schema.ResourceData, meta interface{}) (map[string] request["ZoneIdSlave2"] = v } + if v, ok := d.GetOk("db_time_zone"); ok { + request["DBTimeZone"] = v + } + uuid, err := uuid.GenerateUUID() if err != nil { uuid = resource.UniqueId() diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dbfs_instance.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dbfs_instance.go new file mode 100644 index 00000000000..b6606032fc3 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dbfs_instance.go @@ -0,0 +1,521 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudDbfsInstance() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudDbfsInstanceCreate, + Read: resourceAlicloudDbfsInstanceRead, + Update: resourceAlicloudDbfsInstanceUpdate, + Delete: resourceAlicloudDbfsInstanceDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(5 * time.Minute), + Update: schema.DefaultTimeout(15 * time.Minute), + Delete: schema.DefaultTimeout(5 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "attach_mode": { + Type: schema.TypeString, + Optional: true, + }, + "attach_point": { + Type: schema.TypeString, + Optional: true, + }, + "category": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"standard"}, false), + }, + "delete_snapshot": { + Type: schema.TypeBool, + Optional: true, + }, + "ecs_list": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "ecs_id": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "enable_raid": { + Type: schema.TypeBool, + Optional: true, + ForceNew: true, + }, + "encryption": { + Type: schema.TypeBool, + Optional: true, + ForceNew: true, + }, + "instance_name": { + Type: schema.TypeString, + Required: true, + }, + "kms_key_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "performance_level": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"PL0", "PL1", "PL2", "PL3"}, false), + }, + "raid_stripe_unit_number": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "size": { + Type: schema.TypeInt, + Required: true, + }, + "snapshot_id": { + Type: schema.TypeString, + Optional: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "tags": tagsSchema(), + "used_scene": { + Type: schema.TypeString, + Optional: true, + }, + "zone_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudDbfsInstanceCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateDbfs" + request := make(map[string]interface{}) + conn, err := client.NewDbfsClient() + if err != nil { + return WrapError(err) + } + request["Category"] = d.Get("category") + if v, ok := d.GetOkExists("delete_snapshot"); ok { + request["DeleteSnapshot"] = v + } + if v, ok := d.GetOkExists("enable_raid"); ok { + request["EnableRaid"] = v + } + if v, ok := d.GetOkExists("encryption"); ok { + request["Encryption"] = v + } + request["FsName"] = d.Get("instance_name") + if v, ok := d.GetOk("kms_key_id"); ok { + request["KMSKeyId"] = v + } + if v, ok := d.GetOk("performance_level"); ok { + request["PerformanceLevel"] = v + } + if v, ok := d.GetOk("raid_stripe_unit_number"); ok { + request["RaidStripeUnitNumber"] = v + } + request["RegionId"] = client.RegionId + request["SizeG"] = d.Get("size") + if v, ok := d.GetOk("snapshot_id"); ok { + request["SnapshotId"] = v + } + if v, ok := d.GetOk("used_scene"); ok { + request["UsedScene"] = v + } + request["ZoneId"] = d.Get("zone_id") + request["ClientToken"] = buildClientToken("CreateDbfs") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-04-18"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_dbfs_instance", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["FsId"])) + dbfsService := DbfsService{client} + stateConf := BuildStateConf([]string{}, []string{"unattached"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, dbfsService.DbfsInstanceStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudDbfsInstanceUpdate(d, meta) +} +func resourceAlicloudDbfsInstanceRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + dbfsService := DbfsService{client} + object, err := dbfsService.DescribeDbfsInstance(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_dbfs_instance dbfsService.DescribeDbfsInstance Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("category", object["Category"]) + if ecsListList, ok := object["EcsList"]; ok && ecsListList != nil { + ecsListMaps := make([]map[string]interface{}, 0) + for _, ecsListListItem := range ecsListList.([]interface{}) { + if ecsListListItemMap, ok := ecsListListItem.(map[string]interface{}); ok { + ecsListListItemMap["ecs_id"] = ecsListListItemMap["EcsId"] + ecsListMaps = append(ecsListMaps, ecsListListItemMap) + } + d.Set("ecs_list", ecsListMaps) + } + } + + d.Set("enable_raid", object["EnableRaid"]) + d.Set("encryption", object["Encryption"]) + d.Set("kms_key_id", object["KMSKeyId"]) + d.Set("performance_level", object["PerformanceLevel"]) + if v, ok := object["SizeG"]; ok && fmt.Sprint(v) != "0" { + d.Set("size", formatInt(v)) + } + d.Set("status", object["Status"]) + d.Set("tags", tagsToMap(object["Tags"])) + d.Set("zone_id", object["ZoneId"]) + d.Set("instance_name", object["FsName"]) + return nil +} +func resourceAlicloudDbfsInstanceUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + d.Partial(true) + + update := false + request := map[string]interface{}{ + "FsId": d.Id(), + } + if !d.IsNewResource() && d.HasChange("instance_name") { + update = true + } + request["FsName"] = d.Get("instance_name") + if update { + action := "RenameDbfs" + conn, err := client.NewDbfsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-04-18"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("instance_name") + } + update = false + resizeDbfsReq := map[string]interface{}{ + "FsId": d.Id(), + } + if !d.IsNewResource() && d.HasChange("size") { + update = true + } + resizeDbfsReq["NewSizeG"] = d.Get("size") + if update { + action := "ResizeDbfs" + conn, err := client.NewDbfsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-04-18"), StringPointer("AK"), nil, resizeDbfsReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, resizeDbfsReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + dbfsService := DbfsService{client} + stateConf := BuildStateConf([]string{}, []string{"attached"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, dbfsService.DbfsInstanceStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + d.SetPartial("size") + } + + if d.HasChange("tags") { + oraw, nraw := d.GetChange("tags") + remove := oraw.(map[string]interface{}) + create := nraw.(map[string]interface{}) + + if len(remove) > 0 { + + deleteTagsBatchReq := map[string]interface{}{ + "DbfsList": "[\"" + d.Id() + "\"]", + "RegionId": client.RegionId, + } + + tagsMaps := make([]map[string]interface{}, 0) + for key, value := range remove { + tagsMap := map[string]interface{}{} + tagsMap["TagKey"] = key + tagsMap["TagValue"] = value + tagsMaps = append(tagsMaps, tagsMap) + } + deleteTagsBatchReq["Tags"], _ = convertListMapToJsonString(tagsMaps) + + action := "DeleteTagsBatch" + conn, err := client.NewDbfsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-04-18"), StringPointer("AK"), nil, deleteTagsBatchReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, deleteTagsBatchReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + + if len(create) > 0 { + + addTagsBatchReq := map[string]interface{}{ + "DbfsList": "[\"" + d.Id() + "\"]", + "RegionId": client.RegionId, + } + + tagsMaps := make([]map[string]interface{}, 0) + for key, value := range create { + tagsMap := map[string]interface{}{} + tagsMap["TagKey"] = key + tagsMap["TagValue"] = value + tagsMaps = append(tagsMaps, tagsMap) + } + addTagsBatchReq["Tags"], _ = convertListMapToJsonString(tagsMaps) + + action := "AddTagsBatch" + conn, err := client.NewDbfsClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("AddTagsBatch") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-04-18"), StringPointer("AK"), nil, addTagsBatchReq, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, addTagsBatchReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + + d.SetPartial("tags") + } + + if d.HasChange("ecs_list") { + oldEcsList, newEcsList := d.GetChange("ecs_list") + oldEcsListSet := oldEcsList.(*schema.Set) + newEcsListSet := newEcsList.(*schema.Set) + removed := oldEcsListSet.Difference(newEcsListSet) + added := newEcsListSet.Difference(oldEcsListSet) + + if removed.Len() > 0 { + detachdbfsrequest := map[string]interface{}{ + "FsId": d.Id(), + } + detachdbfsrequest["RegionId"] = client.RegionId + detachdbfsrequest["ECSInstanceId"] = d.Get("ecs_instance_id") + for _, ecsArg := range removed.List() { + ecsMap := ecsArg.(map[string]interface{}) + detachdbfsrequest["ECSInstanceId"] = ecsMap["ecs_id"] + + action := "DetachDbfs" + conn, err := client.NewDbfsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-04-18"), StringPointer("AK"), nil, detachdbfsrequest, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, detachdbfsrequest) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + + dbfsService := DbfsService{client} + stateConf := BuildStateConf([]string{}, []string{"unattached", "attached"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, dbfsService.DbfsInstanceStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + } + + if added.Len() > 0 { + attachdbfsrequest := map[string]interface{}{ + "FsId": d.Id(), + } + attachdbfsrequest["RegionId"] = client.RegionId + + action := "AttachDbfs" + for _, ecsArg := range added.List() { + ecsMap := ecsArg.(map[string]interface{}) + attachdbfsrequest["ECSInstanceId"] = ecsMap["ecs_id"] + + conn, err := client.NewDbfsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-04-18"), StringPointer("AK"), nil, attachdbfsrequest, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, attachdbfsrequest) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + dbfsService := DbfsService{client} + stateConf := BuildStateConf([]string{}, []string{"attached"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, dbfsService.DbfsInstanceStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + } + + d.SetPartial("ecs_list") + } + d.Partial(false) + return resourceAlicloudDbfsInstanceRead(d, meta) +} +func resourceAlicloudDbfsInstanceDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + dbfsService := DbfsService{client} + action := "DeleteDbfs" + var response map[string]interface{} + conn, err := client.NewDbfsClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "FsId": d.Id(), + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-04-18"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"EntityNotExist.DBFS"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{}, d.Timeout(schema.TimeoutDelete), 5*time.Second, dbfsService.DbfsInstanceStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return nil +} +func convertDbfsInstancePaymentTypeResponse(source string) string { + switch source { + case "postpaid": + return "PayAsYouGo" + } + return source +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dcdn_domain.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dcdn_domain.go index e1084730c3c..84327332b66 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dcdn_domain.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dcdn_domain.go @@ -455,6 +455,10 @@ func resourceAlicloudDcdnDomainUpdate(d *schema.ResourceData, meta interface{}) } } d.Partial(false) + stateConf := BuildStateConf([]string{}, []string{"online"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, dcdnService.DcdnDomainStateRefreshFunc(d.Id(), []string{"check_failed", "configure_failed"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } return resourceAlicloudDcdnDomainRead(d, meta) } func resourceAlicloudDcdnDomainDelete(d *schema.ResourceData, meta interface{}) error { diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dfs_access_group.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dfs_access_group.go new file mode 100644 index 00000000000..273d4b54bab --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dfs_access_group.go @@ -0,0 +1,174 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudDfsAccessGroup() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudDfsAccessGroupCreate, + Read: resourceAlicloudDfsAccessGroupRead, + Update: resourceAlicloudDfsAccessGroupUpdate, + Delete: resourceAlicloudDfsAccessGroupDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "access_group_name": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringLenBetween(1, 100), + }, + "description": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(1, 100), + }, + "network_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"VPC"}, false), + }, + }, + } +} + +func resourceAlicloudDfsAccessGroupCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateAccessGroup" + request := make(map[string]interface{}) + conn, err := client.NewAlidfsClient() + if err != nil { + return WrapError(err) + } + request["AccessGroupName"] = d.Get("access_group_name") + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + request["NetworkType"] = d.Get("network_type") + request["InputRegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-06-20"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_dfs_access_group", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["AccessGroupId"])) + + return resourceAlicloudDfsAccessGroupRead(d, meta) +} +func resourceAlicloudDfsAccessGroupRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + dfsService := DfsService{client} + object, err := dfsService.DescribeDfsAccessGroup(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_dfs_access_group dfsService.DescribeDfsAccessGroup Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("access_group_name", object["AccessGroupName"]) + d.Set("description", object["Description"]) + d.Set("network_type", object["NetworkType"]) + return nil +} +func resourceAlicloudDfsAccessGroupUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "AccessGroupId": d.Id(), + } + request["InputRegionId"] = client.RegionId + if d.HasChange("access_group_name") { + update = true + request["AccessGroupName"] = d.Get("access_group_name") + } + if d.HasChange("description") { + update = true + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + } + if update { + action := "ModifyAccessGroup" + conn, err := client.NewAlidfsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-06-20"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudDfsAccessGroupRead(d, meta) +} +func resourceAlicloudDfsAccessGroupDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteAccessGroup" + var response map[string]interface{} + conn, err := client.NewAlidfsClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "AccessGroupId": d.Id(), + } + + request["InputRegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-06-20"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidParameter.AccessGroupNotFound"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dfs_access_rule.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dfs_access_rule.go new file mode 100644 index 00000000000..5f509a2bdf6 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dfs_access_rule.go @@ -0,0 +1,211 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudDfsAccessRule() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudDfsAccessRuleCreate, + Read: resourceAlicloudDfsAccessRuleRead, + Update: resourceAlicloudDfsAccessRuleUpdate, + Delete: resourceAlicloudDfsAccessRuleDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "access_group_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "access_rule_id": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Optional: true, + }, + "network_segment": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "priority": { + Type: schema.TypeInt, + Required: true, + ValidateFunc: validation.IntBetween(1, 100), + }, + "rw_access_type": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"RDONLY", "RDWR"}, false), + }, + }, + } +} + +func resourceAlicloudDfsAccessRuleCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateAccessRule" + request := make(map[string]interface{}) + conn, err := client.NewAlidfsClient() + if err != nil { + return WrapError(err) + } + request["AccessGroupId"] = d.Get("access_group_id") + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + request["NetworkSegment"] = d.Get("network_segment") + request["Priority"] = d.Get("priority") + request["InputRegionId"] = client.RegionId + request["RWAccessType"] = d.Get("rw_access_type") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-06-20"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_dfs_access_rule", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["AccessGroupId"], ":", response["AccessRuleId"])) + + return resourceAlicloudDfsAccessRuleRead(d, meta) +} +func resourceAlicloudDfsAccessRuleRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + dfsService := DfsService{client} + object, err := dfsService.DescribeDfsAccessRule(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_dfs_access_rule dfsService.DescribeDfsAccessRule Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Set("access_group_id", parts[0]) + d.Set("access_rule_id", parts[1]) + d.Set("description", object["Description"]) + d.Set("network_segment", object["NetworkSegment"]) + if v, ok := object["Priority"]; ok && fmt.Sprint(v) != "0" { + d.Set("priority", formatInt(v)) + } + d.Set("rw_access_type", object["RWAccessType"]) + return nil +} +func resourceAlicloudDfsAccessRuleUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + update := false + request := map[string]interface{}{ + "AccessGroupId": parts[0], + "AccessRuleId": parts[1], + } + request["InputRegionId"] = client.RegionId + if d.HasChange("description") { + update = true + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + } + if d.HasChange("priority") { + update = true + request["Priority"] = d.Get("priority") + } + if d.HasChange("rw_access_type") { + update = true + request["RWAccessType"] = d.Get("rw_access_type") + } + if update { + action := "ModifyAccessRule" + conn, err := client.NewAlidfsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-06-20"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudDfsAccessRuleRead(d, meta) +} +func resourceAlicloudDfsAccessRuleDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + action := "DeleteAccessRule" + var response map[string]interface{} + conn, err := client.NewAlidfsClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "AccessGroupId": parts[0], + "AccessRuleId": parts[1], + } + + request["InputRegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-06-20"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidParameter.AccessRuleNotFound"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dfs_file_system.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dfs_file_system.go new file mode 100644 index 00000000000..9500ff268ab --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dfs_file_system.go @@ -0,0 +1,238 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudDfsFileSystem() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudDfsFileSystemCreate, + Read: resourceAlicloudDfsFileSystemRead, + Update: resourceAlicloudDfsFileSystemUpdate, + Delete: resourceAlicloudDfsFileSystemDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "description": { + Type: schema.TypeString, + Optional: true, + }, + "file_system_name": { + Type: schema.TypeString, + Required: true, + }, + "protocol_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"HDFS"}, false), + }, + "provisioned_throughput_in_mi_bps": { + Type: schema.TypeInt, + Optional: true, + ForceNew: true, + ValidateFunc: validation.IntBetween(1, 1024), + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("throughput_mode"); ok && v.(string) == "Provisioned" { + return false + } + return true + }, + }, + "space_capacity": { + Type: schema.TypeInt, + Required: true, + }, + "storage_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"PERFORMANCE", "STANDARD"}, false), + }, + "throughput_mode": { + Type: schema.TypeString, + Optional: true, + Sensitive: true, + ValidateFunc: validation.StringInSlice([]string{"Provisioned", "Standard"}, false), + }, + "zone_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudDfsFileSystemCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateFileSystem" + request := make(map[string]interface{}) + conn, err := client.NewAlidfsClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + request["FileSystemName"] = d.Get("file_system_name") + if v, ok := d.GetOk("partition_number"); ok { + request["PartitionNumber"] = v + } + request["ProtocolType"] = d.Get("protocol_type") + if v, ok := d.GetOk("provisioned_throughput_in_mi_bps"); ok { + request["ProvisionedThroughputInMiBps"] = v + } + request["InputRegionId"] = client.RegionId + request["SpaceCapacity"] = d.Get("space_capacity") + request["StorageType"] = d.Get("storage_type") + if v, ok := d.GetOk("throughput_mode"); ok { + request["ThroughputMode"] = v + } + request["ZoneId"] = d.Get("zone_id") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-06-20"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_dfs_file_system", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["FileSystemId"])) + + return resourceAlicloudDfsFileSystemRead(d, meta) +} +func resourceAlicloudDfsFileSystemRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + dfsService := DfsService{client} + object, err := dfsService.DescribeDfsFileSystem(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_dfs_file_system dfsService.DescribeDfsFileSystem Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("description", object["Description"]) + d.Set("file_system_name", object["FileSystemName"]) + d.Set("protocol_type", object["ProtocolType"]) + d.Set("provisioned_throughput_in_mi_bps", formatInt(object["ProvisionedThroughputInMiBps"])) + d.Set("space_capacity", formatInt(object["SpaceCapacity"])) + d.Set("storage_type", object["StorageType"]) + d.Set("throughput_mode", object["ThroughputMode"]) + d.Set("zone_id", object["ZoneId"]) + return nil +} +func resourceAlicloudDfsFileSystemUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "FileSystemId": d.Id(), + } + request["InputRegionId"] = client.RegionId + if d.HasChange("description") { + update = true + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + } + if d.HasChange("file_system_name") { + update = true + request["FileSystemName"] = d.Get("file_system_name") + } + if d.HasChange("provisioned_throughput_in_mi_bps") { + update = true + if v, ok := d.GetOk("provisioned_throughput_in_mi_bps"); ok { + request["ProvisionedThroughputInMiBps"] = v + } + } + if d.HasChange("space_capacity") { + update = true + request["SpaceCapacity"] = d.Get("space_capacity") + } + if d.HasChange("throughput_mode") { + update = true + if v, ok := d.GetOk("throughput_mode"); ok { + request["ThroughputMode"] = v + } + } + if update { + action := "ModifyFileSystem" + conn, err := client.NewAlidfsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-06-20"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudDfsFileSystemRead(d, meta) +} +func resourceAlicloudDfsFileSystemDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteFileSystem" + var response map[string]interface{} + conn, err := client.NewAlidfsClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "FileSystemId": d.Id(), + } + + request["InputRegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-06-20"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidParameter.FileSystemNotFound"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dfs_mount_point.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dfs_mount_point.go new file mode 100644 index 00000000000..2d235c96533 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dfs_mount_point.go @@ -0,0 +1,225 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudDfsMountPoint() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudDfsMountPointCreate, + Read: resourceAlicloudDfsMountPointRead, + Update: resourceAlicloudDfsMountPointUpdate, + Delete: resourceAlicloudDfsMountPointDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "access_group_id": { + Type: schema.TypeString, + Required: true, + }, + "description": { + Type: schema.TypeString, + Optional: true, + }, + "file_system_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "mount_point_id": { + Type: schema.TypeString, + Computed: true, + }, + "network_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"VPC"}, false), + }, + "status": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"Active", "Inactive"}, false), + }, + "vpc_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "vswitch_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudDfsMountPointCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateMountPoint" + request := make(map[string]interface{}) + conn, err := client.NewAlidfsClient() + if err != nil { + return WrapError(err) + } + request["AccessGroupId"] = d.Get("access_group_id") + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + request["FileSystemId"] = d.Get("file_system_id") + request["NetworkType"] = d.Get("network_type") + request["InputRegionId"] = client.RegionId + request["VpcId"] = d.Get("vpc_id") + request["VSwitchId"] = d.Get("vswitch_id") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-06-20"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_dfs_mount_point", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["FileSystemId"], ":", response["MountPointId"])) + + return resourceAlicloudDfsMountPointUpdate(d, meta) +} +func resourceAlicloudDfsMountPointRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + dfsService := DfsService{client} + object, err := dfsService.DescribeDfsMountPoint(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_dfs_mount_point dfsService.DescribeDfsMountPoint Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Set("file_system_id", parts[0]) + d.Set("mount_point_id", parts[1]) + d.Set("access_group_id", object["AccessGroupId"]) + d.Set("description", object["Description"]) + d.Set("network_type", object["NetworkType"]) + d.Set("status", object["Status"]) + d.Set("vpc_id", object["VpcId"]) + d.Set("vswitch_id", object["VSwitchId"]) + return nil +} +func resourceAlicloudDfsMountPointUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + update := false + request := map[string]interface{}{ + "FileSystemId": parts[0], + "MountPointId": parts[1], + } + request["InputRegionId"] = client.RegionId + if !d.IsNewResource() && d.HasChange("access_group_id") { + update = true + request["AccessGroupId"] = d.Get("access_group_id") + } + if !d.IsNewResource() && d.HasChange("description") { + update = true + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + } + if d.HasChange("status") { + update = true + if v, ok := d.GetOk("status"); ok { + request["Status"] = v + } + } + if update { + action := "ModifyMountPoint" + conn, err := client.NewAlidfsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-06-20"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudDfsMountPointRead(d, meta) +} +func resourceAlicloudDfsMountPointDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + action := "DeleteMountPoint" + var response map[string]interface{} + conn, err := client.NewAlidfsClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "FileSystemId": parts[0], + "MountPointId": parts[1], + } + + request["InputRegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-06-20"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidParameter.MountPointNotFound"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_direct_mail_domain.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_direct_mail_domain.go new file mode 100644 index 00000000000..56e04a11834 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_direct_mail_domain.go @@ -0,0 +1,114 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudDirectMailDomain() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudDirectMailDomainCreate, + Read: resourceAlicloudDirectMailDomainRead, + Delete: resourceAlicloudDirectMailDomainDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "domain_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(4, 50), + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudDirectMailDomainCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateDomain" + request := make(map[string]interface{}) + conn, err := client.NewDmClient() + if err != nil { + return WrapError(err) + } + request["DomainName"] = d.Get("domain_name") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-11-23"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_direct_mail_domain", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["DomainId"])) + + return resourceAlicloudDirectMailDomainRead(d, meta) +} +func resourceAlicloudDirectMailDomainRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + dmService := DmService{client} + object, err := dmService.DescribeDirectMailDomain(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_direct_mail_domain dmService.DescribeDirectMailDomain Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("domain_name", object["DomainName"]) + d.Set("status", object["DomainStatus"]) + return nil +} +func resourceAlicloudDirectMailDomainDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteDomain" + var response map[string]interface{} + conn, err := client.NewDmClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "DomainId": d.Id(), + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-11-23"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_direct_mail_mail_address.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_direct_mail_mail_address.go new file mode 100644 index 00000000000..b3faf264f69 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_direct_mail_mail_address.go @@ -0,0 +1,184 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudDirectMailMailAddress() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudDirectMailMailAddressCreate, + Read: resourceAlicloudDirectMailMailAddressRead, + Update: resourceAlicloudDirectMailMailAddressUpdate, + Delete: resourceAlicloudDirectMailMailAddressDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "account_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-z0-9_-]+@[a-z0-9_-]+(\.[a-z0-9_-]+)+$`), "The email address must be filled in the format of account@domain, and only lowercase letters or numbers can be used."), + }, + "password": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[0-9A-Za-z]{10,20}$`), "The password must be length 10-20 string, contains numbers, uppercase letters, lowercase letters at the same time."), + }, + "reply_address": { + Type: schema.TypeString, + Optional: true, + }, + "sendtype": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"batch", "trigger"}, false), + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudDirectMailMailAddressCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateMailAddress" + request := make(map[string]interface{}) + conn, err := client.NewDmClient() + if err != nil { + return WrapError(err) + } + request["AccountName"] = d.Get("account_name") + if v, ok := d.GetOk("reply_address"); ok { + request["ReplyAddress"] = v + } + request["Sendtype"] = d.Get("sendtype") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-11-23"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_direct_mail_mail_address", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["MailAddressId"])) + + return resourceAlicloudDirectMailMailAddressUpdate(d, meta) +} +func resourceAlicloudDirectMailMailAddressRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + dmService := DmService{client} + object, err := dmService.DescribeDirectMailMailAddress(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_direct_mail_mail_address dmService.DescribeDirectMailMailAddress Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("account_name", object["AccountName"]) + d.Set("reply_address", object["ReplyAddress"]) + d.Set("sendtype", object["Sendtype"]) + d.Set("status", object["AccountStatus"]) + return nil +} +func resourceAlicloudDirectMailMailAddressUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "MailAddressId": d.Id(), + } + if d.HasChange("password") { + update = true + if v, ok := d.GetOk("password"); ok { + request["Password"] = v + } + } + if !d.IsNewResource() && d.HasChange("reply_address") { + update = true + if v, ok := d.GetOk("reply_address"); ok { + request["ReplyAddress"] = v + } + } + if update { + action := "ModifyMailAddress" + conn, err := client.NewDmClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-11-23"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudDirectMailMailAddressRead(d, meta) +} +func resourceAlicloudDirectMailMailAddressDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteMailAddress" + var response map[string]interface{} + conn, err := client.NewDmClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "MailAddressId": d.Id(), + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-11-23"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidMailAddressId.Malformed"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_direct_mail_tag.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_direct_mail_tag.go new file mode 100644 index 00000000000..673393b5e7d --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_direct_mail_tag.go @@ -0,0 +1,147 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudDirectMailTag() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudDirectMailTagCreate, + Read: resourceAlicloudDirectMailTagRead, + Update: resourceAlicloudDirectMailTagUpdate, + Delete: resourceAlicloudDirectMailTagDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "tag_name": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[A-Za-z0-9]{1,50}$`), "The name must be `1` to `50` characters in length, and can contain letters and digits."), + }, + }, + } +} + +func resourceAlicloudDirectMailTagCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateTag" + request := make(map[string]interface{}) + conn, err := client.NewDmClient() + if err != nil { + return WrapError(err) + } + request["TagName"] = d.Get("tag_name") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-11-23"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_direct_mail_tag", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["TagId"])) + + return resourceAlicloudDirectMailTagRead(d, meta) +} +func resourceAlicloudDirectMailTagRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + dmService := DmService{client} + object, err := dmService.DescribeDirectMailTag(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_direct_mail_tag dmService.DescribeDirectMailTag Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("tag_name", object["TagName"]) + return nil +} +func resourceAlicloudDirectMailTagUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "TagId": d.Id(), + } + if d.HasChange("tag_name") { + update = true + request["TagName"] = d.Get("tag_name") + } + if update { + action := "ModifyTag" + conn, err := client.NewDmClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-11-23"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudDirectMailTagRead(d, meta) +} +func resourceAlicloudDirectMailTagDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteTag" + var response map[string]interface{} + conn, err := client.NewDmClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "TagId": d.Id(), + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-11-23"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_drds_instance.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_drds_instance.go index a976210c8c1..0d28899254e 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_drds_instance.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_drds_instance.go @@ -57,7 +57,7 @@ func resourceAlicloudDRDSInstance() *schema.Resource { "instance_series": { Type: schema.TypeString, Required: true, - ValidateFunc: validation.StringInSlice([]string{"drds.sn1.4c8g", "drds.sn1.8c16g", "drds.sn1.16c32g", "drds.sn1.32c64g"}, false), + ValidateFunc: validation.StringInSlice([]string{"drds.sn1.4c8g", "drds.sn1.8c16g", "drds.sn1.16c32g", "drds.sn1.32c64g", "drds.sn2.4c16g", "drds.sn2.8c32g", "drds.sn2.16c64g"}, false), ForceNew: true, }, }, diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dts_consumer_channel.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dts_consumer_channel.go new file mode 100644 index 00000000000..575d15ee0a2 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dts_consumer_channel.go @@ -0,0 +1,194 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudDtsConsumerChannel() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudDtsConsumerChannelCreate, + Read: resourceAlicloudDtsConsumerChannelRead, + Update: resourceAlicloudDtsConsumerChannelUpdate, + Delete: resourceAlicloudDtsConsumerChannelDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "consumer_group_id": { + Type: schema.TypeString, + Computed: true, + }, + "consumer_group_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + + ValidateFunc: validation.StringLenBetween(1, 128), + }, + "consumer_group_password": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringLenBetween(8, 32), + }, + "consumer_group_user_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + + ValidateFunc: validation.StringMatch(regexp.MustCompile("^[a-zA-Z0-9_]{1,16}$"), "The length of the name is limited to `1` to `16` characters. It can contain uppercase and lowercase letters, numbers, underscores (_)"), + }, + "dts_instance_id": { + Type: schema.TypeString, + Required: true, + }, + }, + } +} + +func resourceAlicloudDtsConsumerChannelCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateConsumerChannel" + request := make(map[string]interface{}) + conn, err := client.NewDtsClient() + if err != nil { + return WrapError(err) + } + request["ConsumerGroupName"] = d.Get("consumer_group_name") + request["ConsumerGroupPassword"] = d.Get("consumer_group_password") + request["ConsumerGroupUserName"] = d.Get("consumer_group_user_name") + request["DtsInstanceId"] = d.Get("dts_instance_id") + + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"OperationDenied.JobStatus"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_dts_consumer_channel", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["DtsInstanceId"], ":", response["ConsumerGroupID"])) + + return resourceAlicloudDtsConsumerChannelRead(d, meta) +} +func resourceAlicloudDtsConsumerChannelRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + dtsService := DtsService{client} + object, err := dtsService.DescribeDtsConsumerChannel(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_dts_consumer_channel dtsService.DescribeDtsConsumerChannel Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Set("consumer_group_id", parts[1]) + d.Set("dts_instance_id", parts[0]) + d.Set("consumer_group_name", object["ConsumerGroupName"]) + d.Set("consumer_group_user_name", object["ConsumerGroupUserName"]) + return nil +} +func resourceAlicloudDtsConsumerChannelUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + update := false + request := map[string]interface{}{ + "ConsumerGroupId": parts[1], + "DtsInstanceId": parts[0], + } + request["RegionId"] = client.RegionId + if d.HasChange("consumer_group_password") { + update = true + request["ConsumerGroupPassword"] = d.Get("consumer_group_password") + } + if update { + action := "ModifyConsumerChannel" + conn, err := client.NewDtsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"OperationDenied.JobStatus"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudDtsConsumerChannelRead(d, meta) +} +func resourceAlicloudDtsConsumerChannelDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + action := "DeleteConsumerChannel" + var response map[string]interface{} + conn, err := client.NewDtsClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "ConsumerGroupId": parts[1], + "DtsInstanceId": parts[0], + } + + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"OperationDenied.JobStatus"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + time.Sleep(10 * time.Second) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dts_job_monitor_rule.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dts_job_monitor_rule.go new file mode 100644 index 00000000000..1bc58c912c3 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dts_job_monitor_rule.go @@ -0,0 +1,186 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudDtsJobMonitorRule() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudDtsJobMonitorRuleCreate, + Read: resourceAlicloudDtsJobMonitorRuleRead, + Update: resourceAlicloudDtsJobMonitorRuleUpdate, + Delete: resourceAlicloudDtsJobMonitorRuleDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "delay_rule_time": { + Type: schema.TypeString, + Computed: true, + Optional: true, + }, + "dts_job_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "phone": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "state": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"Y", "N"}, false), + }, + "type": { + Type: schema.TypeString, + ForceNew: true, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"delay", "error"}, false), + }, + }, + } +} + +func resourceAlicloudDtsJobMonitorRuleCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateJobMonitorRule" + request := make(map[string]interface{}) + conn, err := client.NewDtsClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("delay_rule_time"); ok { + request["DelayRuleTime"] = v + } + request["DtsJobId"] = d.Get("dts_job_id") + if v, ok := d.GetOk("phone"); ok { + request["Phone"] = v + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("state"); ok { + request["State"] = v + } + if v, ok := d.GetOk("type"); ok { + request["Type"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_dts_job_monitor_rule", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + + d.SetId(fmt.Sprint(request["DtsJobId"])) + + return resourceAlicloudDtsJobMonitorRuleRead(d, meta) +} +func resourceAlicloudDtsJobMonitorRuleRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + dtsService := DtsService{client} + object, err := dtsService.DescribeDtsJobMonitorRule(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_dts_job_monitor_rule dtsService.DescribeDtsJobMonitorRule Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + + d.Set("dts_job_id", d.Id()) + if v := object["MonitorRules"].([]interface{}); len(v) > 0 { + d.Set("delay_rule_time", v[0].(map[string]interface{})["DelayRuleTime"]) + d.Set("phone", v[0].(map[string]interface{})["Phone"]) + d.Set("state", v[0].(map[string]interface{})["State"]) + d.Set("type", v[0].(map[string]interface{})["Type"]) + } + return nil +} +func resourceAlicloudDtsJobMonitorRuleUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "DtsJobId": d.Id(), + } + if d.HasChange("delay_rule_time") { + update = true + if v, ok := d.GetOk("delay_rule_time"); ok { + request["DelayRuleTime"] = v + } + } + if d.HasChange("phone") { + update = true + if v, ok := d.GetOk("phone"); ok { + request["Phone"] = v + } + } + request["RegionId"] = client.RegionId + if d.HasChange("state") { + update = true + if v, ok := d.GetOk("state"); ok { + request["State"] = v + } + } + if v, ok := d.GetOk("type"); ok { + request["Type"] = v + } + if update { + action := "CreateJobMonitorRule" + conn, err := client.NewDtsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + } + return resourceAlicloudDtsJobMonitorRuleRead(d, meta) +} +func resourceAlicloudDtsJobMonitorRuleDelete(d *schema.ResourceData, meta interface{}) error { + log.Printf("[WARN] Cannot destroy resourceAlicloudDtsJobMonitorRule. Terraform will remove this resource from the state file, however resources may remain.") + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dts_subscription_job.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dts_subscription_job.go new file mode 100644 index 00000000000..282ac0637f2 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dts_subscription_job.go @@ -0,0 +1,795 @@ +package alicloud + +import ( + "encoding/json" + "fmt" + "log" + "strings" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudDtsSubscriptionJob() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudDtsSubscriptionJobCreate, + Read: resourceAlicloudDtsSubscriptionJobRead, + Update: resourceAlicloudDtsSubscriptionJobUpdate, + Delete: resourceAlicloudDtsSubscriptionJobDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Update: schema.DefaultTimeout(5 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "checkpoint": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "compute_unit": { + Type: schema.TypeInt, + Optional: true, + }, + "database_count": { + Type: schema.TypeInt, + Optional: true, + }, + "db_list": { + Type: schema.TypeString, + Optional: true, + }, + "delay_notice": { + Type: schema.TypeBool, + Optional: true, + }, + "delay_phone": { + Type: schema.TypeString, + Optional: true, + }, + "delay_rule_time": { + Type: schema.TypeString, + Optional: true, + }, + "destination_endpoint_engine_name": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"ADS", "DB2", "DRDS", "DataHub", "Greenplum", "MSSQL", "MySQL", "PolarDB", "PostgreSQL", "Redis", "Tablestore", "as400", "clickhouse", "kafka", "mongodb", "odps", "oracle", "polardb_o", "polardb_pg", "tidb"}, false), + }, + "destination_region": { + Type: schema.TypeString, + Optional: true, + }, + "dts_instance_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Computed: true, + }, + "dts_job_name": { + Type: schema.TypeString, + Optional: true, + }, + "error_notice": { + Type: schema.TypeBool, + Optional: true, + }, + "error_phone": { + Type: schema.TypeString, + Optional: true, + }, + "instance_class": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"large", "medium", "micro", "small", "xlarge", "xxlarge"}, false), + }, + "payment_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"PayAsYouGo", "Subscription"}, false), + }, + "payment_duration_unit": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"Month", "Year"}, false), + }, + "payment_duration": { + Type: schema.TypeInt, + Optional: true, + }, + "reserve": { + Type: schema.TypeString, + Optional: true, + }, + "source_endpoint_database_name": { + Type: schema.TypeString, + Optional: true, + }, + "source_endpoint_engine_name": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"MySQL", "Oracle"}, false), + }, + "source_endpoint_ip": { + Type: schema.TypeString, + Optional: true, + }, + "source_endpoint_instance_id": { + Type: schema.TypeString, + Optional: true, + }, + "source_endpoint_instance_type": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"CEN", "DRDS", "ECS", "Express", "LocalInstance", "PolarDB", "RDS", "dg"}, false), + }, + "source_endpoint_oracle_sid": { + Type: schema.TypeString, + Optional: true, + }, + "source_endpoint_owner_id": { + Type: schema.TypeString, + Optional: true, + }, + "source_endpoint_password": { + Type: schema.TypeString, + Optional: true, + }, + "source_endpoint_port": { + Type: schema.TypeString, + Optional: true, + }, + "source_endpoint_region": { + Type: schema.TypeString, + Optional: true, + }, + "source_endpoint_role": { + Type: schema.TypeString, + Optional: true, + }, + "source_endpoint_user_name": { + Type: schema.TypeString, + Optional: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"Abnormal", "Downgrade", "Locked", "Normal", "NotStarted", "NotStarted", "PreCheckPass", "PrecheckFailed", "Prechecking", "Retrying", "Starting", "Upgrade"}, false), + }, + "subscription_data_type_ddl": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "subscription_data_type_dml": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "subscription_instance_network_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"classic", "vpc"}, false), + }, + "subscription_instance_vpc_id": { + Type: schema.TypeString, + Optional: true, + }, + "subscription_instance_vswitch_id": { + Type: schema.TypeString, + Optional: true, + }, + "sync_architecture": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"bidirectional", "oneway"}, false), + }, + "synchronization_direction": { + Type: schema.TypeString, + Optional: true, + }, + "tags": tagsSchema(), + }, + } +} + +func resourceAlicloudDtsSubscriptionJobCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateDtsInstance" + request := make(map[string]interface{}) + request["AutoPay"] = false + request["AutoStart"] = true + conn, err := client.NewDtsClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("compute_unit"); ok { + request["ComputeUnit"] = v + } + if v, ok := d.GetOk("database_count"); ok { + request["DatabaseCount"] = v + } + if v, ok := d.GetOk("destination_endpoint_engine_name"); ok { + request["DestinationEndpointEngineName"] = v + } + if v, ok := d.GetOk("destination_region"); ok { + request["DestinationRegion"] = v + } + if v, ok := d.GetOk("instance_class"); ok { + request["InstanceClass"] = v + } + if v, ok := d.GetOk("payment_type"); ok { + request["PayType"] = convertDtsPaymentTypeRequest(v.(string)) + } + if v, ok := d.GetOk("payment_duration_unit"); ok { + request["Period"] = v + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("source_endpoint_engine_name"); ok { + request["SourceEndpointEngineName"] = v + } + if v, ok := d.GetOk("source_endpoint_region"); ok { + request["SourceRegion"] = v + } + if v, ok := d.GetOk("sync_architecture"); ok { + request["SyncArchitecture"] = v + } + request["Type"] = "SUBSCRIBE" + if v, ok := d.GetOk("payment_duration"); ok { + request["UsedTime"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_dts_subscription_job", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["JobId"])) + d.Set("dts_instance_id", response["InstanceId"]) + + return resourceAlicloudDtsSubscriptionJobUpdate(d, meta) +} +func resourceAlicloudDtsSubscriptionJobRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + dtsService := DtsService{client} + object, err := dtsService.DescribeDtsSubscriptionJob(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_dts_subscription_job dtsService.DescribeDtsSubscriptionJob Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("checkpoint", fmt.Sprint(formatInt(object["Checkpoint"]))) + d.Set("db_list", object["DbObject"]) + d.Set("dts_instance_id", object["DtsInstanceID"]) + d.Set("dts_job_name", object["DtsJobName"]) + d.Set("payment_type", convertDtsPaymentTypeResponse(object["PayType"])) + d.Set("source_endpoint_database_name", object["SourceEndpoint"].(map[string]interface{})["DatabaseName"]) + d.Set("source_endpoint_engine_name", object["SourceEndpoint"].(map[string]interface{})["EngineName"]) + d.Set("source_endpoint_ip", object["SourceEndpoint"].(map[string]interface{})["Ip"]) + d.Set("source_endpoint_instance_id", object["SourceEndpoint"].(map[string]interface{})["InstanceID"]) + d.Set("source_endpoint_instance_type", object["SourceEndpoint"].(map[string]interface{})["InstanceType"]) + d.Set("source_endpoint_oracle_sid", object["SourceEndpoint"].(map[string]interface{})["OracleSID"]) + d.Set("source_endpoint_owner_id", object["SourceEndpoint"].(map[string]interface{})["AliyunUid"]) + d.Set("source_endpoint_port", object["SourceEndpoint"].(map[string]interface{})["Port"]) + d.Set("source_endpoint_region", object["SourceEndpoint"].(map[string]interface{})["Region"]) + d.Set("source_endpoint_role", object["SourceEndpoint"].(map[string]interface{})["RoleName"]) + d.Set("source_endpoint_user_name", object["SourceEndpoint"].(map[string]interface{})["UserName"]) + d.Set("status", object["Status"]) + d.Set("subscription_data_type_ddl", object["SubscriptionDataType"].(map[string]interface{})["Ddl"]) + d.Set("subscription_data_type_dml", object["SubscriptionDataType"].(map[string]interface{})["Dml"]) + + var jsonData map[string]interface{} + json.Unmarshal([]byte(object["Reserved"].(string)), &jsonData) + if jsonData["netType"] != nil { + d.Set("subscription_instance_network_type", strings.ToLower(jsonData["netType"].(string))) + } + d.Set("subscription_instance_vpc_id", jsonData["vpcId"]) + d.Set("subscription_instance_vswitch_id", jsonData["vswitchId"]) + listTagResourcesObject, err := dtsService.ListTagResources(object["DtsInstanceID"].(string), "ALIYUN::DTS::INSTANCE") + if err != nil { + return WrapError(err) + } + d.Set("tags", tagsToMap(listTagResourcesObject)) + + return nil +} +func resourceAlicloudDtsSubscriptionJobUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + dtsService := DtsService{client} + var response map[string]interface{} + d.Partial(true) + + if d.HasChange("tags") { + if err := dtsService.SetResourceTags(d, "ALIYUN::DTS::INSTANCE"); err != nil { + return WrapError(err) + } + d.SetPartial("tags") + } + update := false + request := map[string]interface{}{ + "DtsJobId": d.Id(), + } + if d.HasChange("dts_job_name") { + update = true + if v, ok := d.GetOk("dts_job_name"); ok { + request["DtsJobName"] = v + } + } + request["RegionId"] = client.RegionId + if update { + action := "ModifyDtsJobName" + conn, err := client.NewDtsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + d.SetPartial("dts_job_name") + } + update = false + modifyDtsJobPasswordReq := map[string]interface{}{ + "DtsJobId": d.Id(), + } + modifyDtsJobPasswordReq["Endpoint"] = "src" + modifyDtsJobPasswordReq["RegionId"] = client.RegionId + if !d.IsNewResource() && d.HasChange("source_endpoint_password") { + update = true + if v, ok := d.GetOk("source_endpoint_password"); ok { + modifyDtsJobPasswordReq["Password"] = v + } + if v, ok := d.GetOk("source_endpoint_user_name"); ok { + modifyDtsJobPasswordReq["UserName"] = v + } + } + if update { + action := "ModifyDtsJobPassword" + conn, err := client.NewDtsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, modifyDtsJobPasswordReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, modifyDtsJobPasswordReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + d.SetPartial("source_endpoint_password") + d.SetPartial("source_endpoint_user_name") + + target := d.Get("status").(string) + err = resourceAlicloudDtsSubscriptionJobStatusFlow(d, meta, target) + if err != nil { + return WrapError(Error(FailedToReachTargetStatus, d.Get("status"))) + } + } + + if !d.IsNewResource() && d.HasChange("status") { + target := d.Get("status").(string) + err := resourceAlicloudDtsSubscriptionJobStatusFlow(d, meta, target) + if err != nil { + return WrapError(Error(FailedToReachTargetStatus, d.Get("status"))) + } + } + + update = false + if d.IsNewResource() { + update = true + } + configureSubscriptionReq := map[string]interface{}{ + "DtsJobId": d.Id(), + } + if d.HasChange("db_list") { + update = true + } + if v, ok := d.GetOk("db_list"); ok { + configureSubscriptionReq["DbList"] = v + } + if v, ok := d.GetOk("dts_job_name"); ok { + configureSubscriptionReq["DtsJobName"] = v + } + configureSubscriptionReq["RegionId"] = client.RegionId + if d.HasChange("subscription_instance_network_type") { + update = true + } + if v, ok := d.GetOk("subscription_instance_network_type"); ok { + configureSubscriptionReq["SubscriptionInstanceNetworkType"] = v + } + if d.HasChange("checkpoint") { + update = true + } + if v, ok := d.GetOk("checkpoint"); ok { + configureSubscriptionReq["Checkpoint"] = v + } + if d.HasChange("source_endpoint_database_name") { + update = true + } + if v, ok := d.GetOk("source_endpoint_database_name"); ok { + configureSubscriptionReq["SourceEndpointDatabaseName"] = v + } + if !d.IsNewResource() && d.HasChange("source_endpoint_engine_name") { + update = true + } + if v, ok := d.GetOk("source_endpoint_engine_name"); ok { + configureSubscriptionReq["SourceEndpointEngineName"] = v + } + if d.HasChange("source_endpoint_ip") { + update = true + } + if v, ok := d.GetOk("source_endpoint_ip"); ok { + configureSubscriptionReq["SourceEndpointIP"] = v + } + if d.HasChange("source_endpoint_instance_id") { + update = true + } + if v, ok := d.GetOk("source_endpoint_instance_id"); ok { + configureSubscriptionReq["SourceEndpointInstanceID"] = v + } + if d.HasChange("source_endpoint_instance_type") { + update = true + } + if v, ok := d.GetOk("source_endpoint_instance_type"); ok { + configureSubscriptionReq["SourceEndpointInstanceType"] = v + } + if d.HasChange("source_endpoint_oracle_sid") { + update = true + } + if v, ok := d.GetOk("source_endpoint_oracle_sid"); ok { + configureSubscriptionReq["SourceEndpointOracleSID"] = v + } + if d.HasChange("source_endpoint_owner_id") { + update = true + } + if v, ok := d.GetOk("source_endpoint_owner_id"); ok { + configureSubscriptionReq["SourceEndpointOwnerID"] = v + } + if v, ok := d.GetOk("source_endpoint_password"); ok { + configureSubscriptionReq["SourceEndpointPassword"] = v + } + if d.HasChange("source_endpoint_port") { + update = true + } + if v, ok := d.GetOk("source_endpoint_port"); ok { + configureSubscriptionReq["SourceEndpointPort"] = v + } + if d.HasChange("source_endpoint_region") { + update = true + } + if v, ok := d.GetOk("source_endpoint_region"); ok { + configureSubscriptionReq["SourceEndpointRegion"] = v + } + if d.HasChange("source_endpoint_role") { + update = true + } + if v, ok := d.GetOk("source_endpoint_role"); ok { + configureSubscriptionReq["SourceEndpointRole"] = v + } + + if v, ok := d.GetOk("source_endpoint_user_name"); ok { + configureSubscriptionReq["SourceEndpointUserName"] = v + } + if d.HasChange("subscription_data_type_ddl") || d.IsNewResource() { + update = true + } + if v, ok := d.GetOkExists("subscription_data_type_ddl"); ok { + configureSubscriptionReq["SubscriptionDataTypeDDL"] = v + } + if d.HasChange("subscription_data_type_dml") || d.IsNewResource() { + update = true + } + if v, ok := d.GetOkExists("subscription_data_type_dml"); ok { + configureSubscriptionReq["SubscriptionDataTypeDML"] = v + } + if d.HasChange("subscription_instance_vpc_id") { + update = true + } + if v, ok := d.GetOk("subscription_instance_vpc_id"); ok { + configureSubscriptionReq["SubscriptionInstanceVPCId"] = v + } + if d.HasChange("subscription_instance_vswitch_id") { + update = true + } + if v, ok := d.GetOk("subscription_instance_vswitch_id"); ok { + configureSubscriptionReq["SubscriptionInstanceVSwitchId"] = v + } + if update { + + if v, ok := d.GetOkExists("delay_notice"); ok { + configureSubscriptionReq["DelayNotice"] = v + } + if v, ok := d.GetOk("delay_phone"); ok { + configureSubscriptionReq["DelayPhone"] = v + } + if v, ok := d.GetOk("delay_rule_time"); ok { + configureSubscriptionReq["DelayRuleTime"] = v + } + if v, ok := d.GetOkExists("error_notice"); ok { + configureSubscriptionReq["ErrorNotice"] = v + } + if v, ok := d.GetOk("error_phone"); ok { + configureSubscriptionReq["ErrorPhone"] = v + } + if v, ok := d.GetOk("reserve"); ok { + configureSubscriptionReq["Reserve"] = v + } + action := "ConfigureSubscription" + conn, err := client.NewDtsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, configureSubscriptionReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, configureSubscriptionReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("db_list") + d.SetPartial("dts_job_name") + d.SetPartial("subscription_instance_network_type") + d.SetPartial("checkpoint") + d.SetPartial("source_endpoint_database_name") + d.SetPartial("source_endpoint_engine_name") + d.SetPartial("source_endpoint_ip") + d.SetPartial("source_endpoint_instance_id") + d.SetPartial("source_endpoint_instance_type") + d.SetPartial("source_endpoint_oracle_sid") + d.SetPartial("source_endpoint_owner_id") + d.SetPartial("source_endpoint_password") + d.SetPartial("source_endpoint_port") + d.SetPartial("source_endpoint_region") + d.SetPartial("source_endpoint_role") + d.SetPartial("source_endpoint_user_name") + d.SetPartial("subscription_data_type_ddl") + d.SetPartial("subscription_data_type_dml") + d.SetPartial("subscription_instance_vpc_id") + d.SetPartial("subscription_instance_vswitch_id") + + target := d.Get("status").(string) + err = resourceAlicloudDtsSubscriptionJobStatusFlow(d, meta, target) + if err != nil { + return WrapError(Error(FailedToReachTargetStatus, d.Get("status"))) + } + } + d.Partial(false) + return resourceAlicloudDtsSubscriptionJobRead(d, meta) +} +func resourceAlicloudDtsSubscriptionJobDelete(d *schema.ResourceData, meta interface{}) error { + + if v, ok := d.GetOk("payment_type"); ok { + if v.(string) == "Subscription" { + return nil + } + } + client := meta.(*connectivity.AliyunClient) + action := "DeleteDtsJob" + var response map[string]interface{} + conn, err := client.NewDtsClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "DtsJobId": d.Id(), + } + + if v, ok := d.GetOk("dts_instance_id"); ok { + request["DtsInstanceId"] = v + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("synchronization_direction"); ok { + request["SynchronizationDirection"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} +func resourceAlicloudDtsSubscriptionJobStatusFlow(d *schema.ResourceData, meta interface{}, target string) error { + client := meta.(*connectivity.AliyunClient) + dtsService := DtsService{client} + var response map[string]interface{} + object, err := dtsService.DescribeDtsSubscriptionJob(d.Id()) + if err != nil { + return WrapError(err) + } + if object["Status"].(string) != target { + if target == "NotConfigured" { + request := map[string]interface{}{ + "DtsJobId": d.Id(), + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("synchronization_direction"); ok { + request["SynchronizationDirection"] = v + } + action := "ResetDtsJob" + conn, err := client.NewDtsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"NotConfigured"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, dtsService.DtsSubscriptionJobStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + if target == "Normal" || (target == "Abnormal" && object["Status"].(string) == "NotStarted") { + request := map[string]interface{}{ + "DtsJobId": d.Id(), + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("synchronization_direction"); ok { + request["SynchronizationDirection"] = v + } + action := "StartDtsJob" + conn, err := client.NewDtsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Starting", "Normal"}, d.Timeout(schema.TimeoutUpdate), 30*time.Second, dtsService.DtsSubscriptionJobStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + if target == "Abnormal" { + request := map[string]interface{}{ + "DtsJobId": d.Id(), + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("synchronization_direction"); ok { + request["SynchronizationDirection"] = v + } + action := "SuspendDtsJob" + conn, err := client.NewDtsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Abnormal"}, d.Timeout(schema.TimeoutUpdate), 30*time.Second, dtsService.DtsSubscriptionJobStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + d.SetPartial("status") + } + + return nil +} + +func convertDtsPaymentTypeResponse(source interface{}) interface{} { + switch source { + case "PostPaid": + return "PayAsYouGo" + case "PrePaid": + return "Subscription" + } + return source +} +func convertDtsPaymentTypeRequest(source interface{}) interface{} { + switch source { + case "PayAsYouGo": + return "PostPaid" + case "Subscription": + return "PrePaid" + } + return source +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dts_synchronization_instance.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dts_synchronization_instance.go new file mode 100644 index 00000000000..2625581d342 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dts_synchronization_instance.go @@ -0,0 +1,254 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudDtsSynchronizationInstance() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudDtsSynchronizationInstanceCreate, + Read: resourceAlicloudDtsSynchronizationInstanceRead, + Update: resourceAlicloudDtsSynchronizationInstanceUpdate, + Delete: resourceAlicloudDtsSynchronizationInstanceDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "compute_unit": { + Type: schema.TypeInt, + Optional: true, + }, + "database_count": { + Type: schema.TypeInt, + Optional: true, + }, + "quantity": { + Type: schema.TypeInt, + Optional: true, + }, + "sync_architecture": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"bidirectional", "oneway"}, false), + }, + "destination_endpoint_engine_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"MySQL", "PolarDB", "polardb_o", "polardb_pg", "Redis", "DRDS", "PostgreSQL", "odps", "oracle", "mongodb", "tidb", "ADS", "ADB30", "Greenplum", "MSSQL", "kafka", "DataHub", "clickhouse", "DB2", "as400", "Tablestore"}, false), + }, + "destination_endpoint_region": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "source_endpoint_engine_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"MySQL", "PolarDB", "polardb_o", "polardb_pg", "Redis", "DRDS", "PostgreSQL", "odps", "oracle", "mongodb", "tidb", "ADS", "ADB30", "Greenplum", "MSSQL", "kafka", "DataHub", "clickhouse", "DB2", "as400", "Tablestore"}, false), + }, + "source_endpoint_region": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "instance_class": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"xxlarge", "xlarge", "large", "medium", "small", "micro"}, false), + }, + "payment_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"PayAsYouGo", "Subscription"}, false), + }, + "payment_duration_unit": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"Month", "Year"}, false), + }, + "payment_duration": { + Type: schema.TypeInt, + Optional: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudDtsSynchronizationInstanceCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateDtsInstance" + request := make(map[string]interface{}) + conn, err := client.NewDtsClient() + if err != nil { + return WrapError(err) + } + + request["AutoPay"] = false + request["AutoStart"] = true + request["InstanceClass"] = "small" + if v, ok := d.GetOk("instance_class"); ok { + request["InstanceClass"] = v + } + if v, ok := d.GetOk("compute_unit"); ok { + request["ComputeUnit"] = v + } + if v, ok := d.GetOk("database_count"); ok { + request["DatabaseCount"] = v + } + if v, ok := d.GetOk("destination_endpoint_engine_name"); ok { + request["DestinationEndpointEngineName"] = v + } + if v, ok := d.GetOk("destination_endpoint_region"); ok { + request["DestinationRegion"] = v + } + if v, ok := d.GetOk("payment_type"); ok { + request["PayType"] = convertDtsSyncPaymentTypeRequest(v.(string)) + } + if v, ok := d.GetOk("payment_duration_unit"); ok { + request["Period"] = v + } + if v, ok := d.GetOk("quantity"); ok { + request["Quantity"] = v + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("source_endpoint_engine_name"); ok { + request["SourceEndpointEngineName"] = v + } + if v, ok := d.GetOk("source_endpoint_region"); ok { + request["SourceRegion"] = v + } + if v, ok := d.GetOk("sync_architecture"); ok { + request["SyncArchitecture"] = v + } + request["Type"] = "SYNC" + if v, ok := d.GetOk("payment_duration"); ok { + request["UsedTime"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_dts_synchronization_instance", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["InstanceId"])) + + return resourceAlicloudDtsSynchronizationInstanceRead(d, meta) +} +func resourceAlicloudDtsSynchronizationInstanceRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + dtsService := DtsService{client} + object, err := dtsService.DescribeDtsSynchronizationInstance(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_dts_synchronization_instance dtsService.DescribeDtsSynchronizationInstance Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + + d.Set("instance_class", object["DtsJobClass"]) + d.Set("payment_type", convertDtsSyncPaymentTypeResponse(object["PayType"])) + if v, ok := object["SourceEndpoint"].(map[string]interface{}); ok { + d.Set("source_endpoint_engine_name", v["EngineName"]) + d.Set("source_endpoint_region", v["Region"]) + } + if v, ok := object["DestinationEndpoint"].(map[string]interface{}); ok { + d.Set("destination_endpoint_engine_name", v["EngineName"]) + d.Set("destination_endpoint_region", v["Region"]) + } + return nil +} +func resourceAlicloudDtsSynchronizationInstanceUpdate(d *schema.ResourceData, meta interface{}) error { + log.Println(fmt.Sprintf("[WARNING] The resouce has not update operation.")) + return resourceAlicloudDtsSynchronizationInstanceRead(d, meta) +} +func resourceAlicloudDtsSynchronizationInstanceDelete(d *schema.ResourceData, meta interface{}) error { + + if v, ok := d.GetOk("payment_type"); ok { + if v.(string) == "Subscription" { + log.Printf("[WARN] Cannot destroy resource: alicloud_dts_synchronization_job because it's s. Terraform will remove this resource from the state file, however resources may remain.") + return nil + } + } + + client := meta.(*connectivity.AliyunClient) + action := "DeleteSynchronizationJob" + var response map[string]interface{} + conn, err := client.NewDtsClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "SynchronizationJobId": d.Id(), + } + + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidJobId"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} + +func convertDtsSyncPaymentTypeResponse(source interface{}) interface{} { + switch source { + case "PostPaid": + return "PayAsYouGo" + case "PrePaid": + return "Subscription" + } + return source +} +func convertDtsSyncPaymentTypeRequest(source interface{}) interface{} { + switch source { + case "PayAsYouGo": + return "PostPaid" + case "Subscription": + return "PrePaid" + } + return source +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dts_synchronization_job.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dts_synchronization_job.go new file mode 100644 index 00000000000..7e71df585c8 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_dts_synchronization_job.go @@ -0,0 +1,711 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudDtsSynchronizationJob() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudDtsSynchronizationJobCreate, + Read: resourceAlicloudDtsSynchronizationJobRead, + Update: resourceAlicloudDtsSynchronizationJobUpdate, + Delete: resourceAlicloudDtsSynchronizationJobDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Update: schema.DefaultTimeout(10 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "dts_instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "dts_job_name": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "checkpoint": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + }, + "instance_class": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"xxlarge", "xlarge", "large", "medium", "small"}, false), + }, + "data_initialization": { + Type: schema.TypeBool, + Required: true, + ForceNew: true, + }, + "data_synchronization": { + Type: schema.TypeBool, + Required: true, + ForceNew: true, + }, + "structure_initialization": { + Type: schema.TypeBool, + Required: true, + ForceNew: true, + }, + "synchronization_direction": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Forward", "Reverse"}, false), + }, + "db_list": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "reserve": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "source_endpoint_instance_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"CEN", "DG", "DISTRIBUTED_DMSLOGICDB", "ECS", "EXPRESS", "MONGODB", "OTHER", "PolarDB", "POLARDBX20", "RDS"}, false), + }, + "source_endpoint_engine_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"AS400", "DB2", "DMSPOLARDB", "HBASE", "MONGODB", "MSSQL", "MySQL", "ORACLE", "PolarDB", "POLARDBX20", "POLARDB_O", "POSTGRESQL", "TERADATA"}, false), + }, + "source_endpoint_instance_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "source_endpoint_region": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "source_endpoint_ip": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "source_endpoint_port": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "source_endpoint_oracle_sid": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "source_endpoint_database_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "source_endpoint_user_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "source_endpoint_password": { + Type: schema.TypeString, + Optional: true, + }, + "source_endpoint_owner_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "source_endpoint_role": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "destination_endpoint_instance_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"ads", "CEN", "DATAHUB", "DG", "ECS", "EXPRESS", "GREENPLUM", "MONGODB", "OTHER", "PolarDB", "POLARDBX20", "RDS"}, false), + }, + "destination_endpoint_engine_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"ADB20", "ADB30", "AS400", "DATAHUB", "DB2", "GREENPLUM", "KAFKA", "MONGODB", "MSSQL", "MySQL", "ORACLE", "PolarDB", "POLARDBX20", "POLARDB_O", "PostgreSQL"}, false), + }, + "destination_endpoint_instance_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "destination_endpoint_region": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "destination_endpoint_ip": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "destination_endpoint_port": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "destination_endpoint_database_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "destination_endpoint_user_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "destination_endpoint_password": { + Type: schema.TypeString, + Optional: true, + }, + "destination_endpoint_oracle_sid": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "delay_notice": { + Type: schema.TypeBool, + Optional: true, + ForceNew: true, + }, + "delay_phone": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "delay_rule_time": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "error_notice": { + Type: schema.TypeBool, + Optional: true, + ForceNew: true, + }, + "error_phone": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"Synchronizing", "Suspending"}, false), + }, + }, + } +} + +func resourceAlicloudDtsSynchronizationJobCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "ConfigureDtsJob" + request := make(map[string]interface{}) + conn, err := client.NewDtsClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("dts_instance_id"); ok { + request["DtsInstanceId"] = v + } + request["DtsJobName"] = d.Get("dts_job_name") + if v, ok := d.GetOk("checkpoint"); ok { + request["Checkpoint"] = v + } + request["DataInitialization"] = d.Get("data_initialization") + request["DataSynchronization"] = d.Get("data_synchronization") + request["StructureInitialization"] = d.Get("structure_initialization") + request["SynchronizationDirection"] = d.Get("synchronization_direction") + request["DbList"] = d.Get("db_list") + if v, ok := d.GetOkExists("delay_notice"); ok { + request["DelayNotice"] = v + } + if v, ok := d.GetOk("delay_phone"); ok { + request["DelayPhone"] = v + } + if v, ok := d.GetOk("delay_rule_time"); ok { + request["DelayRuleTime"] = v + } + if v, ok := d.GetOk("destination_endpoint_database_name"); ok { + request["DestinationEndpointDataBaseName"] = v + } + if v, ok := d.GetOk("destination_endpoint_engine_name"); ok { + request["DestinationEndpointEngineName"] = v + } + if v, ok := d.GetOk("destination_endpoint_ip"); ok { + request["DestinationEndpointIP"] = v + } + if v, ok := d.GetOk("destination_endpoint_instance_id"); ok { + request["DestinationEndpointInstanceID"] = v + } + request["DestinationEndpointInstanceType"] = d.Get("destination_endpoint_instance_type") + if v, ok := d.GetOk("destination_endpoint_oracle_sid"); ok { + request["DestinationEndpointOracleSID"] = v + } + if v, ok := d.GetOk("destination_endpoint_password"); ok { + request["DestinationEndpointPassword"] = v + } + if v, ok := d.GetOk("destination_endpoint_port"); ok { + request["DestinationEndpointPort"] = v + } + if v, ok := d.GetOk("destination_endpoint_region"); ok { + request["DestinationEndpointRegion"] = v + } + if v, ok := d.GetOk("destination_endpoint_user_name"); ok { + request["DestinationEndpointUserName"] = v + } + if v, ok := d.GetOkExists("error_notice"); ok { + request["ErrorNotice"] = v + } + if v, ok := d.GetOk("error_phone"); ok { + request["ErrorPhone"] = v + } + request["JobType"] = "SYNC" + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("reserve"); ok { + request["Reserve"] = v + } + if v, ok := d.GetOk("source_endpoint_database_name"); ok { + request["SourceEndpointDatabaseName"] = v + } + if v, ok := d.GetOk("source_endpoint_engine_name"); ok { + request["SourceEndpointEngineName"] = v + } + if v, ok := d.GetOk("source_endpoint_ip"); ok { + request["SourceEndpointIP"] = v + } + if v, ok := d.GetOk("source_endpoint_instance_id"); ok { + request["SourceEndpointInstanceID"] = v + } + request["SourceEndpointInstanceType"] = d.Get("source_endpoint_instance_type") + if v, ok := d.GetOk("source_endpoint_oracle_sid"); ok { + request["SourceEndpointOracleSID"] = v + } + if v, ok := d.GetOk("source_endpoint_owner_id"); ok { + request["SourceEndpointOwnerID"] = v + } + if v, ok := d.GetOk("source_endpoint_password"); ok { + request["SourceEndpointPassword"] = v + } + if v, ok := d.GetOk("source_endpoint_port"); ok { + request["SourceEndpointPort"] = v + } + if v, ok := d.GetOk("source_endpoint_region"); ok { + request["SourceEndpointRegion"] = v + } + if v, ok := d.GetOk("source_endpoint_role"); ok { + request["SourceEndpointRole"] = v + } + if v, ok := d.GetOk("source_endpoint_user_name"); ok { + request["SourceEndpointUserName"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_dts_synchronization_job", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["DtsJobId"])) + d.Set("dts_instance_id", response["DtsInstanceId"]) + dtsService := DtsService{client} + stateConf := BuildStateConf([]string{}, []string{"Synchronizing"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, dtsService.DtsSynchronizationJobStateRefreshFunc(d.Id(), []string{"InitializeFailed"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudDtsSynchronizationJobUpdate(d, meta) +} +func resourceAlicloudDtsSynchronizationJobRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + dtsService := DtsService{client} + object, err := dtsService.DescribeDtsSynchronizationJob(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_dts_synchronization_job dtsService.DescribeDtsSynchronizationJob Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + migrationModeObj := object["MigrationMode"].(map[string]interface{}) + destinationEndpointObj := object["DestinationEndpoint"].(map[string]interface{}) + sourceEndpointObj := object["SourceEndpoint"].(map[string]interface{}) + d.Set("checkpoint", fmt.Sprint(formatInt(object["Checkpoint"]))) + d.Set("data_initialization", migrationModeObj["DataInitialization"]) + d.Set("data_synchronization", migrationModeObj["DataSynchronization"]) + d.Set("db_list", object["DbObject"]) + d.Set("destination_endpoint_database_name", destinationEndpointObj["DatabaseName"]) + d.Set("destination_endpoint_engine_name", destinationEndpointObj["EngineName"]) + d.Set("destination_endpoint_ip", destinationEndpointObj["Ip"]) + d.Set("destination_endpoint_instance_id", destinationEndpointObj["InstanceID"]) + d.Set("destination_endpoint_instance_type", destinationEndpointObj["InstanceType"]) + d.Set("destination_endpoint_oracle_sid", destinationEndpointObj["OracleSID"]) + d.Set("destination_endpoint_port", destinationEndpointObj["Port"]) + d.Set("destination_endpoint_region", destinationEndpointObj["Region"]) + d.Set("destination_endpoint_user_name", destinationEndpointObj["UserName"]) + d.Set("dts_instance_id", object["DtsInstanceID"]) + d.Set("dts_job_name", object["DtsJobName"]) + d.Set("source_endpoint_database_name", sourceEndpointObj["DatabaseName"]) + d.Set("source_endpoint_engine_name", sourceEndpointObj["EngineName"]) + d.Set("source_endpoint_ip", sourceEndpointObj["Ip"]) + d.Set("source_endpoint_instance_id", sourceEndpointObj["InstanceID"]) + d.Set("source_endpoint_instance_type", sourceEndpointObj["InstanceType"]) + d.Set("source_endpoint_oracle_sid", sourceEndpointObj["OracleSID"]) + d.Set("source_endpoint_owner_id", sourceEndpointObj["AliyunUid"]) + d.Set("source_endpoint_port", sourceEndpointObj["Port"]) + d.Set("source_endpoint_region", sourceEndpointObj["Region"]) + d.Set("source_endpoint_role", sourceEndpointObj["RoleName"]) + d.Set("source_endpoint_user_name", sourceEndpointObj["UserName"]) + d.Set("status", object["Status"]) + d.Set("structure_initialization", migrationModeObj["StructureInitialization"]) + d.Set("synchronization_direction", object["SynchronizationDirection"]) + + return nil +} +func resourceAlicloudDtsSynchronizationJobUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + d.Partial(true) + + update := false + request := map[string]interface{}{ + "DtsJobId": d.Id(), + } + if !d.IsNewResource() && d.HasChange("dts_job_name") { + update = true + request["DtsJobName"] = d.Get("dts_job_name") + } + request["RegionId"] = client.RegionId + if update { + action := "ModifyDtsJobName" + conn, err := client.NewDtsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + d.SetPartial("dts_job_name") + } + + modifyDtsJobPasswordReq := map[string]interface{}{ + "DtsJobId": d.Id(), + } + modifyDtsJobPasswordReq["RegionId"] = client.RegionId + if !d.IsNewResource() && d.HasChange("source_endpoint_password") { + + modifyDtsJobPasswordReq["Endpoint"] = "src" + if v, ok := d.GetOk("source_endpoint_password"); ok { + modifyDtsJobPasswordReq["Password"] = v + } + if v, ok := d.GetOk("source_endpoint_user_name"); ok { + modifyDtsJobPasswordReq["UserName"] = v + } + + action := "ModifyDtsJobPassword" + conn, err := client.NewDtsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, modifyDtsJobPasswordReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, modifyDtsJobPasswordReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + d.SetPartial("source_endpoint_password") + d.SetPartial("source_endpoint_user_name") + + target := d.Get("status").(string) + err = resourceAlicloudDtsSynchronizationJobStatusFlow(d, meta, target) + if err != nil { + return WrapError(Error(FailedToReachTargetStatus, d.Get("status"))) + } + } + + if !d.IsNewResource() && d.HasChange("destination_endpoint_password") { + + modifyDtsJobPasswordReq["Endpoint"] = "src" + if v, ok := d.GetOk("destination_endpoint_password"); ok { + modifyDtsJobPasswordReq["Password"] = v + } + if v, ok := d.GetOk("destination_endpoint_user_name"); ok { + modifyDtsJobPasswordReq["UserName"] = v + } + + action := "ModifyDtsJobPassword" + conn, err := client.NewDtsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, modifyDtsJobPasswordReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, modifyDtsJobPasswordReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + d.SetPartial("destination_endpoint_password") + d.SetPartial("destination_endpoint_user_name") + + target := d.Get("status").(string) + err = resourceAlicloudDtsSynchronizationJobStatusFlow(d, meta, target) + if err != nil { + return WrapError(Error(FailedToReachTargetStatus, d.Get("status"))) + } + } + + update = false + request = map[string]interface{}{ + "DtsJobId": d.Id(), + } + if !d.IsNewResource() && d.HasChange("instance_class") { + if v, ok := d.GetOk("instance_class"); ok { + request["InstanceClass"] = v + } + update = true + } + request["RegionId"] = client.RegionId + request["OrderType"] = "UPGRADE" + + if update { + action := "TransferInstanceClass" + conn, err := client.NewDtsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + } + + if !d.IsNewResource() && d.HasChange("status") { + target := d.Get("status").(string) + err := resourceAlicloudDtsSynchronizationJobStatusFlow(d, meta, target) + if err != nil { + return WrapError(Error(FailedToReachTargetStatus, d.Get("status"))) + } + } + + d.Partial(false) + return resourceAlicloudDtsSynchronizationJobRead(d, meta) +} +func resourceAlicloudDtsSynchronizationJobDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteDtsJob" + var response map[string]interface{} + conn, err := client.NewDtsClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "DtsJobId": d.Id(), + } + + if v, ok := d.GetOk("dts_instance_id"); ok { + request["DtsInstanceId"] = v + } + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"Forbidden.InstanceNotFound"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} + +func resourceAlicloudDtsSynchronizationJobStatusFlow(d *schema.ResourceData, meta interface{}, target string) error { + + client := meta.(*connectivity.AliyunClient) + dtsService := DtsService{client} + var response map[string]interface{} + object, err := dtsService.DescribeDtsSynchronizationJob(d.Id()) + if err != nil { + return WrapError(err) + } + if object["Status"].(string) != target { + if target == "Synchronizing" || target == "Suspending" { + request := map[string]interface{}{ + "DtsJobId": d.Id(), + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("synchronization_direction"); ok { + request["SynchronizationDirection"] = v + } + action := "StartDtsJob" + conn, err := client.NewDtsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Synchronizing"}, d.Timeout(schema.TimeoutUpdate), 60*time.Second, dtsService.DtsSynchronizationJobStateRefreshFunc(d.Id(), []string{"InitializeFailed"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + if target == "Suspending" { + request := map[string]interface{}{ + "DtsJobId": d.Id(), + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("synchronization_direction"); ok { + request["SynchronizationDirection"] = v + } + action := "SuspendDtsJob" + conn, err := client.NewDtsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Suspending"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, dtsService.DtsSynchronizationJobStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + d.SetPartial("status") + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_eais_instance.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_eais_instance.go new file mode 100644 index 00000000000..51b42fd4c8b --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_eais_instance.go @@ -0,0 +1,159 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudEaisInstance() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudEaisInstanceCreate, + Read: resourceAlicloudEaisInstanceRead, + Update: resourceAlicloudEaisInstanceUpdate, + Delete: resourceAlicloudEaisInstanceDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(5 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "force": { + Type: schema.TypeBool, + Optional: true, + }, + "instance_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "instance_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"eais.ei-a6.4xlarge", "eais.ei-a6.2xlarge", "eais.ei-a6.xlarge", "eais.ei-a6.large", "eais.ei-a6.medium"}, false), + }, + "security_group_id": { + Type: schema.TypeString, + Required: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "vswitch_id": { + Type: schema.TypeString, + Required: true, + }, + }, + } +} + +func resourceAlicloudEaisInstanceCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateEai" + request := make(map[string]interface{}) + conn, err := client.NewEaisClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("instance_name"); ok { + request["InstanceName"] = v + } + request["InstanceType"] = d.Get("instance_type") + request["RegionId"] = client.RegionId + request["SecurityGroupId"] = d.Get("security_group_id") + request["VSwitchId"] = d.Get("vswitch_id") + + request["ClientToken"] = buildClientToken("CreateEai") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-24"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_eais_instance", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["ElasticAcceleratedInstanceId"])) + eaisService := EaisService{client} + stateConf := BuildStateConf([]string{}, []string{"Available"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, eaisService.EaisInstanceStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudEaisInstanceRead(d, meta) +} +func resourceAlicloudEaisInstanceRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + eaisService := EaisService{client} + object, err := eaisService.DescribeEaisInstance(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_eais_instance eaisService.DescribeEaisInstance Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("instance_name", object["InstanceName"]) + d.Set("instance_type", object["InstanceType"]) + d.Set("status", object["Status"]) + return nil +} +func resourceAlicloudEaisInstanceUpdate(d *schema.ResourceData, meta interface{}) error { + log.Println(fmt.Sprintf("[WARNING] The resouce has not update operation.")) + return resourceAlicloudEaisInstanceRead(d, meta) +} +func resourceAlicloudEaisInstanceDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteEai" + var response map[string]interface{} + conn, err := client.NewEaisClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "ElasticAcceleratedInstanceId": d.Id(), + } + + if v, ok := d.GetOkExists("force"); ok { + request["Force"] = v + } + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-24"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecd_command.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecd_command.go new file mode 100644 index 00000000000..a4f19abb8fc --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecd_command.go @@ -0,0 +1,140 @@ +package alicloud + +import ( + "encoding/base64" + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudEcdCommand() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudEcdCommandCreate, + Read: resourceAlicloudEcdCommandRead, + Update: resourceAlicloudEcdCommandUpdate, + Delete: resourceAlicloudEcdCommandDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "command_content": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "command_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"RunBatScript", "RunPowerShellScript"}, false), + }, + "content_encoding": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"Base64", "PlainText"}, false), + }, + "desktop_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "timeout": { + Type: schema.TypeString, + Optional: true, + }, + }, + } +} + +func resourceAlicloudEcdCommandCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + ecdService := EcdService{client} + var response map[string]interface{} + action := "RunCommand" + request := make(map[string]interface{}) + conn, err := client.NewGwsecdClient() + if err != nil { + return WrapError(err) + } + request["CommandContent"] = d.Get("command_content") + request["Type"] = d.Get("command_type") + if v, ok := d.GetOk("content_encoding"); ok { + request["ContentEncoding"] = v + } + request["DesktopId.1"] = d.Get("desktop_id") + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("timeout"); ok { + request["Timeout"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_ecd_command", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["InvokeId"])) + stateConf := BuildStateConf([]string{}, []string{"Success"}, d.Timeout(schema.TimeoutCreate), 10*time.Second, ecdService.EcdCommandStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return resourceAlicloudEcdCommandUpdate(d, meta) +} +func resourceAlicloudEcdCommandRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + ecdService := EcdService{client} + object, err := ecdService.DescribeEcdCommand(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_ecd_command ecdService.DescribeEcdCommand Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + commandContent, _ := base64.StdEncoding.DecodeString(object["CommandContent"].(string)) + d.Set("command_content", string(commandContent)) + d.Set("command_type", object["CommandType"]) + d.Set("status", object["InvocationStatus"]) + temp1 := map[string]interface{}{} + if invokeDesktopsList, ok := object["InvokeDesktops"].([]interface{}); ok { + for _, v := range invokeDesktopsList { + if m1, ok := v.(map[string]interface{}); ok { + temp1 = map[string]interface{}{ + "desktop_id": m1["DesktopId"], + } + } + } + } + d.Set("desktop_id", temp1["desktop_id"]) + return nil +} +func resourceAlicloudEcdCommandUpdate(d *schema.ResourceData, meta interface{}) error { + log.Println(fmt.Sprintf("[WARNING] The resouce has not update operation.")) + return nil +} +func resourceAlicloudEcdCommandDelete(d *schema.ResourceData, meta interface{}) error { + log.Println(fmt.Sprintf("[WARNING] The resouce has not delete operation.")) + return nil + +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecd_desktop.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecd_desktop.go new file mode 100644 index 00000000000..cf18114dcf1 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecd_desktop.go @@ -0,0 +1,603 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudEcdDesktop() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudEcdDesktopCreate, + Read: resourceAlicloudEcdDesktopRead, + Update: resourceAlicloudEcdDesktopUpdate, + Delete: resourceAlicloudEcdDesktopDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(10 * time.Minute), + Delete: schema.DefaultTimeout(10 * time.Minute), + Update: schema.DefaultTimeout(20 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "amount": { + Type: schema.TypeInt, + Optional: true, + }, + "auto_pay": { + Type: schema.TypeBool, + Optional: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("payment_type"); ok && v.(string) == "Subscription" { + return false + } + return true + }, + }, + "auto_renew": { + Type: schema.TypeBool, + Optional: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("payment_type"); ok && v.(string) == "Subscription" { + return false + } + return true + }, + }, + "bundle_id": { + Type: schema.TypeString, + Required: true, + }, + "desktop_name": { + Type: schema.TypeString, + Optional: true, + }, + "desktop_type": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "office_site_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "end_user_ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "payment_type": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"PayAsYouGo", "Subscription"}, false), + }, + "period": { + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("payment_type"); ok && v.(string) == "Subscription" { + return false + } + return true + }, + }, + "period_unit": { + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("payment_type"); ok && v.(string) == "Subscription" { + return false + } + return true + }, + }, + "policy_group_id": { + Type: schema.TypeString, + Required: true, + }, + "root_disk_size_gib": { + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("status"); ok && v.(string) == "Stopped" { + return false + } + return true + }, + }, + "status": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"Running", "Stopped", "Pending", "Stopping", "Starting", "Expired", "Deleted"}, false), + }, + "stopped_mode": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"StopCharging", "KeepCharging"}, false), + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("status"); ok && v.(string) == "Stopped" { + return false + } + return true + }, + }, + "tags": tagsSchema(), + "user_assign_mode": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"ALL", "PER_USER"}, false), + }, + "user_disk_size_gib": { + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("status"); ok && v.(string) == "Stopped" { + return false + } + return true + }, + }, + "host_name": { + Type: schema.TypeString, + Optional: true, + }, + }, + } +} + +func resourceAlicloudEcdDesktopCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + ecdService := EcdService{client} + var response map[string]interface{} + action := "CreateDesktops" + request := make(map[string]interface{}) + conn, err := client.NewGwsecdClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("amount"); ok { + request["Amount"] = v + } + if v, ok := d.GetOkExists("auto_pay"); ok { + request["AutoPay"] = v + } + if v, ok := d.GetOkExists("auto_renew"); ok { + request["AutoRenew"] = v + } + request["BundleId"] = d.Get("bundle_id") + if v, ok := d.GetOk("desktop_name"); ok { + request["DesktopName"] = v + } + request["OfficeSiteId"] = d.Get("office_site_id") + + if m, ok := d.GetOk("end_user_ids"); ok { + for k, v := range m.([]interface{}) { + request[fmt.Sprintf("EndUserId.%d", k+1)] = v.(string) + } + } + + if v, ok := d.GetOk("payment_type"); ok { + request["ChargeType"] = convertEcdDesktopPaymentTypeRequest(v.(string)) + } + if v, ok := d.GetOk("period"); ok { + request["Period"] = v + } + if v, ok := d.GetOk("period_unit"); ok { + request["PeriodUnit"] = v + } + request["PolicyGroupId"] = d.Get("policy_group_id") + + request["RegionId"] = client.RegionId + + if v, ok := d.GetOk("tags"); ok { + count := 1 + for key, value := range v.(map[string]interface{}) { + request[fmt.Sprintf("Tag.%d.Key", count)] = key + request[fmt.Sprintf("Tag.%d.Value", count)] = value + count++ + } + } + if v, ok := d.GetOk("user_assign_mode"); ok { + request["UserAssignMode"] = v + } + if v, ok := d.GetOk("host_name"); ok { + request["HostName"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_ecd_desktop", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["DesktopId"].([]interface{})[0])) + + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutCreate), 10*time.Second, ecdService.EcdDesktopStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return resourceAlicloudEcdDesktopUpdate(d, meta) +} +func resourceAlicloudEcdDesktopRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + ecdService := EcdService{client} + object, err := ecdService.DescribeEcdDesktop(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_ecd_desktop ecdService.DescribeEcdDesktop Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("desktop_name", object["DesktopName"]) + d.Set("desktop_type", object["DesktopType"]) + d.Set("office_site_id", object["OfficeSiteId"]) + d.Set("end_user_ids", object["EndUserIds"]) + d.Set("payment_type", convertEcdDesktopPaymentTypeResponse(object["ChargeType"])) + d.Set("policy_group_id", object["PolicyGroupId"]) + d.Set("status", object["DesktopStatus"]) + d.Set("tags", tagsToMap(object["Tags"])) + return nil +} +func resourceAlicloudEcdDesktopUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + ecdService := EcdService{client} + var response map[string]interface{} + d.Partial(true) + + if !d.IsNewResource() && d.HasChange("tags") { + if err := ecdService.SetResourceTags(d, "ALIYUN::GWS::INSTANCE"); err != nil { + return WrapError(err) + } + d.SetPartial("tags") + } + request := map[string]interface{}{ + "DesktopId": d.Id(), + } + if !d.IsNewResource() && d.HasChange("desktop_name") { + if v, ok := d.GetOk("desktop_name"); ok { + request["NewDesktopName"] = v + } + request["RegionId"] = client.RegionId + action := "ModifyDesktopName" + conn, err := client.NewGwsecdClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("desktop_name") + } + + if !d.IsNewResource() && d.HasChange("policy_group_id") { + request := map[string]interface{}{ + "DesktopId.1": d.Id(), + } + request["PolicyGroupId"] = d.Get("policy_group_id") + request["RegionId"] = client.RegionId + + action := "ModifyDesktopsPolicyGroup" + conn, err := client.NewGwsecdClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("policy_group_id") + } + + if !d.IsNewResource() && d.HasChange("end_user_ids") { + request := map[string]interface{}{ + "DesktopId": d.Id(), + } + request["RegionId"] = client.RegionId + if m, ok := d.GetOk("end_user_ids"); ok { + for k, v := range m.([]interface{}) { + request[fmt.Sprintf("EndUserId.%d", k+1)] = v.(string) + } + } + action := "ModifyEntitlement" + conn, err := client.NewGwsecdClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("end_user_ids") + } + + if d.HasChange("status") { + object, err := ecdService.DescribeEcdDesktop(d.Id()) + if err != nil { + return WrapError(err) + } + target := d.Get("status").(string) + if object["DesktopStatus"].(string) != target { + if target == "Running" { + request := map[string]interface{}{ + "DesktopId.1": d.Id(), + } + request["RegionId"] = client.RegionId + action := "StartDesktops" + conn, err := client.NewGwsecdClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + if target == "Stopped" { + request := map[string]interface{}{ + "DesktopId.1": d.Id(), + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("stopped_mode"); ok { + request["StoppedMode"] = v + } + action := "StopDesktops" + conn, err := client.NewGwsecdClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + stateConf := BuildStateConf([]string{"Pending", "Starting", "Stopping"}, []string{"Running", "Stopped"}, d.Timeout(schema.TimeoutUpdate), 10*time.Second, ecdService.EcdDesktopStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + d.SetPartial("status") + } + } + if d.HasChange("desktop_type") || d.HasChange("root_disk_size_gib") || d.HasChange("user_disk_size_gib") { + request = map[string]interface{}{ + "DesktopId": d.Id(), + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("desktop_type"); ok { + request["DesktopType"] = v + } + if v, ok := d.GetOkExists("auto_pay"); ok { + request["AutoPay"] = v + } + if v, ok := d.GetOk("root_disk_size_gib"); ok { + request["RootDiskSizeGib"] = v + } + if v, ok := d.GetOk("user_disk_size_gib"); ok { + request["UserDiskSizeGib"] = v + } + action := "ModifyDesktopSpec" + conn, err := client.NewGwsecdClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{request["DesktopType"].(string)}, d.Timeout(schema.TimeoutUpdate), 10*time.Second, ecdService.EcdDesktopDesktopTypeRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + d.SetPartial("desktop_type") + } + + if !d.IsNewResource() && d.HasChange("payment_type") { + object, err := ecdService.DescribeEcdDesktop(d.Id()) + if err != nil { + return WrapError(err) + } + if convertEcdDesktopPaymentTypeResponse(object["ChargeType"]) != "Subscription" { + if object["DesktopStatus"].(string) == "Stopped" || object["DesktopStatus"].(string) == "Running" { + request := map[string]interface{}{ + "DesktopId.1": d.Id(), + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("payment_type"); ok { + request["ChargeType"] = convertEcdDesktopPaymentTypeRequest(v.(string)) + } + if v, ok := d.GetOk("period"); ok { + request["Period"] = v + } + if v, ok := d.GetOk("period_unit"); ok { + request["PeriodUnit"] = v + } + if v, ok := d.GetOkExists("auto_pay"); ok { + request["AutoPay"] = v + } + action := "ModifyDesktopChargeType" + conn, err := client.NewGwsecdClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Subscription"}, d.Timeout(schema.TimeoutUpdate), 10*time.Second, ecdService.EcdDesktopChargeTypeFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + } + d.SetPartial("payment_type") + } + d.Partial(false) + return resourceAlicloudEcdDesktopRead(d, meta) +} +func resourceAlicloudEcdDesktopDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + ecdService := EcdService{client} + action := "DeleteDesktops" + var response map[string]interface{} + conn, err := client.NewGwsecdClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "DesktopId.1": d.Id(), + } + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidChargeType.Unsupported"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{}, d.Timeout(schema.TimeoutDelete), 10*time.Second, ecdService.EcdDesktopStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return nil +} +func convertEcdDesktopPaymentTypeRequest(source interface{}) interface{} { + switch source { + case "PayAsYouGo": + return "PostPaid" + case "Subscription": + return "PrePaid" + } + return source +} +func convertEcdDesktopPaymentTypeResponse(source interface{}) interface{} { + switch source { + case "PostPaid": + return "PayAsYouGo" + case "PrePaid": + return "Subscription" + } + return source +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecd_image.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecd_image.go new file mode 100644 index 00000000000..8a7559dfa13 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecd_image.go @@ -0,0 +1,194 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudEcdImage() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudEcdImageCreate, + Read: resourceAlicloudEcdImageRead, + Update: resourceAlicloudEcdImageUpdate, + Delete: resourceAlicloudEcdImageDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(15 * time.Minute), + Delete: schema.DefaultTimeout(5 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "description": { + Type: schema.TypeString, + Optional: true, + }, + "desktop_id": { + Type: schema.TypeString, + Required: true, + }, + "image_name": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateNormalName, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudEcdImageCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateImage" + request := make(map[string]interface{}) + conn, err := client.NewGwsecdClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + request["DesktopId"] = d.Get("desktop_id") + if v, ok := d.GetOk("image_name"); ok { + request["ImageName"] = v + } + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_ecd_image", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["ImageId"])) + ecdService := EcdService{client} + stateConf := BuildStateConf([]string{}, []string{"Available"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, ecdService.EcdImageStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudEcdImageRead(d, meta) +} +func resourceAlicloudEcdImageRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + ecdService := EcdService{client} + object, err := ecdService.DescribeEcdImage(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_ecd_image ecdService.DescribeEcdImage Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("description", object["Description"]) + d.Set("image_name", object["Name"]) + d.Set("status", object["Status"]) + return nil +} +func resourceAlicloudEcdImageUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "ImageId": d.Id(), + } + if d.HasChange("description") { + update = true + } + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + request["RegionId"] = client.RegionId + if d.HasChange("image_name") { + update = true + if v, ok := d.GetOk("image_name"); ok { + request["Name"] = v + } + } + if update { + action := "ModifyImageAttribute" + conn, err := client.NewGwsecdClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + ecdService := EcdService{client} + stateConf := BuildStateConf([]string{}, []string{"Available"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, ecdService.EcdImageStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return resourceAlicloudEcdImageRead(d, meta) +} +func resourceAlicloudEcdImageDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + ecdService := EcdService{client} + action := "DeleteImages" + var response map[string]interface{} + conn, err := client.NewGwsecdClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "ImageId": []string{d.Id()}, + } + + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{}, d.Timeout(schema.TimeoutDelete), 5*time.Second, ecdService.EcdImageStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecd_nas_file_system.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecd_nas_file_system.go new file mode 100644 index 00000000000..307060d2b35 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecd_nas_file_system.go @@ -0,0 +1,207 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudEcdNasFileSystem() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudEcdNasFileSystemCreate, + Read: resourceAlicloudEcdNasFileSystemRead, + Update: resourceAlicloudEcdNasFileSystemUpdate, + Delete: resourceAlicloudEcdNasFileSystemDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(10 * time.Minute), + Delete: schema.DefaultTimeout(10 * time.Minute), + Update: schema.DefaultTimeout(10 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "description": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "mount_target_domain": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "file_system_id": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "nas_file_system_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "office_site_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "reset": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func resourceAlicloudEcdNasFileSystemCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateNASFileSystem" + request := make(map[string]interface{}) + conn, err := client.NewGwsecdClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + if v, ok := d.GetOk("nas_file_system_name"); ok { + request["Name"] = v + } + request["OfficeSiteId"] = d.Get("office_site_id") + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_ecd_nas_file_system", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["FileSystemId"])) + ecdService := EcdService{client} + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutCreate), 10*time.Second, ecdService.EcdNasFileSystemStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudEcdNasFileSystemUpdate(d, meta) +} +func resourceAlicloudEcdNasFileSystemRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + ecdService := EcdService{client} + object, err := ecdService.DescribeEcdNasFileSystem(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_ecd_nas_file_system ecdService.DescribeEcdNasFileSystem Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("description", object["Description"]) + d.Set("mount_target_domain", object["MountTargetDomain"]) + d.Set("nas_file_system_name", object["FileSystemName"]) + d.Set("office_site_id", object["OfficeSiteId"]) + d.Set("status", object["FileSystemStatus"]) + d.Set("file_system_id", object["FileSystemId"]) + return nil +} +func resourceAlicloudEcdNasFileSystemUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + ecdService := EcdService{client} + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "FileSystemId": d.Id(), + "RegionId": client.RegionId, + } + if d.HasChange("reset") { + if v, ok := d.GetOk("reset"); ok && v.(bool) { + update = true + } + } + if update { + action := "ResetNASDefaultMountTarget" + conn, err := client.NewGwsecdClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, ecdService.EcdNasFileSystemStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return resourceAlicloudEcdNasFileSystemRead(d, meta) +} +func resourceAlicloudEcdNasFileSystemDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + ecdService := EcdService{client} + action := "DeleteNASFileSystems" + var response map[string]interface{} + conn, err := client.NewGwsecdClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "FileSystemId": []string{d.Id()}, + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{}, d.Timeout(schema.TimeoutDelete), 5*time.Second, ecdService.EcdNasFileSystemStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecd_network_package.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecd_network_package.go new file mode 100644 index 00000000000..80995dcae63 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecd_network_package.go @@ -0,0 +1,179 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudEcdNetworkPackage() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudEcdNetworkPackageCreate, + Read: resourceAlicloudEcdNetworkPackageRead, + Update: resourceAlicloudEcdNetworkPackageUpdate, + Delete: resourceAlicloudEcdNetworkPackageDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "bandwidth": { + Type: schema.TypeInt, + Required: true, + }, + "office_site_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "internet_charge_type": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudEcdNetworkPackageCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateNetworkPackage" + request := make(map[string]interface{}) + ecdService := EcdService{client} + conn, err := client.NewGwsecdClient() + if err != nil { + return WrapError(err) + } + + request["Bandwidth"] = d.Get("bandwidth") + + request["OfficeSiteId"] = d.Get("office_site_id") + + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_ecd_network_package", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["NetworkPackageId"])) + + stateConf := BuildStateConf([]string{"Creating"}, []string{"InUse"}, d.Timeout(schema.TimeoutDelete), 5*time.Second, ecdService.EcdNetworkPackageRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return resourceAlicloudEcdNetworkPackageRead(d, meta) +} +func resourceAlicloudEcdNetworkPackageRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + ecdService := EcdService{client} + object, err := ecdService.DescribeEcdNetworkPackage(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_ecd_network_package ecdService.DescribeEcdNetworkPackage Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + if v, ok := object["Bandwidth"]; ok && fmt.Sprint(v) != "0" { + d.Set("bandwidth", formatInt(v)) + } + d.Set("internet_charge_type", object["InternetChargeType"]) + d.Set("office_site_id", object["OfficeSiteId"]) + d.Set("status", object["NetworkPackageStatus"]) + return nil +} +func resourceAlicloudEcdNetworkPackageUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + request := map[string]interface{}{ + "RegionId": client.RegionId, + "NetworkPackageId": d.Id(), + } + if d.HasChange("bandwidth") { + request["Bandwidth"] = d.Get("bandwidth") + } + action := "ModifyNetworkPackage" + ecdService := EcdService{client} + conn, err := client.NewGwsecdClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) || IsExpectedErrors(err, []string{"IncorrectNetworkPackageStatus.ModificationNotSupport"}) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{"Creating"}, []string{"InUse"}, d.Timeout(schema.TimeoutDelete), 5*time.Second, ecdService.EcdNetworkPackageRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return resourceAlicloudEcdNetworkPackageRead(d, meta) +} +func resourceAlicloudEcdNetworkPackageDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteNetworkPackages" + var response map[string]interface{} + ecdService := EcdService{client} + conn, err := client.NewGwsecdClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "NetworkPackageId": []string{d.Id()}, + } + + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) || IsExpectedErrors(err, []string{"IncorrectNetworkPackageStatus.DeletionNotSupport"}) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{"Releasing"}, []string{}, d.Timeout(schema.TimeoutDelete), 5*time.Second, ecdService.EcdNetworkPackageRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecd_simple_office_site.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecd_simple_office_site.go new file mode 100644 index 00000000000..32b7230d440 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecd_simple_office_site.go @@ -0,0 +1,394 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudEcdSimpleOfficeSite() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudEcdSimpleOfficeSiteCreate, + Read: resourceAlicloudEcdSimpleOfficeSiteRead, + Update: resourceAlicloudEcdSimpleOfficeSiteUpdate, + Delete: resourceAlicloudEcdSimpleOfficeSiteDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "bandwidth": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + ValidateFunc: validation.IntBetween(0, 200), + Deprecated: "Field 'bandwidth' has been deprecated from provider version 1.142.0.", + }, + "cen_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "cen_owner_id": { + Type: schema.TypeString, + Optional: true, + }, + "cidr_block": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "desktop_access_type": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"Any", "Internet", "VPC"}, false), + }, + "enable_admin_access": { + Type: schema.TypeBool, + Computed: true, + Optional: true, + ForceNew: true, + }, + "enable_cross_desktop_access": { + Type: schema.TypeBool, + Computed: true, + Optional: true, + }, + "enable_internet_access": { + Type: schema.TypeBool, + Computed: true, + Optional: true, + Deprecated: "Field 'enable_internet_access' has been deprecated from provider version 1.142.0.", + }, + "mfa_enabled": { + Type: schema.TypeBool, + Computed: true, + Optional: true, + }, + "office_site_name": { + Type: schema.TypeString, + Optional: true, + }, + "sso_enabled": { + Type: schema.TypeBool, + Computed: true, + Optional: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudEcdSimpleOfficeSiteCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateSimpleOfficeSite" + request := make(map[string]interface{}) + conn, err := client.NewGwsecdClient() + if err != nil { + return WrapError(err) + } + request["CidrBlock"] = d.Get("cidr_block") + request["RegionId"] = client.RegionId + if v, ok := d.GetOkExists("enable_admin_access"); ok { + request["EnableAdminAccess"] = v + } + if v, ok := d.GetOk("cen_owner_id"); ok { + request["CenOwnerId"] = v + } + if v, ok := d.GetOk("cen_id"); ok { + request["CenId"] = v + } + if v, ok := d.GetOk("office_site_name"); ok { + request["OfficeSiteName"] = v + } + + // todo: you can configure it using alicloud_ecd_network_package + if v, ok := d.GetOkExists("enable_internet_access"); ok { + request["EnableInternetAccess"] = v + } + if v, ok := d.GetOk("bandwidth"); ok { + request["Bandwidth"] = v + } + + if v, ok := d.GetOk("desktop_access_type"); ok { + request["DesktopAccessType"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_ecd_simple_office_site", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["OfficeSiteId"])) + ecdService := EcdService{client} + stateConf := BuildStateConf([]string{}, []string{"REGISTERED"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, ecdService.EcdSimpleOfficeSiteStateRefreshFunc(d.Id())) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudEcdSimpleOfficeSiteUpdate(d, meta) +} +func resourceAlicloudEcdSimpleOfficeSiteRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + ecdService := EcdService{client} + object, err := ecdService.DescribeEcdSimpleOfficeSite(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_ecd_simple_office_site ecdService.DescribeEcdSimpleOfficeSite Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + // todo: bandwidth depends on network_package resource, you can find it in alicloud_ecd_network_package + if v, ok := object["Bandwidth"]; ok && fmt.Sprint(v) != "0" { + d.Set("bandwidth", formatInt(v)) + } + d.Set("cen_id", object["CenId"]) + d.Set("cidr_block", object["CidrBlock"]) + d.Set("desktop_access_type", convertDesktopAccessType(object["DesktopAccessType"])) + d.Set("enable_admin_access", object["EnableAdminAccess"]) + d.Set("enable_cross_desktop_access", object["EnableCrossDesktopAccess"]) + d.Set("office_site_name", object["Name"]) + d.Set("mfa_enabled", object["MfaEnabled"]) + d.Set("enable_internet_access", object["EnableInternetAccess"]) + d.Set("sso_enabled", object["SsoEnabled"]) + d.Set("status", object["Status"]) + return nil +} +func resourceAlicloudEcdSimpleOfficeSiteUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + d.Partial(true) + update := false + request := map[string]interface{}{ + "OfficeSiteId": d.Id(), + } + if d.HasChange("enable_cross_desktop_access") { + update = true + if v, ok := d.GetOkExists("enable_cross_desktop_access"); ok { + request["EnableCrossDesktopAccess"] = v + } + } + if update { + request["RegionId"] = client.RegionId + action := "ModifyOfficeSiteCrossDesktopAccess" + conn, err := client.NewGwsecdClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) || IsExpectedErrors(err, []string{"DirectoryNotReady"}) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("enable_cross_desktop_access") + } + + update = false + request = map[string]interface{}{ + "OfficeSiteId": d.Id(), + } + if d.HasChange("mfa_enabled") { + update = true + if v, ok := d.GetOkExists("mfa_enabled"); ok { + request["MfaEnabled"] = v + } + } + if update { + request["RegionId"] = client.RegionId + action := "ModifyOfficeSiteMfaEnabled" + conn, err := client.NewGwsecdClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) || IsExpectedErrors(err, []string{"DirectoryNotReady"}) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("mfa_enabled") + } + + update = false + request = map[string]interface{}{ + "OfficeSiteId": d.Id(), + } + if d.HasChange("sso_enabled") { + update = true + request["RegionId"] = client.RegionId + if v, ok := d.GetOkExists("sso_enabled"); ok { + request["EnableSso"] = v + } + } + if update { + action := "SetOfficeSiteSsoStatus" + conn, err := client.NewGwsecdClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) || IsExpectedErrors(err, []string{"DirectoryNotReady"}) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("sso_enabled") + } + + update = false + request = map[string]interface{}{ + "OfficeSiteId": d.Id(), + } + if !d.IsNewResource() && d.HasChange("desktop_access_type") { + update = true + } + if v, ok := d.GetOk("desktop_access_type"); ok { + request["DesktopAccessType"] = v + } + if !d.IsNewResource() && d.HasChange("office_site_name") { + update = true + } + if v, ok := d.GetOk("office_site_name"); ok { + request["OfficeSiteName"] = v + } + if update { + request["RegionId"] = client.RegionId + action := "ModifyOfficeSiteAttribute" + conn, err := client.NewGwsecdClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) || IsExpectedErrors(err, []string{"DirectoryNotReady"}) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("desktop_access_type") + d.SetPartial("office_site_name") + } + d.Partial(false) + return resourceAlicloudEcdSimpleOfficeSiteRead(d, meta) +} +func resourceAlicloudEcdSimpleOfficeSiteDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + ecdService := EcdService{client} + object, err := ecdService.DescribeEcdSimpleOfficeSite(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_ecd_simple_office_site ecdService.DescribeEcdSimpleOfficeSite Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + if object["EnableInternetAccess"] == true { + log.Printf("[WARN] Cannot destroy resource EcdSimpleOfficeSite. Terraform will remove this resource from the state file, however resources may remain.") + return nil + } + action := "DeleteOfficeSites" + var response map[string]interface{} + conn, err := client.NewGwsecdClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "OfficeSiteId": []string{d.Id()}, + } + + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} + +func convertDesktopAccessType(source interface{}) interface{} { + switch source.(string) { + case "ANY": + return "Any" + case "INTERNET": + return "Internet" + case "VPC": + return "VPC" + default: + return source + } +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecd_user.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecd_user.go new file mode 100644 index 00000000000..9db0fc30515 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecd_user.go @@ -0,0 +1,266 @@ +package alicloud + +import ( + "fmt" + "log" + "strconv" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudEcdUser() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudEcdUserCreate, + Read: resourceAlicloudEcdUserRead, + Update: resourceAlicloudEcdUserUpdate, + Delete: resourceAlicloudEcdUserDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "email": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "end_user_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "password": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Sensitive: true, + }, + "phone": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"Unlocked", "Locked"}, false), + }, + }, + } +} + +func resourceAlicloudEcdUserCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateUsers" + request := make(map[string]interface{}) + conn, err := client.NewEdsuserClient() + if err != nil { + return WrapError(err) + } + + requestUsers := make(map[string]interface{}) + requestUsersMap := make([]interface{}, 0) + + requestUsers["Email"] = d.Get("email") + requestUsers["EndUserId"] = d.Get("end_user_id") + if v, ok := d.GetOk("password"); ok { + requestUsers["Password"] = v + } + if v, ok := d.GetOk("phone"); ok { + requestUsers["Phone"] = v + } + + requestUsersMap = append(requestUsersMap, requestUsers) + request["Users"] = requestUsersMap + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-03-08"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + if IsExpectedErrors(err, []string{"Forbidden"}) { + conn.Endpoint = String(connectivity.EcdOpenAPIEndpointUser) + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_ecd_user", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(requestUsers["EndUserId"])) + edsUserService := EdsUserService{client} + + stateConf := BuildStateConf([]string{}, []string{"Unlocked", "Locked"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, edsUserService.EcdUserStateRefreshFunc(d.Id())) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudEcdUserUpdate(d, meta) +} +func resourceAlicloudEcdUserRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + edsUserService := EdsUserService{client} + object, err := edsUserService.DescribeEcdUser(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_ecd_user edsUserService.DescribeEcdUser Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + + d.Set("end_user_id", d.Id()) + d.Set("email", object["Email"]) + d.Set("phone", object["Phone"]) + d.Set("status", convertEcdUserStatusResponse(fmt.Sprint(formatInt(object["Status"])))) + return nil +} +func resourceAlicloudEcdUserUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + edsUserService := EdsUserService{client} + var response map[string]interface{} + d.Partial(true) + + if d.HasChange("status") { + object, err := edsUserService.DescribeEcdUser(d.Id()) + if err != nil { + return WrapError(err) + } + if target, ok := d.GetOk("status"); ok { + if convertEcdUserStatusRequest(strconv.Itoa(formatInt(object["Status"]))) != target { + if target == "Unlocked" { + request := map[string]interface{}{ + "Users": []string{d.Id()}, + } + + action := "UnlockUsers" + conn, err := client.NewEdsuserClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-03-08"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + if IsExpectedErrors(err, []string{"Forbidden"}) { + conn.Endpoint = String(connectivity.EcdOpenAPIEndpointUser) + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + if target == "Locked" { + request := map[string]interface{}{ + "Users": []string{d.Id()}, + } + + action := "LockUsers" + conn, err := client.NewEdsuserClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-03-08"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + if IsExpectedErrors(err, []string{"Forbidden"}) { + conn.Endpoint = String(connectivity.EcdOpenAPIEndpointUser) + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + d.SetPartial("status") + } + } + + } + d.Partial(false) + return resourceAlicloudEcdUserRead(d, meta) +} +func resourceAlicloudEcdUserDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "RemoveUsers" + var response map[string]interface{} + conn, err := client.NewEdsuserClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "Users": []string{d.Id()}, + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-03-08"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + if IsExpectedErrors(err, []string{"Forbidden"}) { + conn.Endpoint = String(connectivity.EcdOpenAPIEndpointUser) + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} +func convertEcdUserStatusResponse(source string) string { + switch source { + case "0": + return "Unlocked" + case "9": + return "Locked" + } + return source +} +func convertEcdUserStatusRequest(source string) string { + switch source { + case "Unlocked": + return "0" + case "Locked": + return "9" + } + return source +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_eci_container_group.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_eci_container_group.go index 72a79313412..22a72aa62f6 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_eci_container_group.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_eci_container_group.go @@ -478,6 +478,26 @@ func resourceAlicloudEciContainerGroup() *schema.Resource { Computed: true, ForceNew: true, }, + "image_registry_credential": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "password": { + Type: schema.TypeString, + Required: true, + }, + "server": { + Type: schema.TypeString, + Required: true, + }, + "user_name": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, }, } } @@ -714,6 +734,18 @@ func resourceAlicloudEciContainerGroupCreate(d *schema.ResourceData, meta interf request["ZoneId"] = vsw.ZoneId } } + if v, ok := d.GetOk("image_registry_credential"); ok { + imageRegisryCredentialMaps := make([]map[string]interface{}, 0) + for _, raw := range v.(*schema.Set).List() { + obj := raw.(map[string]interface{}) + imageRegisryCredentialMaps = append(imageRegisryCredentialMaps, map[string]interface{}{ + "Password": obj["password"], + "Server": obj["server"], + "UserName": obj["user_name"], + }) + } + request["ImageRegistryCredential"] = imageRegisryCredentialMaps + } runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) request["ClientToken"] = buildClientToken("CreateContainerGroup") @@ -1145,6 +1177,21 @@ func resourceAlicloudEciContainerGroupUpdate(d *schema.ResourceData, meta interf request["Volume"] = Volumes } + if d.HasChange("image_registry_credential") { + update = true + if v, ok := d.GetOk("image_registry_credential"); ok { + imageRegisryCredentialMaps := make([]map[string]interface{}, 0) + for _, raw := range v.(*schema.Set).List() { + obj := raw.(map[string]interface{}) + imageRegisryCredentialMaps = append(imageRegisryCredentialMaps, map[string]interface{}{ + "Password": obj["password"], + "Server": obj["server"], + "UserName": obj["user_name"], + }) + } + request["ImageRegistryCredential"] = imageRegisryCredentialMaps + } + } if update { action := "UpdateContainerGroup" conn, err := client.NewEciClient() diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_eci_virtual_node.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_eci_virtual_node.go new file mode 100644 index 00000000000..a2a32448d10 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_eci_virtual_node.go @@ -0,0 +1,238 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudEciVirtualNode() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudEciVirtualNodeCreate, + Read: resourceAlicloudEciVirtualNodeRead, + Update: resourceAlicloudEciVirtualNodeUpdate, + Delete: resourceAlicloudEciVirtualNodeDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(5 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "eip_instance_id": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + }, + "enable_public_network": { + Type: schema.TypeBool, + Optional: true, + ForceNew: true, + }, + "kube_config": { + Type: schema.TypeString, + Required: true, + }, + "resource_group_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "security_group_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "tags": { + Type: schema.TypeMap, + Optional: true, + ForceNew: true, + }, + "taints": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "effect": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"NoSchedule", "NoExecute", "PreferNoSchedule"}, false), + }, + "key": { + Type: schema.TypeString, + Optional: true, + }, + "value": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "vswitch_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "virtual_node_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile("^[\u4e00-\u9fa5a-zA-Z][\u4e00-\u9fa5a-zA-Z0-9-_:]{1,127}$"), "The length of the name is limited to `2` to `128` characters. It can contain uppercase and lowercase letters, Chinese characters, numbers, half-width colon (:), underscores (_), or hyphens (-), and must start with letters."), + }, + "zone_id": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudEciVirtualNodeCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateVirtualNode" + request := make(map[string]interface{}) + conn, err := client.NewEciClient() + if err != nil { + return WrapError(err) + } + request["RegionId"] = client.RegionId + request["VSwitchId"] = d.Get("vswitch_id") + request["KubeConfig"] = d.Get("kube_config") + request["SecurityGroupId"] = d.Get("security_group_id") + if v, ok := d.GetOk("eip_instance_id"); ok { + request["EipInstanceId"] = v + } + if v, ok := d.GetOkExists("enable_public_network"); ok { + request["EnablePublicNetwork"] = v + } + + if v, ok := d.GetOk("resource_group_id"); ok { + request["ResourceGroupId"] = v + } + if v, ok := d.GetOk("tags"); ok { + index := 1 + for key, value := range v.(map[string]interface{}) { + request[fmt.Sprintf("Tag.%d.Key", index)] = key + request[fmt.Sprintf("Tag.%d.Value", index)] = value.(string) + index = index + 1 + } + } + if m, ok := d.GetOk("taints"); ok { + for k, v := range m.(*schema.Set).List() { + taint := v.(map[string]interface{}) + request[fmt.Sprintf("Taint.%d.Key", k+1)] = taint["key"].(string) + request[fmt.Sprintf("Taint.%d.Value", k+1)] = taint["value"].(string) + request[fmt.Sprintf("Taint.%d.Effect", k+1)] = taint["effect"].(string) + } + } + if v, ok := d.GetOk("virtual_node_name"); ok { + request["VirtualNodeName"] = v + } + if v, ok := d.GetOk("zone_id"); ok { + request["ZoneId"] = v + } + request["ClientToken"] = buildClientToken("CreateVirtualNode") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-08-08"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_eci_virtual_node", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["VirtualNodeId"])) + eciService := EciService{client} + stateConf := BuildStateConf([]string{}, []string{"Ready"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, eciService.EciVirtualNodeStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudEciVirtualNodeRead(d, meta) +} +func resourceAlicloudEciVirtualNodeRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + eciService := EciService{client} + object, err := eciService.DescribeEciVirtualNode(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_eci_virtual_node eciService.DescribeEciVirtualNode Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("resource_group_id", object["ResourceGroupId"]) + d.Set("security_group_id", object["SecurityGroupId"]) + d.Set("status", object["Status"]) + d.Set("vswitch_id", object["VSwitchId"]) + d.Set("virtual_node_name", object["VirtualNodeName"]) + d.Set("zone_id", object["ZoneId"]) + d.Set("tags", tagsToMap(object["Tags"])) + return nil +} +func resourceAlicloudEciVirtualNodeUpdate(d *schema.ResourceData, meta interface{}) error { + log.Println(fmt.Sprintf("[WARNING] The resouce has not update operation.")) + return resourceAlicloudEciVirtualNodeRead(d, meta) +} +func resourceAlicloudEciVirtualNodeDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteVirtualNode" + var response map[string]interface{} + conn, err := client.NewEciClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "VirtualNodeId": d.Id(), + } + + request["RegionId"] = client.RegionId + request["ClientToken"] = buildClientToken("DeleteVirtualNode") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-08-08"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_dedicated_host.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_dedicated_host.go index 5e124a11368..21d334b7de9 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_dedicated_host.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_dedicated_host.go @@ -43,6 +43,7 @@ func resourceAlicloudEcsDedicatedHost() *schema.Resource { "auto_release_time": { Type: schema.TypeString, Optional: true, + Computed: true, }, "auto_renew": { Type: schema.TypeBool, @@ -112,8 +113,8 @@ func resourceAlicloudEcsDedicatedHost() *schema.Resource { "payment_type": { Type: schema.TypeString, Optional: true, + Computed: true, ValidateFunc: validation.StringInSlice([]string{"PostPaid", "PrePaid"}, false), - Default: "PostPaid", }, "resource_group_id": { Type: schema.TypeString, @@ -275,7 +276,6 @@ func resourceAlicloudEcsDedicatedHostRead(d *schema.ResourceData, meta interface d.Set("dedicated_host_name", object["DedicatedHostName"]) d.Set("dedicated_host_type", object["DedicatedHostType"]) d.Set("description", object["Description"]) - d.Set("expired_time", object["ExpiredTime"]) networkAttributesSli := make([]map[string]interface{}, 0) if len(object["NetworkAttributes"].(map[string]interface{})) > 0 { @@ -545,6 +545,10 @@ func resourceAlicloudEcsDedicatedHostUpdate(d *schema.ResourceData, meta interfa return resourceAlicloudEcsDedicatedHostRead(d, meta) } func resourceAlicloudEcsDedicatedHostDelete(d *schema.ResourceData, meta interface{}) error { + if d.Get("payment_type").(string) == "PrePaid" { + log.Printf("[WARN] Cannot destroy Subscription resource: alicloud_ecs_dedicated_host. Terraform will remove this resource from the state file, however resources may remain.") + return nil + } client := meta.(*connectivity.AliyunClient) action := "ReleaseDedicatedHost" var response map[string]interface{} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_dedicated_host_cluster.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_dedicated_host_cluster.go new file mode 100644 index 00000000000..278d18b0dc7 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_dedicated_host_cluster.go @@ -0,0 +1,202 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudEcsDedicatedHostCluster() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudEcsDedicatedHostClusterCreate, + Read: resourceAlicloudEcsDedicatedHostClusterRead, + Update: resourceAlicloudEcsDedicatedHostClusterUpdate, + Delete: resourceAlicloudEcsDedicatedHostClusterDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "dedicated_host_cluster_name": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-zA-Z][a-zA-Z0-9_\-.]{1,127}$`), "The reason must be 2 to 128 characters in length, and must start with a letter. It can contain digits, periods (.), underscores (_), and hyphens (-)."), + }, + "description": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(2, 256), + }, + "dry_run": { + Type: schema.TypeBool, + Optional: true, + }, + "tags": tagsSchema(), + "zone_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudEcsDedicatedHostClusterCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateDedicatedHostCluster" + request := make(map[string]interface{}) + conn, err := client.NewEcsClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("dedicated_host_cluster_name"); ok { + request["DedicatedHostClusterName"] = v + } + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("tags"); ok { + count := 1 + for key, value := range v.(map[string]interface{}) { + request[fmt.Sprintf("Tag.%d.Key", count)] = key + request[fmt.Sprintf("Tag.%d.Value", count)] = value + count++ + } + } + request["ZoneId"] = d.Get("zone_id") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-26"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_ecs_dedicated_host_cluster", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["DedicatedHostClusterId"])) + + return resourceAlicloudEcsDedicatedHostClusterRead(d, meta) +} +func resourceAlicloudEcsDedicatedHostClusterRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + ecsService := EcsService{client} + object, err := ecsService.DescribeEcsDedicatedHostCluster(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_ecs_dedicated_host_cluster ecsService.DescribeEcsDedicatedHostCluster Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("dedicated_host_cluster_name", object["DedicatedHostClusterName"]) + d.Set("description", object["Description"]) + if v, ok := object["Tags"].(map[string]interface{}); ok { + d.Set("tags", tagsToMap(v["Tag"])) + } + d.Set("zone_id", object["ZoneId"]) + return nil +} +func resourceAlicloudEcsDedicatedHostClusterUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + ecsService := EcsService{client} + conn, err := client.NewEcsClient() + if err != nil { + return WrapError(err) + } + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "DedicatedHostClusterId": d.Id(), + } + request["RegionId"] = client.RegionId + if d.HasChange("tags") { + if err := ecsService.SetResourceTags(d, "ddhcluster"); err != nil { + return WrapError(err) + } + d.SetPartial("tags") + } + if d.HasChange("dedicated_host_cluster_name") { + update = true + if v, ok := d.GetOk("dedicated_host_cluster_name"); ok { + request["DedicatedHostClusterName"] = v + } + } + if d.HasChange("description") { + update = true + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + } + if update { + action := "ModifyDedicatedHostClusterAttribute" + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-26"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudEcsDedicatedHostClusterRead(d, meta) +} +func resourceAlicloudEcsDedicatedHostClusterDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteDedicatedHostCluster" + var response map[string]interface{} + conn, err := client.NewEcsClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "DedicatedHostClusterId": d.Id(), + } + + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-26"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_deployment_set.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_deployment_set.go new file mode 100644 index 00000000000..f24ec8ba916 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_deployment_set.go @@ -0,0 +1,224 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudEcsDeploymentSet() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudEcsDeploymentSetCreate, + Read: resourceAlicloudEcsDeploymentSetRead, + Update: resourceAlicloudEcsDeploymentSetUpdate, + Delete: resourceAlicloudEcsDeploymentSetDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "deployment_set_name": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^([\w\\:\-]){2,128}$`), "\t\nThe name of the deployment set.\n\nThe name must be 2 to 128 characters in length and can contain letters, digits, colons (:), underscores (_), and hyphens (-)."), + }, + "description": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(2, 256), + }, + "domain": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Default"}, false), + }, + "granularity": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Host"}, false), + }, + "on_unable_to_redeploy_failed_instance": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"CancelMembershipAndStart", "KeepStopped"}, false), + }, + "strategy": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Availability"}, false), + }, + }, + } +} + +func resourceAlicloudEcsDeploymentSetCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateDeploymentSet" + request := make(map[string]interface{}) + conn, err := client.NewEcsClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("deployment_set_name"); ok { + request["DeploymentSetName"] = v + } + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + if v, ok := d.GetOk("domain"); ok { + request["Domain"] = v + } + if v, ok := d.GetOk("granularity"); ok { + request["Granularity"] = v + } + if v, ok := d.GetOk("on_unable_to_redeploy_failed_instance"); ok { + request["OnUnableToRedeployFailedInstance"] = v + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("strategy"); ok { + request["Strategy"] = v + } + request["ClientToken"] = buildClientToken("CreateDeploymentSet") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-26"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_ecs_deployment_set", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["DeploymentSetId"])) + + return resourceAlicloudEcsDeploymentSetRead(d, meta) +} +func resourceAlicloudEcsDeploymentSetRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + ecsService := EcsService{client} + object, err := ecsService.DescribeEcsDeploymentSet(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_ecs_deployment_set ecsService.DescribeEcsDeploymentSet Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("domain", convertEcsDeploymentSetDomainResponse(object["Domain"])) + d.Set("granularity", convertEcsDeploymentSetGranularityResponse(object["Granularity"])) + d.Set("deployment_set_name", object["DeploymentSetName"]) + d.Set("description", object["DeploymentSetDescription"]) + d.Set("strategy", object["DeploymentStrategy"]) + + return nil +} +func resourceAlicloudEcsDeploymentSetUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + conn, err := client.NewEcsClient() + if err != nil { + return WrapError(err) + } + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "DeploymentSetId": d.Id(), + } + request["RegionId"] = client.RegionId + if d.HasChange("deployment_set_name") { + update = true + if v, ok := d.GetOk("deployment_set_name"); ok { + request["DeploymentSetName"] = v + } + } + if d.HasChange("description") { + update = true + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + } + if update { + action := "ModifyDeploymentSetAttribute" + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-26"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudEcsDeploymentSetRead(d, meta) +} +func resourceAlicloudEcsDeploymentSetDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteDeploymentSet" + var response map[string]interface{} + conn, err := client.NewEcsClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "DeploymentSetId": d.Id(), + } + + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-26"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} +func convertEcsDeploymentSetDomainResponse(source interface{}) interface{} { + switch source { + case "default": + return "Default" + } + return source +} +func convertEcsDeploymentSetGranularityResponse(source interface{}) interface{} { + switch source { + case "host": + return "Host" + } + return source +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_disk.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_disk.go index 81c76ed6826..3766ce95157 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_disk.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_disk.go @@ -440,11 +440,12 @@ func resourceAlicloudEcsDiskUpdate(d *schema.ResourceData, meta interface{}) err } update = false modifyDiskChargeTypeReq := map[string]interface{}{ - "DiskIds": d.Id(), + "DiskIds": convertListToJsonString([]interface{}{d.Id()}), } if !d.IsNewResource() && d.HasChange("instance_id") { update = true } + modifyDiskChargeTypeReq["ClientToken"] = buildClientToken("ModifyDiskChargeType") modifyDiskChargeTypeReq["InstanceId"] = d.Get("instance_id") modifyDiskChargeTypeReq["RegionId"] = client.RegionId modifyDiskChargeTypeReq["AutoPay"] = true diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_hpc_cluster.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_hpc_cluster.go index 5d37ad59bce..e5810fee205 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_hpc_cluster.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_hpc_cluster.go @@ -77,6 +77,10 @@ func resourceAlicloudEcsHpcClusterRead(d *schema.ResourceData, meta interface{}) } func resourceAlicloudEcsHpcClusterUpdate(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) + conn, err := client.NewEcsClient() + if err != nil { + return WrapError(err) + } var response map[string]interface{} update := false request := map[string]interface{}{ @@ -93,10 +97,6 @@ func resourceAlicloudEcsHpcClusterUpdate(d *schema.ResourceData, meta interface{ } if update { action := "ModifyHpcClusterAttribute" - conn, err := client.NewEcsClient() - if err != nil { - return WrapError(err) - } runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) request["ClientToken"] = buildClientToken("ModifyHpcClusterAttribute") diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_key_pair.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_key_pair.go index db0ffb26897..8fa5a1eec68 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_key_pair.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_key_pair.go @@ -170,6 +170,10 @@ func resourceAlicloudEcsKeyPairRead(d *schema.ResourceData, meta interface{}) er func resourceAlicloudEcsKeyPairUpdate(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) ecsService := EcsService{client} + conn, err := client.NewEcsClient() + if err != nil { + return WrapError(err) + } var response map[string]interface{} d.Partial(true) @@ -191,10 +195,6 @@ func resourceAlicloudEcsKeyPairUpdate(d *schema.ResourceData, meta interface{}) request["ResourceType"] = "keypair" if update { action := "JoinResourceGroup" - conn, err := client.NewEcsClient() - if err != nil { - return WrapError(err) - } wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-26"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_launch_template.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_launch_template.go index c6553ec9813..b6755c4f85a 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_launch_template.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_launch_template.go @@ -328,10 +328,12 @@ func resourceAlicloudEcsLaunchTemplate() *schema.Resource { "vpc_id": { Type: schema.TypeString, Optional: true, + Computed: true, }, "zone_id": { Type: schema.TypeString, Optional: true, + Computed: true, }, "system_disk_category": { Type: schema.TypeString, diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_network_interface.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_network_interface.go index efaa40a613c..b48cc7f9fd4 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_network_interface.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_network_interface.go @@ -649,7 +649,7 @@ func resourceAlicloudEcsNetworkInterfaceDelete(d *schema.ResourceData, meta inte err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-26"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) if err != nil { - if IsExpectedErrors(err, []string{"InternalError", "InvalidOperation.InvalidEcsState", "InvalidOperation.InvalidEniState", "OperationConflict", "ServiceUnavailable"}) || NeedRetry(err) { + if IsExpectedErrors(err, []string{"InvalidOperation.Conflict", "InternalError", "InvalidOperation.InvalidEcsState", "InvalidOperation.InvalidEniState", "OperationConflict", "ServiceUnavailable"}) || NeedRetry(err) { wait() return resource.RetryableError(err) } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_prefix_list.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_prefix_list.go new file mode 100644 index 00000000000..3ab64dc491b --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_prefix_list.go @@ -0,0 +1,248 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudEcsPrefixList() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudEcsPrefixListCreate, + Read: resourceAlicloudEcsPrefixListRead, + Update: resourceAlicloudEcsPrefixListUpdate, + Delete: resourceAlicloudEcsPrefixListDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "address_family": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"IPv4", "IPv6"}, false), + }, + "max_entries": { + Type: schema.TypeInt, + Required: true, + ForceNew: true, + ValidateFunc: validation.IntBetween(1, 200), + }, + "entry": { + Type: schema.TypeSet, + Required: true, + MaxItems: 200, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "cidr": { + Type: schema.TypeString, + Optional: true, + }, + "description": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "prefix_list_name": { + Type: schema.TypeString, + Required: true, + }, + "description": { + Type: schema.TypeString, + Optional: true, + }, + }, + } +} + +func resourceAlicloudEcsPrefixListCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreatePrefixList" + request := make(map[string]interface{}) + conn, err := client.NewEcsClient() + if err != nil { + return WrapError(err) + } + + request["AddressFamily"] = d.Get("address_family") + request["MaxEntries"] = d.Get("max_entries") + request["PrefixListName"] = d.Get("prefix_list_name") + request["RegionId"] = client.RegionId + request["ClientToken"] = buildClientToken("CreatePrefixList") + + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + + if v, ok := d.GetOk("entry"); ok { + for entryPtr, entry := range v.(*schema.Set).List() { + entryArg := entry.(map[string]interface{}) + request["Entry."+fmt.Sprint(entryPtr+1)+".Cidr"] = entryArg["cidr"] + request["Entry."+fmt.Sprint(entryPtr+1)+".Description"] = entryArg["description"] + } + } + + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-26"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_ecs_prefix_list", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["PrefixListId"])) + + return resourceAlicloudEcsPrefixListRead(d, meta) +} +func resourceAlicloudEcsPrefixListRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + ecsService := EcsService{client} + object, err := ecsService.DescribeEcsPrefixList(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_ecs_prefix_list ecsService.DescribeEcsPrefixList Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("address_family", object["AddressFamily"]) + d.Set("description", object["Description"]) + if entryMap, ok := object["Entries"].(map[string]interface{}); ok && entryMap != nil { + if entryList, ok := entryMap["Entry"]; ok && entryList != nil { + entryMaps := make([]map[string]interface{}, 0) + for _, entryListItem := range entryList.([]interface{}) { + if entryListItemMap, ok := entryListItem.(map[string]interface{}); ok { + res := make(map[string]interface{}, 0) + res["cidr"] = entryListItemMap["Cidr"] + res["description"] = entryListItemMap["Description"] + entryMaps = append(entryMaps, res) + } + } + d.Set("entry", entryMaps) + } + } + + if v, ok := object["MaxEntries"]; ok && fmt.Sprint(v) != "0" { + d.Set("max_entries", formatInt(v)) + } + d.Set("prefix_list_name", object["PrefixListName"]) + return nil +} +func resourceAlicloudEcsPrefixListUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + conn, err := client.NewEcsClient() + if err != nil { + return WrapError(err) + } + var response map[string]interface{} + update := false + + request := map[string]interface{}{ + "PrefixListId": d.Id(), + } + request["RegionId"] = client.RegionId + + if d.HasChange("prefix_list_name") { + update = true + request["PrefixListName"] = d.Get("prefix_list_name") + } + + if d.HasChange("description") { + update = true + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + } + + if d.HasChange("entry") { + update = true + oraw, nraw := d.GetChange("entry") + remove := oraw.(*schema.Set).Difference(nraw.(*schema.Set)).List() + if len(remove) != 0 { + for entryPtr, entry := range remove { + entryArg := entry.(map[string]interface{}) + request["RemoveEntry."+fmt.Sprint(entryPtr+1)+".Cidr"] = entryArg["cidr"] + } + } + added := nraw.(*schema.Set).Difference(oraw.(*schema.Set)).List() + if len(added) != 0 { + for entryPtr, entry := range added { + entryArg := entry.(map[string]interface{}) + request["AddEntry."+fmt.Sprint(entryPtr+1)+".Cidr"] = entryArg["cidr"] + request["AddEntry."+fmt.Sprint(entryPtr+1)+".Description"] = entryArg["description"] + } + } + } + if update { + action := "ModifyPrefixList" + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-26"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudEcsPrefixListRead(d, meta) +} +func resourceAlicloudEcsPrefixListDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeletePrefixList" + var response map[string]interface{} + conn, err := client.NewEcsClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "PrefixListId": d.Id(), + } + + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-26"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_session_manager_status.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_session_manager_status.go new file mode 100644 index 00000000000..cac74074c23 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_session_manager_status.go @@ -0,0 +1,141 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudEcsSessionManagerStatus() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudEcsSessionManagerStatusCreate, + Read: resourceAlicloudEcsSessionManagerStatusRead, + Update: resourceAlicloudEcsSessionManagerStatusUpdate, + Delete: resourceAlicloudEcsSessionManagerStatusDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "session_manager_status_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"sessionManagerStatus"}, false), + }, + "status": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"Disabled", "Enabled"}, false), + }, + }, + } +} + +func resourceAlicloudEcsSessionManagerStatusCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "ModifyUserBusinessBehavior" + request := make(map[string]interface{}) + conn, err := client.NewEcsClient() + if err != nil { + return WrapError(err) + } + request["statusKey"] = d.Get("session_manager_status_name") + request["statusValue"] = convertEcsSessionManagerStatusStatusRequest(d.Get("status").(string)) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-26"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_ecs_session_manager_status", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["statusKey"])) + return resourceAlicloudEcsSessionManagerStatusRead(d, meta) +} +func resourceAlicloudEcsSessionManagerStatusRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + ecsService := EcsService{client} + object, err := ecsService.DescribeEcsSessionManagerStatus(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_ecs_session_manager_status ecsService.DescribeEcsSessionManagerStatus Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + + d.Set("session_manager_status_name", d.Id()) + d.Set("status", convertEcsSessionManagerStatusStatusResponse(object["StatusValue"])) + return nil +} +func resourceAlicloudEcsSessionManagerStatusUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + request := map[string]interface{}{ + "statusKey": d.Id(), + } + if d.HasChange("status") { + request["statusValue"] = convertEcsSessionManagerStatusStatusRequest(d.Get("status").(string)) + } + action := "ModifyUserBusinessBehavior" + conn, err := client.NewEcsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-26"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return resourceAlicloudEcsSessionManagerStatusRead(d, meta) +} +func resourceAlicloudEcsSessionManagerStatusDelete(d *schema.ResourceData, meta interface{}) error { + log.Printf("[WARN] Cannot destroy resourceAlicloudEcsSessionManagerStatus. Terraform will remove this resource from the state file, however resources may remain.") + return nil +} +func convertEcsSessionManagerStatusStatusRequest(source interface{}) interface{} { + switch source { + case "Disabled": + return "disabled" + case "Enabled": + return "enabled" + } + return source +} +func convertEcsSessionManagerStatusStatusResponse(source interface{}) interface{} { + switch source { + case "disabled": + return "Disabled" + case "enabled": + return "Enabled" + } + return source +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_snapshot.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_snapshot.go index 19ce67a95c0..195c1b078d3 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_snapshot.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_snapshot.go @@ -188,6 +188,10 @@ func resourceAlicloudEcsSnapshotRead(d *schema.ResourceData, meta interface{}) e func resourceAlicloudEcsSnapshotUpdate(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) ecsService := EcsService{client} + conn, err := client.NewEcsClient() + if err != nil { + return WrapError(err) + } var response map[string]interface{} d.Partial(true) @@ -219,10 +223,6 @@ func resourceAlicloudEcsSnapshotUpdate(d *schema.ResourceData, meta interface{}) } if update { action := "ModifySnapshotAttribute" - conn, err := client.NewEcsClient() - if err != nil { - return WrapError(err) - } wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-26"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_edas_k8s_application.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_edas_k8s_application.go index 72d3a489062..ba5e5951bdb 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_edas_k8s_application.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_edas_k8s_application.go @@ -32,6 +32,7 @@ func resourceAlicloudEdasK8sApplication() *schema.Resource { Schema: map[string]*schema.Schema{ "application_name": { Type: schema.TypeString, + ForceNew: true, Required: true, }, "cluster_id": { @@ -80,19 +81,23 @@ func resourceAlicloudEdasK8sApplication() *schema.Resource { "internet_slb_id": { Optional: true, Type: schema.TypeString, + ForceNew: true, }, "internet_slb_protocol": { Optional: true, Type: schema.TypeString, + ForceNew: true, ValidateFunc: validation.StringInSlice([]string{"TCP", "HTTP", "HTTPS"}, false), }, "internet_slb_port": { Type: schema.TypeInt, + ForceNew: true, Optional: true, }, "internet_target_port": { Type: schema.TypeInt, Optional: true, + ForceNew: true, }, "envs": { Type: schema.TypeMap, @@ -161,7 +166,7 @@ func resourceAlicloudEdasK8sApplication() *schema.Resource { "package_version": { Type: schema.TypeString, Optional: true, - Default: strconv.FormatInt(time.Now().Unix(), 10), + Computed: true, }, "jdk": { Type: schema.TypeString, @@ -213,6 +218,8 @@ func resourceAlicloudEdasK8sApplicationCreate(d *schema.ResourceData, meta inter } if v, ok := d.GetOk("package_version"); ok { request.PackageVersion = v.(string) + } else { + request.PackageVersion = strconv.FormatInt(time.Now().Unix(), 10) } if v, ok := d.GetOk("jdk"); !ok { return WrapError(Error("jdk is needed for creating non-image k8s application")) @@ -466,7 +473,12 @@ func resourceAlicloudEdasK8sApplicationUpdate(d *schema.ResourceData, meta inter if len(request.PackageUrl) == 0 { return WrapError(Error("package_url is needed for creating fatjar k8s application")) } - request.PackageVersion = d.Get("package_version").(string) + + if v, ok := d.GetOk("package_version"); ok { + request.PackageVersion = v.(string) + } else { + request.PackageVersion = strconv.FormatInt(time.Now().Unix(), 10) + } if d.HasChange("jdk") { partialKeys = append(partialKeys, "jdk") diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ehpc_job_template.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ehpc_job_template.go new file mode 100644 index 00000000000..34ef32c7490 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ehpc_job_template.go @@ -0,0 +1,345 @@ +package alicloud + +import ( + "fmt" + "log" + "strconv" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudEhpcJobTemplate() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudEhpcJobTemplateCreate, + Read: resourceAlicloudEhpcJobTemplateRead, + Update: resourceAlicloudEhpcJobTemplateUpdate, + Delete: resourceAlicloudEhpcJobTemplateDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "array_request": { + Type: schema.TypeString, + Optional: true, + }, + "clock_time": { + Type: schema.TypeString, + Optional: true, + }, + "command_line": { + Type: schema.TypeString, + Required: true, + }, + "gpu": { + Type: schema.TypeInt, + Optional: true, + }, + "job_template_name": { + Type: schema.TypeString, + Required: true, + }, + "mem": { + Type: schema.TypeString, + Optional: true, + }, + "node": { + Type: schema.TypeInt, + Optional: true, + }, + "package_path": { + Type: schema.TypeString, + Optional: true, + }, + "priority": { + Type: schema.TypeInt, + Optional: true, + }, + "queue": { + Type: schema.TypeString, + Optional: true, + }, + "re_runable": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "runas_user": { + Type: schema.TypeString, + Optional: true, + }, + "stderr_redirect_path": { + Type: schema.TypeString, + Optional: true, + }, + "stdout_redirect_path": { + Type: schema.TypeString, + Optional: true, + }, + "task": { + Type: schema.TypeInt, + Optional: true, + }, + "thread": { + Type: schema.TypeInt, + Optional: true, + }, + "variables": { + Type: schema.TypeString, + Optional: true, + }, + }, + } +} + +func resourceAlicloudEhpcJobTemplateCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateJobTemplate" + request := make(map[string]interface{}) + conn, err := client.NewEhpcClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("array_request"); ok { + request["ArrayRequest"] = v + } + if v, ok := d.GetOk("clock_time"); ok { + request["ClockTime"] = v + } + request["CommandLine"] = d.Get("command_line") + if v, ok := d.GetOk("gpu"); ok { + request["Gpu"] = v + } + request["Name"] = d.Get("job_template_name") + if v, ok := d.GetOk("mem"); ok { + request["Mem"] = v + } + if v, ok := d.GetOk("node"); ok { + request["Node"] = v + } + if v, ok := d.GetOk("package_path"); ok { + request["PackagePath"] = v + } + if v, ok := d.GetOk("priority"); ok { + request["Priority"] = v + } + if v, ok := d.GetOk("queue"); ok { + request["Queue"] = v + } + if v, ok := d.GetOkExists("re_runable"); ok { + request["ReRunable"] = v + } + if v, ok := d.GetOk("runas_user"); ok { + request["RunasUser"] = v + } + if v, ok := d.GetOk("stderr_redirect_path"); ok { + request["StderrRedirectPath"] = v + } + if v, ok := d.GetOk("stdout_redirect_path"); ok { + request["StdoutRedirectPath"] = v + } + if v, ok := d.GetOk("task"); ok { + request["Task"] = v + } + if v, ok := d.GetOk("thread"); ok { + request["Thread"] = v + } + if v, ok := d.GetOk("variables"); ok { + request["Variables"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("GET"), StringPointer("2018-04-12"), StringPointer("AK"), request, nil, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_ehpc_job_template", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["TemplateId"])) + + return resourceAlicloudEhpcJobTemplateRead(d, meta) +} +func resourceAlicloudEhpcJobTemplateRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + ehpcService := EhpcService{client} + object, err := ehpcService.DescribeEhpcJobTemplate(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_ehpc_job_template ehpcService.DescribeEhpcJobTemplate Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("array_request", object["ArrayRequest"]) + d.Set("clock_time", object["ClockTime"]) + d.Set("command_line", object["CommandLine"]) + if v, ok := object["Gpu"]; ok && fmt.Sprint(v) != "0" { + d.Set("gpu", formatInt(v)) + } + d.Set("mem", object["Mem"]) + if v, ok := object["Node"]; ok && fmt.Sprint(v) != "0" { + d.Set("node", formatInt(v)) + } + d.Set("package_path", object["PackagePath"]) + if v, ok := object["Priority"]; ok { + d.Set("priority", formatInt(v)) + } + d.Set("queue", object["Queue"]) + d.Set("job_template_name", object["Name"]) + + if v, ok := object["ReRunable"]; ok { + v, _ := strconv.ParseBool(v.(string)) + err = d.Set("re_runable", v) + } + + d.Set("runas_user", object["RunasUser"]) + d.Set("stderr_redirect_path", object["StderrRedirectPath"]) + d.Set("stdout_redirect_path", object["StdoutRedirectPath"]) + if v, ok := object["Task"]; ok && fmt.Sprint(v) != "0" { + d.Set("task", formatInt(v)) + } + if v, ok := object["Thread"]; ok && fmt.Sprint(v) != "0" { + d.Set("thread", formatInt(v)) + } + d.Set("variables", object["Variables"]) + return nil +} +func resourceAlicloudEhpcJobTemplateUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + request := map[string]interface{}{ + "TemplateId": d.Id(), + } + + request["CommandLine"] = d.Get("command_line") + + request["Name"] = d.Get("job_template_name") + + if v, ok := d.GetOk("array_request"); ok { + request["ArrayRequest"] = v + } + + if v, ok := d.GetOk("clock_time"); ok { + request["ClockTime"] = v + } + + if v, ok := d.GetOk("gpu"); ok { + request["Gpu"] = v + } + + if v, ok := d.GetOk("mem"); ok { + request["Mem"] = v + } + + if v, ok := d.GetOk("node"); ok { + request["Node"] = v + } + + if v, ok := d.GetOk("package_path"); ok { + request["PackagePath"] = v + } + + if v, ok := d.GetOk("priority"); ok { + request["Priority"] = v + } + + if v, ok := d.GetOk("queue"); ok { + request["Queue"] = v + } + + if v, ok := d.GetOk("re_runable"); ok { + request["ReRunable"] = v + } + + if v, ok := d.GetOk("runas_user"); ok { + request["RunasUser"] = v + } + + if v, ok := d.GetOk("stderr_redirect_path"); ok { + request["StderrRedirectPath"] = v + } + + if v, ok := d.GetOk("stdout_redirect_path"); ok { + request["StdoutRedirectPath"] = v + } + + if v, ok := d.GetOk("task"); ok { + request["Task"] = v + } + + if v, ok := d.GetOk("thread"); ok { + request["Thread"] = v + } + + if v, ok := d.GetOk("variables"); ok { + request["Variables"] = v + } + + action := "EditJobTemplate" + conn, err := client.NewEhpcClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("GET"), StringPointer("2018-04-12"), StringPointer("AK"), request, nil, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + + return resourceAlicloudEhpcJobTemplateRead(d, meta) +} +func resourceAlicloudEhpcJobTemplateDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteJobTemplates" + var response map[string]interface{} + conn, err := client.NewEhpcClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "Templates": fmt.Sprintf("[{\"Id\":\"%s\"}]", d.Id()), + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("GET"), StringPointer("2018-04-12"), StringPointer("AK"), request, nil, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_eip_address.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_eip_address.go index 5f2373bb535..1b6e08c997c 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_eip_address.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_eip_address.go @@ -28,6 +28,10 @@ func resourceAlicloudEipAddress() *schema.Resource { Delete: schema.DefaultTimeout(9 * time.Minute), }, Schema: map[string]*schema.Schema{ + "auto_pay": { + Type: schema.TypeBool, + Optional: true, + }, "activity_id": { Type: schema.TypeString, Optional: true, @@ -67,7 +71,7 @@ func resourceAlicloudEipAddress() *schema.Resource { Optional: true, Computed: true, ForceNew: true, - ValidateFunc: validation.StringInSlice([]string{"PayByBandwidth", "PayByTraffic"}, false), + ValidateFunc: validation.StringInSlice([]string{"PayByBandwidth", "PayByTraffic", "PayByDominantTraffic"}, false), }, "isp": { Type: schema.TypeString, @@ -165,13 +169,17 @@ func resourceAlicloudEipAddressCreate(d *schema.ResourceData, meta interface{}) if v, ok := d.GetOk("period"); ok { period = v.(int) } - request["Duration"] = period + request["Period"] = period request["PricingCycle"] = string(Month) if period > 9 { - request["Duration"] = period / 12 + request["Period"] = period / 12 request["PricingCycle"] = string(Year) } - request["AutoPay"] = true + autoPay := true + if v, ok := d.GetOkExists("auto_pay"); ok { + autoPay = v.(bool) + } + request["AutoPay"] = autoPay } request["RegionId"] = client.RegionId if v, ok := d.GetOk("resource_group_id"); ok { @@ -375,6 +383,10 @@ func resourceAlicloudEipAddressUpdate(d *schema.ResourceData, meta interface{}) return resourceAlicloudEipAddressRead(d, meta) } func resourceAlicloudEipAddressDelete(d *schema.ResourceData, meta interface{}) error { + if d.Get("payment_type").(string) == "Subscription" || d.Get("instance_charge_type").(string) == "Prepaid" { + log.Printf("[WARN] Cannot destroy Subscription resource: alicloud_eip_address. Terraform will remove this resource from the state file, however resources may remain.") + return nil + } client := meta.(*connectivity.AliyunClient) vpcService := VpcService{client} action := "ReleaseEipAddress" diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ens_key_pair.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ens_key_pair.go new file mode 100644 index 00000000000..e0629ab499a --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ens_key_pair.go @@ -0,0 +1,123 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudEnsKeyPair() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudEnsKeyPairCreate, + Read: resourceAlicloudEnsKeyPairRead, + Delete: resourceAlicloudEnsKeyPairDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "key_pair_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "version": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudEnsKeyPairCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateKeyPair" + request := make(map[string]interface{}) + conn, err := client.NewEnsClient() + if err != nil { + return WrapError(err) + } + request["KeyPairName"] = d.Get("key_pair_name") + request["Version"] = d.Get("version") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-11-10"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_ens_key_pair", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["KeyPairName"], ":", request["Version"])) + + return resourceAlicloudEnsKeyPairRead(d, meta) +} +func resourceAlicloudEnsKeyPairRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + ensService := EnsService{client} + _, err := ensService.DescribeEnsKeyPair(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_ens_key_pair ensService.DescribeEnsKeyPair Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Set("key_pair_name", parts[0]) + d.Set("version", parts[1]) + return nil +} +func resourceAlicloudEnsKeyPairDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + action := "DeleteKeyPairs" + var response map[string]interface{} + conn, err := client.NewEnsClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "KeyPairName": parts[0], + "Version": parts[1], + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-11-10"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ess_scaling_configuration.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ess_scaling_configuration.go new file mode 100644 index 00000000000..e3ff801998b --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ess_scaling_configuration.go @@ -0,0 +1,1080 @@ +package alicloud + +import ( + "encoding/base64" + "fmt" + "regexp" + "strconv" + "strings" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/services/ess" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudEssScalingConfiguration() *schema.Resource { + return &schema.Resource{ + Create: resourceAliyunEssScalingConfigurationCreate, + Read: resourceAliyunEssScalingConfigurationRead, + Update: resourceAliyunEssScalingConfigurationUpdate, + Delete: resourceAliyunEssScalingConfigurationDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + + Schema: map[string]*schema.Schema{ + "active": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "enable": { + Type: schema.TypeBool, + Optional: true, + }, + "scaling_group_id": { + Type: schema.TypeString, + ForceNew: true, + Required: true, + }, + "image_id": { + Type: schema.TypeString, + Optional: true, + }, + "image_name": { + Type: schema.TypeString, + Optional: true, + }, + "instance_type": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^ecs\..*`), "prefix must be 'ecs.'"), + ConflictsWith: []string{"instance_types"}, + }, + "instance_types": { + Type: schema.TypeList, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Optional: true, + ConflictsWith: []string{"instance_type"}, + MaxItems: int(MaxScalingConfigurationInstanceTypes), + }, + "io_optimized": { + Type: schema.TypeString, + Optional: true, + Deprecated: "Attribute io_optimized has been deprecated on instance resource. All the launched alicloud instances will be IO optimized. Suggest to remove it from your template.", + }, + "is_outdated": { + Type: schema.TypeBool, + Optional: true, + }, + "security_group_id": { + Type: schema.TypeString, + Optional: true, + ConflictsWith: []string{"security_group_ids"}, + }, + "security_group_ids": { + Type: schema.TypeList, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + ConflictsWith: []string{"security_group_id"}, + Optional: true, + MaxItems: 16, + }, + "scaling_configuration_name": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "internet_charge_type": { + Type: schema.TypeString, + Optional: true, + Default: PayByBandwidth, + ValidateFunc: validation.StringInSlice([]string{"PayByBandwidth", "PayByTraffic"}, false), + }, + "internet_max_bandwidth_in": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + }, + "internet_max_bandwidth_out": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validation.IntBetween(0, 100), + }, + "credit_specification": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + string(CreditSpecificationStandard), + string(CreditSpecificationUnlimited), + }, false), + }, + "system_disk_category": { + Type: schema.TypeString, + Optional: true, + Default: DiskCloudEfficiency, + ValidateFunc: validation.StringInSlice([]string{"cloud", "ephemeral_ssd", "cloud_ssd", "cloud_essd", "cloud_efficiency"}, false), + }, + "system_disk_size": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validation.IntBetween(20, 500), + }, + "system_disk_name": { + Type: schema.TypeString, + Optional: true, + }, + "system_disk_description": { + Type: schema.TypeString, + Optional: true, + }, + "system_disk_auto_snapshot_policy_id": { + Type: schema.TypeString, + Optional: true, + }, + "data_disk": { + Optional: true, + Type: schema.TypeList, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "size": { + Type: schema.TypeInt, + Optional: true, + }, + "category": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"all", "cloud", "ephemeral_ssd", "cloud_essd", "cloud_efficiency", "cloud_ssd", "local_disk"}, false), + }, + "snapshot_id": { + Type: schema.TypeString, + Optional: true, + }, + "device": { + Type: schema.TypeString, + Optional: true, + Deprecated: "Attribute device has been deprecated on disk attachment resource. Suggest to remove it from your template.", + }, + "delete_with_instance": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, + "encrypted": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "kms_key_id": { + Type: schema.TypeString, + Optional: true, + }, + "name": { + Type: schema.TypeString, + Optional: true, + }, + "description": { + Type: schema.TypeString, + Optional: true, + }, + "auto_snapshot_policy_id": { + Type: schema.TypeString, + Optional: true, + }, + "performance_level": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "instance_ids": { + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Optional: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + return true + }, + Deprecated: "Field 'instance_ids' has been deprecated from provider version 1.6.0. New resource 'alicloud_ess_attachment' replaces it.", + }, + + "substitute": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + + "user_data": { + Type: schema.TypeString, + Optional: true, + }, + + "role_name": { + Type: schema.TypeString, + Optional: true, + }, + + "key_name": { + Type: schema.TypeString, + Optional: true, + }, + + "force_delete": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + + "tags": { + Type: schema.TypeMap, + Optional: true, + }, + + "instance_name": { + Type: schema.TypeString, + Optional: true, + Default: "ESS-Instance", + ValidateFunc: validation.StringLenBetween(2, 128), + }, + + "override": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "password": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + return d.Get("password_inherit").(bool) + }, + }, + "password_inherit": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "kms_encrypted_password": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + return d.Get("password_inherit").(bool) || d.Get("password").(string) != "" + }, + }, + "kms_encryption_context": { + Type: schema.TypeMap, + Optional: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + return d.Get("kms_encrypted_password").(string) == "" + }, + Elem: schema.TypeString, + }, + "system_disk_performance_level": { + Type: schema.TypeString, + Optional: true, + }, + "resource_group_id": { + Type: schema.TypeString, + Optional: true, + }, + "host_name": { + Type: schema.TypeString, + Optional: true, + }, + "spot_strategy": { + Type: schema.TypeString, + Optional: true, + }, + "spot_price_limit": { + Optional: true, + Type: schema.TypeSet, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "instance_type": { + Type: schema.TypeString, + Optional: true, + }, + "price_limit": { + Type: schema.TypeFloat, + Optional: true, + }, + }, + }, + }, + }, + } +} + +func resourceAliyunEssScalingConfigurationCreate(d *schema.ResourceData, meta interface{}) error { + + // Ensure instance_type is generation three + client := meta.(*connectivity.AliyunClient) + request, err := buildAlicloudEssScalingConfigurationArgs(d, meta) + if err != nil { + return WrapError(err) + } + + request.IoOptimized = string(IOOptimized) + if d.Get("is_outdated").(bool) == true { + request.IoOptimized = string(NoneOptimized) + } + + if err := resource.Retry(5*time.Minute, func() *resource.RetryError { + raw, err := client.WithEssClient(func(essClient *ess.Client) (interface{}, error) { + return essClient.CreateScalingConfiguration(request) + }) + if err != nil { + if IsExpectedErrors(err, []string{Throttling, "IncorrectScalingGroupStatus"}) { + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + addDebug(request.GetActionName(), raw, request.RpcRequest, request) + response, _ := raw.(*ess.CreateScalingConfigurationResponse) + d.SetId(response.ScalingConfigurationId) + return nil + }); err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_ess_scalingconfiguration", request.GetActionName(), AlibabaCloudSdkGoERROR) + } + + return resourceAliyunEssScalingConfigurationUpdate(d, meta) +} + +func resourceAliyunEssScalingConfigurationUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + essService := EssService{client} + d.Partial(true) + if strings.Contains(d.Id(), COLON_SEPARATED) { + d.SetId(strings.Split(d.Id(), COLON_SEPARATED)[1]) + } + + if d.HasChange("active") { + c, err := essService.DescribeEssScalingConfiguration(d.Id()) + if err != nil { + if NotFoundError(err) { + d.SetId("") + return nil + } + return WrapError(err) + } + + if d.Get("active").(bool) { + if c.LifecycleState == string(Inactive) { + + err := essService.ActiveEssScalingConfiguration(c.ScalingGroupId, d.Id()) + if err != nil { + return WrapError(err) + } + } + } else { + if c.LifecycleState == string(Active) { + _, err := activeSubstituteScalingConfiguration(d, meta) + if err != nil { + return WrapError(err) + } + } + } + d.SetPartial("active") + } + + if err := enableEssScalingConfiguration(d, meta); err != nil { + return WrapError(err) + } + + if err := modifyEssScalingConfiguration(d, meta); err != nil { + return WrapError(err) + } + + d.Partial(false) + + return resourceAliyunEssScalingConfigurationRead(d, meta) +} + +func modifyEssScalingConfiguration(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + request := ess.CreateModifyScalingConfigurationRequest() + request.ScalingConfigurationId = d.Id() + + if d.HasChange("override") { + request.Override = requests.NewBoolean(d.Get("override").(bool)) + d.SetPartial("override") + } + + if d.HasChange("password_inherit") { + request.PasswordInherit = requests.NewBoolean(d.Get("password_inherit").(bool)) + d.SetPartial("password_inherit") + } + if d.HasChange("image_id") || d.Get("override").(bool) { + request.ImageId = d.Get("image_id").(string) + d.SetPartial("image_id") + } + + if d.HasChange("image_name") || d.Get("override").(bool) { + request.ImageName = d.Get("image_name").(string) + d.SetPartial("image_name") + } + + hasChangeInstanceType := d.HasChange("instance_type") + hasChangeInstanceTypes := d.HasChange("instance_types") + if hasChangeInstanceType || hasChangeInstanceTypes || d.Get("override").(bool) { + instanceType := d.Get("instance_type").(string) + instanceTypes := d.Get("instance_types").([]interface{}) + if instanceType == "" && (instanceTypes == nil || len(instanceTypes) == 0) { + return fmt.Errorf("instance_type or instance_types must be assigned") + } + types := make([]string, 0, int(MaxScalingConfigurationInstanceTypes)) + if instanceTypes != nil && len(instanceTypes) > 0 { + types = expandStringList(instanceTypes) + } + if instanceType != "" { + types = append(types, instanceType) + } + request.InstanceTypes = &types + } + + hasChangeSecurityGroupId := d.HasChange("security_group_id") + hasChangeSecurityGroupIds := d.HasChange("security_group_ids") + if hasChangeSecurityGroupId || hasChangeSecurityGroupIds || d.Get("override").(bool) { + securityGroupId := d.Get("security_group_id").(string) + securityGroupIds := d.Get("security_group_ids").([]interface{}) + if securityGroupId == "" && (securityGroupIds == nil || len(securityGroupIds) == 0) { + return fmt.Errorf("securityGroupId or securityGroupIds must be assigned") + } + if securityGroupIds != nil && len(securityGroupIds) > 0 { + sgs := expandStringList(securityGroupIds) + request.SecurityGroupIds = &sgs + } + + if securityGroupId != "" { + request.SecurityGroupId = securityGroupId + } + } + + if d.HasChange("scaling_configuration_name") { + request.ScalingConfigurationName = d.Get("scaling_configuration_name").(string) + d.SetPartial("scaling_configuration_name") + } + + if d.HasChange("internet_charge_type") { + request.InternetChargeType = d.Get("internet_charge_type").(string) + d.SetPartial("internet_charge_type") + } + + if d.HasChange("internet_max_bandwidth_out") { + request.InternetMaxBandwidthOut = requests.NewInteger(d.Get("internet_max_bandwidth_out").(int)) + d.SetPartial("internet_max_bandwidth_out") + } + + if d.HasChange("credit_specification") { + request.CreditSpecification = d.Get("credit_specification").(string) + d.SetPartial("credit_specification") + } + + if d.HasChange("system_disk_category") { + request.SystemDiskCategory = d.Get("system_disk_category").(string) + d.SetPartial("system_disk_category") + } + + if d.HasChange("system_disk_size") { + request.SystemDiskSize = requests.NewInteger(d.Get("system_disk_size").(int)) + d.SetPartial("system_disk_size") + } + + if d.HasChange("system_disk_name") { + request.SystemDiskDiskName = d.Get("system_disk_name").(string) + d.SetPartial("system_disk_name") + } + + if d.HasChange("system_disk_description") { + request.SystemDiskDescription = d.Get("system_disk_description").(string) + d.SetPartial("system_disk_description") + } + + if d.HasChange("system_disk_auto_snapshot_policy_id") { + request.SystemDiskAutoSnapshotPolicyId = d.Get("system_disk_auto_snapshot_policy_id").(string) + d.SetPartial("system_disk_auto_snapshot_policy_id") + } + + if d.HasChange("system_disk_performance_level") { + request.SystemDiskPerformanceLevel = d.Get("system_disk_performance_level").(string) + d.SetPartial("system_disk_performance_level") + } + + if d.HasChange("resource_group_id") { + request.ResourceGroupId = d.Get("resource_group_id").(string) + d.SetPartial("resource_group_id") + } + + if d.HasChange("user_data") { + if v, ok := d.GetOk("user_data"); ok && v.(string) != "" { + _, base64DecodeError := base64.StdEncoding.DecodeString(v.(string)) + if base64DecodeError == nil { + request.UserData = v.(string) + } else { + request.UserData = base64.StdEncoding.EncodeToString([]byte(v.(string))) + } + } + d.SetPartial("user_data") + } + + if d.HasChange("role_name") { + request.RamRoleName = d.Get("role_name").(string) + d.SetPartial("role_name") + } + + if d.HasChange("key_name") { + request.KeyPairName = d.Get("key_name").(string) + d.SetPartial("key_name") + } + + if d.HasChange("instance_name") { + request.InstanceName = d.Get("instance_name").(string) + d.SetPartial("instance_name") + } + + if d.HasChange("host_name") { + request.HostName = d.Get("host_name").(string) + d.SetPartial("host_name") + } + + if d.HasChange("spot_strategy") { + request.SpotStrategy = d.Get("spot_strategy").(string) + d.SetPartial("spot_strategy") + } + + if d.HasChange("spot_price_limit") { + v, ok := d.GetOk("spot_price_limit") + if ok { + spotPriceLimits := make([]ess.ModifyScalingConfigurationSpotPriceLimit, 0) + for _, e := range v.(*schema.Set).List() { + pack := e.(map[string]interface{}) + l := ess.ModifyScalingConfigurationSpotPriceLimit{ + InstanceType: pack["instance_type"].(string), + PriceLimit: strconv.FormatFloat(pack["price_limit"].(float64), 'f', 2, 64), + } + spotPriceLimits = append(spotPriceLimits, l) + } + request.SpotPriceLimit = &spotPriceLimits + } + d.SetPartial("spot_price_limit") + } + + if d.HasChange("tags") { + if v, ok := d.GetOk("tags"); ok { + tags := "{" + for key, value := range v.(map[string]interface{}) { + tags += "\"" + key + "\"" + ":" + "\"" + value.(string) + "\"" + "," + } + request.Tags = strings.TrimSuffix(tags, ",") + "}" + } + d.SetPartial("tags") + } + + if d.HasChange("data_disk") { + dds, ok := d.GetOk("data_disk") + if ok { + disks := dds.([]interface{}) + createDataDisks := make([]ess.ModifyScalingConfigurationDataDisk, 0, len(disks)) + for _, e := range disks { + pack := e.(map[string]interface{}) + dataDisk := ess.ModifyScalingConfigurationDataDisk{ + Size: strconv.Itoa(pack["size"].(int)), + Category: pack["category"].(string), + SnapshotId: pack["snapshot_id"].(string), + DeleteWithInstance: strconv.FormatBool(pack["delete_with_instance"].(bool)), + Device: pack["device"].(string), + Encrypted: strconv.FormatBool(pack["encrypted"].(bool)), + KMSKeyId: pack["kms_key_id"].(string), + DiskName: pack["name"].(string), + Description: pack["description"].(string), + AutoSnapshotPolicyId: pack["auto_snapshot_policy_id"].(string), + PerformanceLevel: pack["performance_level"].(string), + } + createDataDisks = append(createDataDisks, dataDisk) + } + request.DataDisk = &createDataDisks + } + d.SetPartial("data_disk") + } + raw, err := client.WithEssClient(func(essClient *ess.Client) (interface{}, error) { + return essClient.ModifyScalingConfiguration(request) + }) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), request.GetActionName(), AlibabaCloudSdkGoERROR) + } + addDebug(request.GetActionName(), raw, request.RpcRequest, request) + return nil +} + +func enableEssScalingConfiguration(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + essService := EssService{client} + + if d.HasChange("enable") { + sgId := d.Get("scaling_group_id").(string) + group, err := essService.DescribeEssScalingGroup(sgId) + if err != nil { + return WrapError(err) + } + + if d.Get("enable").(bool) { + if group.LifecycleState == string(Inactive) { + + object, err := essService.DescribeEssScalingConfifurations(sgId) + + if err != nil { + return WrapError(err) + } + activeConfig := "" + var csIds []string + for _, c := range object { + csIds = append(csIds, c.ScalingConfigurationId) + if c.LifecycleState == string(Active) { + activeConfig = c.ScalingConfigurationId + } + } + + if activeConfig == "" { + return WrapError(Error("Please active a scaling configuration before enabling scaling group %s. Its all scaling configuration are %s.", + sgId, strings.Join(csIds, ","))) + } + + request := ess.CreateEnableScalingGroupRequest() + request.RegionId = client.RegionId + request.ScalingGroupId = sgId + request.ActiveScalingConfigurationId = activeConfig + + raw, err := client.WithEssClient(func(essClient *ess.Client) (interface{}, error) { + return essClient.EnableScalingGroup(request) + }) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), request.GetActionName(), AlibabaCloudSdkGoERROR) + } + addDebug(request.GetActionName(), raw, request.RpcRequest, request) + if err := essService.WaitForEssScalingGroup(sgId, Active, DefaultTimeout); err != nil { + return WrapError(err) + } + + d.SetPartial("scaling_configuration_id") + } + } else { + if group.LifecycleState == string(Active) { + request := ess.CreateDisableScalingGroupRequest() + request.RegionId = client.RegionId + request.ScalingGroupId = sgId + raw, err := client.WithEssClient(func(essClient *ess.Client) (interface{}, error) { + return essClient.DisableScalingGroup(request) + }) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), request.GetActionName(), AlibabaCloudSdkGoERROR) + } + addDebug(request.GetActionName(), raw, request.RpcRequest, request) + if err := essService.WaitForEssScalingGroup(sgId, Inactive, DefaultTimeout); err != nil { + return WrapError(err) + } + } + } + d.SetPartial("enable") + } + + return nil +} + +func resourceAliyunEssScalingConfigurationRead(d *schema.ResourceData, meta interface{}) error { + + client := meta.(*connectivity.AliyunClient) + essService := EssService{client} + if strings.Contains(d.Id(), COLON_SEPARATED) { + d.SetId(strings.Split(d.Id(), COLON_SEPARATED)[1]) + } + object, err := essService.DescribeEssScalingConfiguration(d.Id()) + if err != nil { + if NotFoundError(err) { + d.SetId("") + return nil + } + return WrapError(err) + } + + d.Set("scaling_group_id", object.ScalingGroupId) + d.Set("active", object.LifecycleState == string(Active)) + d.Set("image_id", object.ImageId) + d.Set("image_name", object.ImageName) + d.Set("scaling_configuration_name", object.ScalingConfigurationName) + d.Set("internet_charge_type", object.InternetChargeType) + d.Set("internet_max_bandwidth_in", object.InternetMaxBandwidthIn) + d.Set("internet_max_bandwidth_out", object.InternetMaxBandwidthOut) + d.Set("credit_specification", object.CreditSpecification) + d.Set("system_disk_category", object.SystemDiskCategory) + d.Set("system_disk_size", object.SystemDiskSize) + d.Set("system_disk_name", object.SystemDiskName) + d.Set("system_disk_description", object.SystemDiskDescription) + d.Set("system_disk_auto_snapshot_policy_id", object.SystemDiskAutoSnapshotPolicyId) + d.Set("system_disk_performance_level", object.SystemDiskPerformanceLevel) + d.Set("data_disk", essService.flattenDataDiskMappings(object.DataDisks.DataDisk)) + d.Set("role_name", object.RamRoleName) + d.Set("key_name", object.KeyPairName) + d.Set("force_delete", d.Get("force_delete").(bool)) + d.Set("tags", essTagsToMap(object.Tags.Tag)) + d.Set("instance_name", object.InstanceName) + d.Set("override", d.Get("override").(bool)) + d.Set("password_inherit", object.PasswordInherit) + d.Set("resource_group_id", object.ResourceGroupId) + d.Set("host_name", object.HostName) + d.Set("spot_strategy", object.SpotStrategy) + d.Set("spot_price_limit", essService.flattenSpotPriceLimitMappings(object.SpotPriceLimit.SpotPriceModel)) + + if sg, ok := d.GetOk("security_group_id"); ok && sg.(string) != "" { + d.Set("security_group_id", object.SecurityGroupId) + } + if sgs, ok := d.GetOk("security_group_ids"); ok && len(sgs.([]interface{})) > 0 { + d.Set("security_group_ids", object.SecurityGroupIds.SecurityGroupId) + } + if instanceType, ok := d.GetOk("instance_type"); ok && instanceType.(string) != "" { + d.Set("instance_type", object.InstanceType) + } + if instanceTypes, ok := d.GetOk("instance_types"); ok && len(instanceTypes.([]interface{})) > 0 { + d.Set("instance_types", object.InstanceTypes.InstanceType) + } + userData := d.Get("user_data") + if userData.(string) != "" { + _, base64DecodeError := base64.StdEncoding.DecodeString(userData.(string)) + if base64DecodeError == nil { + d.Set("user_data", object.UserData) + } else { + d.Set("user_data", userDataHashSum(object.UserData)) + } + } else { + d.Set("user_data", userDataHashSum(object.UserData)) + } + return nil +} + +func resourceAliyunEssScalingConfigurationDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + essService := EssService{client} + + if strings.Contains(d.Id(), COLON_SEPARATED) { + d.SetId(strings.Split(d.Id(), COLON_SEPARATED)[1]) + } + + object, err := essService.DescribeEssScalingConfiguration(d.Id()) + if err != nil { + if NotFoundError(err) { + return nil + } + return WrapError(err) + } + + request := ess.CreateDescribeScalingConfigurationsRequest() + request.RegionId = client.RegionId + request.ScalingGroupId = object.ScalingGroupId + + raw, err := client.WithEssClient(func(essClient *ess.Client) (interface{}, error) { + return essClient.DescribeScalingConfigurations(request) + }) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), request.GetActionName(), AlibabaCloudSdkGoERROR) + } + addDebug(request.GetActionName(), raw, request.RpcRequest, request) + response, _ := raw.(*ess.DescribeScalingConfigurationsResponse) + if len(response.ScalingConfigurations.ScalingConfiguration) < 1 { + return nil + } else if len(response.ScalingConfigurations.ScalingConfiguration) == 1 { + if d.Get("force_delete").(bool) { + request := ess.CreateDeleteScalingGroupRequest() + request.ScalingGroupId = object.ScalingGroupId + request.ForceDelete = requests.NewBoolean(true) + request.RegionId = client.RegionId + raw, err := client.WithEssClient(func(essClient *ess.Client) (interface{}, error) { + return essClient.DeleteScalingGroup(request) + }) + + if err != nil { + if IsExpectedErrors(err, []string{"InvalidScalingGroupId.NotFound"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), request.GetActionName(), AlibabaCloudSdkGoERROR) + } + addDebug(request.GetActionName(), raw, request.RpcRequest, request) + return WrapError(essService.WaitForEssScalingGroup(d.Id(), Deleted, DefaultTimeout)) + } + return WrapError(Error("Current scaling configuration %s is the last configuration for the scaling group %s. Please launch a new "+ + "active scaling configuration or set 'force_delete' to 'true' to delete it with deleting its scaling group.", d.Id(), object.ScalingGroupId)) + } + + deleteScalingConfigurationRequest := ess.CreateDeleteScalingConfigurationRequest() + deleteScalingConfigurationRequest.ScalingConfigurationId = d.Id() + + rawDeleteScalingConfiguration, err := client.WithEssClient(func(essClient *ess.Client) (interface{}, error) { + return essClient.DeleteScalingConfiguration(deleteScalingConfigurationRequest) + }) + + if err != nil { + if IsExpectedErrors(err, []string{"InvalidScalingGroupId.NotFound", "InvalidScalingConfigurationId.NotFound"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), request.GetActionName(), AlibabaCloudSdkGoERROR) + } + addDebug(request.GetActionName(), rawDeleteScalingConfiguration, request.RpcRequest, request) + + return WrapError(essService.WaitForScalingConfiguration(d.Id(), Deleted, DefaultTimeout)) +} + +func buildAlicloudEssScalingConfigurationArgs(d *schema.ResourceData, meta interface{}) (*ess.CreateScalingConfigurationRequest, error) { + client := meta.(*connectivity.AliyunClient) + //ecsService := EcsService{client} + //zoneId, validZones, _, err := ecsService.DescribeAvailableResources(d, meta, InstanceTypeResource) + //if err != nil { + // return nil, WrapError(err) + //} + + request := ess.CreateCreateScalingConfigurationRequest() + request.RegionId = client.RegionId + request.ScalingGroupId = d.Get("scaling_group_id").(string) + request.ImageId = d.Get("image_id").(string) + request.SecurityGroupId = d.Get("security_group_id").(string) + request.PasswordInherit = requests.NewBoolean(d.Get("password_inherit").(bool)) + + securityGroupId := d.Get("security_group_id").(string) + securityGroupIds := d.Get("security_group_ids").([]interface{}) + + password := d.Get("password").(string) + kmsPassword := d.Get("kms_encrypted_password").(string) + + if password != "" { + request.Password = password + } else if kmsPassword != "" { + kmsService := KmsService{client} + decryptResp, err := kmsService.Decrypt(kmsPassword, d.Get("kms_encryption_context").(map[string]interface{})) + if err != nil { + return nil, WrapError(err) + } + request.Password = decryptResp + } + + if securityGroupId == "" && (securityGroupIds == nil || len(securityGroupIds) == 0) { + return nil, WrapError(Error("security_group_id or security_group_ids must be assigned")) + } + + if securityGroupIds != nil && len(securityGroupIds) > 0 { + sgs := expandStringList(securityGroupIds) + request.SecurityGroupIds = &sgs + } + + if securityGroupId != "" { + request.SecurityGroupId = securityGroupId + } + + types := make([]string, 0, int(MaxScalingConfigurationInstanceTypes)) + instanceType := d.Get("instance_type").(string) + instanceTypes := d.Get("instance_types").([]interface{}) + if instanceType == "" && (instanceTypes == nil || len(instanceTypes) == 0) { + return nil, WrapError(Error("instance_type or instance_types must be assigned")) + } + + if instanceTypes != nil && len(instanceTypes) > 0 { + types = expandStringList(instanceTypes) + } + + if instanceType != "" { + types = append(types, instanceType) + } + //for _, v := range types { + // if err := ecsService.InstanceTypeValidation(v, zoneId, validZones); err != nil { + // return nil, WrapError(err) + // } + //} + request.InstanceTypes = &types + + if v := d.Get("scaling_configuration_name").(string); v != "" { + request.ScalingConfigurationName = v + } + + if v := d.Get("image_name").(string); v != "" { + request.ImageName = v + } + + if v := d.Get("internet_charge_type").(string); v != "" { + request.InternetChargeType = v + } + + if v := d.Get("internet_max_bandwidth_in").(int); v != 0 { + request.InternetMaxBandwidthIn = requests.NewInteger(v) + } + + request.InternetMaxBandwidthOut = requests.NewInteger(d.Get("internet_max_bandwidth_out").(int)) + + if v := d.Get("credit_specification").(string); v != "" { + request.CreditSpecification = v + } + + if v := d.Get("system_disk_category").(string); v != "" { + request.SystemDiskCategory = v + } + + if v := d.Get("system_disk_size").(int); v != 0 { + request.SystemDiskSize = requests.NewInteger(v) + } + + if v := d.Get("system_disk_name").(string); v != "" { + request.SystemDiskDiskName = v + } + + if v := d.Get("system_disk_description").(string); v != "" { + request.SystemDiskDescription = v + } + + if v := d.Get("system_disk_auto_snapshot_policy_id").(string); v != "" { + request.SystemDiskAutoSnapshotPolicyId = v + } + + if v := d.Get("system_disk_performance_level").(string); v != "" { + request.SystemDiskPerformanceLevel = v + } + + if v := d.Get("resource_group_id").(string); v != "" { + request.ResourceGroupId = v + } + + dds, ok := d.GetOk("data_disk") + if ok { + disks := dds.([]interface{}) + createDataDisks := make([]ess.CreateScalingConfigurationDataDisk, 0, len(disks)) + for _, e := range disks { + pack := e.(map[string]interface{}) + dataDisk := ess.CreateScalingConfigurationDataDisk{ + Size: strconv.Itoa(pack["size"].(int)), + Category: pack["category"].(string), + SnapshotId: pack["snapshot_id"].(string), + DeleteWithInstance: strconv.FormatBool(pack["delete_with_instance"].(bool)), + Device: pack["device"].(string), + Encrypted: strconv.FormatBool(pack["encrypted"].(bool)), + KMSKeyId: pack["kms_key_id"].(string), + DiskName: pack["name"].(string), + Description: pack["description"].(string), + AutoSnapshotPolicyId: pack["auto_snapshot_policy_id"].(string), + PerformanceLevel: pack["performance_level"].(string), + } + createDataDisks = append(createDataDisks, dataDisk) + } + request.DataDisk = &createDataDisks + } + + if v, ok := d.GetOk("role_name"); ok && v.(string) != "" { + request.RamRoleName = v.(string) + } + + if v, ok := d.GetOk("key_name"); ok && v.(string) != "" { + request.KeyPairName = v.(string) + } + + if v, ok := d.GetOk("user_data"); ok && v.(string) != "" { + _, base64DecodeError := base64.StdEncoding.DecodeString(v.(string)) + if base64DecodeError == nil { + request.UserData = v.(string) + } else { + request.UserData = base64.StdEncoding.EncodeToString([]byte(v.(string))) + } + } + + if v, ok := d.GetOk("tags"); ok { + tags := "{" + for key, value := range v.(map[string]interface{}) { + tags += "\"" + key + "\"" + ":" + "\"" + value.(string) + "\"" + "," + } + request.Tags = strings.TrimSuffix(tags, ",") + "}" + } + + if v, ok := d.GetOk("instance_name"); ok && v.(string) != "" { + request.InstanceName = v.(string) + } + + if v, ok := d.GetOk("host_name"); ok && v.(string) != "" { + request.HostName = v.(string) + } + + if v, ok := d.GetOk("spot_strategy"); ok && v.(string) != "" { + request.SpotStrategy = v.(string) + } + + v, ok := d.GetOk("spot_price_limit") + if ok { + spotPriceLimits := make([]ess.CreateScalingConfigurationSpotPriceLimit, 0) + for _, e := range v.(*schema.Set).List() { + pack := e.(map[string]interface{}) + l := ess.CreateScalingConfigurationSpotPriceLimit{ + InstanceType: pack["instance_type"].(string), + PriceLimit: strconv.FormatFloat(pack["price_limit"].(float64), 'f', 2, 64), + } + spotPriceLimits = append(spotPriceLimits, l) + } + request.SpotPriceLimit = &spotPriceLimits + } + + return request, nil +} + +func activeSubstituteScalingConfiguration(d *schema.ResourceData, meta interface{}) (configures []ess.ScalingConfiguration, err error) { + client := meta.(*connectivity.AliyunClient) + essService := EssService{client} + substituteId, ok := d.GetOk("substitute") + + c, err := essService.DescribeEssScalingConfiguration(d.Id()) + if err != nil { + err = WrapError(err) + return + } + + request := ess.CreateDescribeScalingConfigurationsRequest() + request.RegionId = client.RegionId + request.ScalingGroupId = c.ScalingGroupId + + raw, err := client.WithEssClient(func(essClient *ess.Client) (interface{}, error) { + return essClient.DescribeScalingConfigurations(request) + }) + if err != nil { + err = WrapErrorf(err, DefaultErrorMsg, d.Id(), request.GetActionName(), AlibabaCloudSdkGoERROR) + return + } + addDebug(request.GetActionName(), raw, request.RpcRequest, request) + response, _ := raw.(*ess.DescribeScalingConfigurationsResponse) + if len(response.ScalingConfigurations.ScalingConfiguration) < 1 { + return + } + + if !ok || substituteId.(string) == "" { + + if len(response.ScalingConfigurations.ScalingConfiguration) == 1 { + return configures, WrapError(Error("Current scaling configuration %s is the last configuration for the scaling group %s, and it can't be inactive.", d.Id(), c.ScalingGroupId)) + } + + var configs []string + for _, cc := range response.ScalingConfigurations.ScalingConfiguration { + if cc.ScalingConfigurationId != d.Id() { + configs = append(configs, cc.ScalingConfigurationId) + } + } + + return configures, WrapError(Error("Before inactivating current scaling configuration, you must select a substitute for scaling group from: %s.", strings.Join(configs, ","))) + + } + + err = essService.ActiveEssScalingConfiguration(c.ScalingGroupId, substituteId.(string)) + if err != nil { + return configures, WrapError(Error("Inactive scaling configuration %s err: %#v. Substitute scaling configuration ID: %s", + d.Id(), err, substituteId.(string))) + } + + return response.ScalingConfigurations.ScalingConfiguration, nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ess_scalingconfiguration.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ess_scalingconfiguration.go deleted file mode 100644 index 043ca3b55aa..00000000000 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ess_scalingconfiguration.go +++ /dev/null @@ -1,990 +0,0 @@ -package alicloud - -import ( - "encoding/base64" - "fmt" - "regexp" - "strconv" - "strings" - "time" - - "github.com/hashicorp/terraform-plugin-sdk/helper/validation" - - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/services/ess" - "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" -) - -func resourceAlicloudEssScalingConfiguration() *schema.Resource { - return &schema.Resource{ - Create: resourceAliyunEssScalingConfigurationCreate, - Read: resourceAliyunEssScalingConfigurationRead, - Update: resourceAliyunEssScalingConfigurationUpdate, - Delete: resourceAliyunEssScalingConfigurationDelete, - Importer: &schema.ResourceImporter{ - State: schema.ImportStatePassthrough, - }, - - Schema: map[string]*schema.Schema{ - "active": { - Type: schema.TypeBool, - Optional: true, - Computed: true, - }, - "enable": { - Type: schema.TypeBool, - Optional: true, - }, - "scaling_group_id": { - Type: schema.TypeString, - ForceNew: true, - Required: true, - }, - "image_id": { - Type: schema.TypeString, - Optional: true, - }, - "image_name": { - Type: schema.TypeString, - Optional: true, - }, - "instance_type": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validation.StringMatch(regexp.MustCompile(`^ecs\..*`), "prefix must be 'ecs.'"), - ConflictsWith: []string{"instance_types"}, - }, - "instance_types": { - Type: schema.TypeList, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - Optional: true, - ConflictsWith: []string{"instance_type"}, - MaxItems: int(MaxScalingConfigurationInstanceTypes), - }, - "io_optimized": { - Type: schema.TypeString, - Optional: true, - Deprecated: "Attribute io_optimized has been deprecated on instance resource. All the launched alicloud instances will be IO optimized. Suggest to remove it from your template.", - }, - "is_outdated": { - Type: schema.TypeBool, - Optional: true, - }, - "security_group_id": { - Type: schema.TypeString, - Optional: true, - ConflictsWith: []string{"security_group_ids"}, - }, - "security_group_ids": { - Type: schema.TypeList, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - ConflictsWith: []string{"security_group_id"}, - Optional: true, - MaxItems: 16, - }, - "scaling_configuration_name": { - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "internet_charge_type": { - Type: schema.TypeString, - Optional: true, - Default: PayByBandwidth, - ValidateFunc: validation.StringInSlice([]string{"PayByBandwidth", "PayByTraffic"}, false), - }, - "internet_max_bandwidth_in": { - Type: schema.TypeInt, - Optional: true, - Computed: true, - }, - "internet_max_bandwidth_out": { - Type: schema.TypeInt, - Optional: true, - ValidateFunc: validation.IntBetween(0, 100), - }, - "credit_specification": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validation.StringInSlice([]string{ - string(CreditSpecificationStandard), - string(CreditSpecificationUnlimited), - }, false), - }, - "system_disk_category": { - Type: schema.TypeString, - Optional: true, - Default: DiskCloudEfficiency, - ValidateFunc: validation.StringInSlice([]string{"cloud", "ephemeral_ssd", "cloud_ssd", "cloud_essd", "cloud_efficiency"}, false), - }, - "system_disk_size": { - Type: schema.TypeInt, - Optional: true, - ValidateFunc: validation.IntBetween(20, 500), - }, - "system_disk_name": { - Type: schema.TypeString, - Optional: true, - }, - "system_disk_description": { - Type: schema.TypeString, - Optional: true, - }, - "system_disk_auto_snapshot_policy_id": { - Type: schema.TypeString, - Optional: true, - }, - "data_disk": { - Optional: true, - Type: schema.TypeList, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "size": { - Type: schema.TypeInt, - Optional: true, - }, - "category": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validation.StringInSlice([]string{"all", "cloud", "ephemeral_ssd", "cloud_essd", "cloud_efficiency", "cloud_ssd", "local_disk"}, false), - }, - "snapshot_id": { - Type: schema.TypeString, - Optional: true, - }, - "device": { - Type: schema.TypeString, - Optional: true, - Deprecated: "Attribute device has been deprecated on disk attachment resource. Suggest to remove it from your template.", - }, - "delete_with_instance": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - "encrypted": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - "kms_key_id": { - Type: schema.TypeString, - Optional: true, - }, - "name": { - Type: schema.TypeString, - Optional: true, - }, - "description": { - Type: schema.TypeString, - Optional: true, - }, - "auto_snapshot_policy_id": { - Type: schema.TypeString, - Optional: true, - }, - "performance_level": { - Type: schema.TypeString, - Optional: true, - }, - }, - }, - }, - "instance_ids": { - Type: schema.TypeList, - Elem: &schema.Schema{Type: schema.TypeString}, - Optional: true, - DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { - return true - }, - Deprecated: "Field 'instance_ids' has been deprecated from provider version 1.6.0. New resource 'alicloud_ess_attachment' replaces it.", - }, - - "substitute": { - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - - "user_data": { - Type: schema.TypeString, - Optional: true, - }, - - "role_name": { - Type: schema.TypeString, - Optional: true, - }, - - "key_name": { - Type: schema.TypeString, - Optional: true, - }, - - "force_delete": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - - "tags": { - Type: schema.TypeMap, - Optional: true, - }, - - "instance_name": { - Type: schema.TypeString, - Optional: true, - Default: "ESS-Instance", - ValidateFunc: validation.StringLenBetween(2, 128), - }, - - "override": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - "password": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { - return d.Get("password_inherit").(bool) - }, - }, - "password_inherit": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - "kms_encrypted_password": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { - return d.Get("password_inherit").(bool) || d.Get("password").(string) != "" - }, - }, - "kms_encryption_context": { - Type: schema.TypeMap, - Optional: true, - DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { - return d.Get("kms_encrypted_password").(string) == "" - }, - Elem: schema.TypeString, - }, - "system_disk_performance_level": { - Type: schema.TypeString, - Optional: true, - }, - }, - } -} - -func resourceAliyunEssScalingConfigurationCreate(d *schema.ResourceData, meta interface{}) error { - - // Ensure instance_type is generation three - client := meta.(*connectivity.AliyunClient) - request, err := buildAlicloudEssScalingConfigurationArgs(d, meta) - if err != nil { - return WrapError(err) - } - - request.IoOptimized = string(IOOptimized) - if d.Get("is_outdated").(bool) == true { - request.IoOptimized = string(NoneOptimized) - } - - if err := resource.Retry(5*time.Minute, func() *resource.RetryError { - raw, err := client.WithEssClient(func(essClient *ess.Client) (interface{}, error) { - return essClient.CreateScalingConfiguration(request) - }) - if err != nil { - if IsExpectedErrors(err, []string{Throttling, "IncorrectScalingGroupStatus"}) { - return resource.RetryableError(err) - } - return resource.NonRetryableError(err) - } - addDebug(request.GetActionName(), raw, request.RpcRequest, request) - response, _ := raw.(*ess.CreateScalingConfigurationResponse) - d.SetId(response.ScalingConfigurationId) - return nil - }); err != nil { - return WrapErrorf(err, DefaultErrorMsg, "alicloud_ess_scalingconfiguration", request.GetActionName(), AlibabaCloudSdkGoERROR) - } - - return resourceAliyunEssScalingConfigurationUpdate(d, meta) -} - -func resourceAliyunEssScalingConfigurationUpdate(d *schema.ResourceData, meta interface{}) error { - client := meta.(*connectivity.AliyunClient) - essService := EssService{client} - d.Partial(true) - if strings.Contains(d.Id(), COLON_SEPARATED) { - d.SetId(strings.Split(d.Id(), COLON_SEPARATED)[1]) - } - - if d.HasChange("active") { - c, err := essService.DescribeEssScalingConfiguration(d.Id()) - if err != nil { - if NotFoundError(err) { - d.SetId("") - return nil - } - return WrapError(err) - } - - if d.Get("active").(bool) { - if c.LifecycleState == string(Inactive) { - - err := essService.ActiveEssScalingConfiguration(c.ScalingGroupId, d.Id()) - if err != nil { - return WrapError(err) - } - } - } else { - if c.LifecycleState == string(Active) { - _, err := activeSubstituteScalingConfiguration(d, meta) - if err != nil { - return WrapError(err) - } - } - } - d.SetPartial("active") - } - - if err := enableEssScalingConfiguration(d, meta); err != nil { - return WrapError(err) - } - - if err := modifyEssScalingConfiguration(d, meta); err != nil { - return WrapError(err) - } - - d.Partial(false) - - return resourceAliyunEssScalingConfigurationRead(d, meta) -} - -func modifyEssScalingConfiguration(d *schema.ResourceData, meta interface{}) error { - client := meta.(*connectivity.AliyunClient) - request := ess.CreateModifyScalingConfigurationRequest() - request.ScalingConfigurationId = d.Id() - - if d.HasChange("override") { - request.Override = requests.NewBoolean(d.Get("override").(bool)) - d.SetPartial("override") - } - - if d.HasChange("password_inherit") { - request.PasswordInherit = requests.NewBoolean(d.Get("password_inherit").(bool)) - d.SetPartial("password_inherit") - } - if d.HasChange("image_id") || d.Get("override").(bool) { - request.ImageId = d.Get("image_id").(string) - d.SetPartial("image_id") - } - - if d.HasChange("image_name") || d.Get("override").(bool) { - request.ImageName = d.Get("image_name").(string) - d.SetPartial("image_name") - } - - hasChangeInstanceType := d.HasChange("instance_type") - hasChangeInstanceTypes := d.HasChange("instance_types") - if hasChangeInstanceType || hasChangeInstanceTypes || d.Get("override").(bool) { - instanceType := d.Get("instance_type").(string) - instanceTypes := d.Get("instance_types").([]interface{}) - if instanceType == "" && (instanceTypes == nil || len(instanceTypes) == 0) { - return fmt.Errorf("instance_type or instance_types must be assigned") - } - types := make([]string, 0, int(MaxScalingConfigurationInstanceTypes)) - if instanceTypes != nil && len(instanceTypes) > 0 { - types = expandStringList(instanceTypes) - } - if instanceType != "" { - types = append(types, instanceType) - } - request.InstanceTypes = &types - } - - hasChangeSecurityGroupId := d.HasChange("security_group_id") - hasChangeSecurityGroupIds := d.HasChange("security_group_ids") - if hasChangeSecurityGroupId || hasChangeSecurityGroupIds || d.Get("override").(bool) { - securityGroupId := d.Get("security_group_id").(string) - securityGroupIds := d.Get("security_group_ids").([]interface{}) - if securityGroupId == "" && (securityGroupIds == nil || len(securityGroupIds) == 0) { - return fmt.Errorf("securityGroupId or securityGroupIds must be assigned") - } - if securityGroupIds != nil && len(securityGroupIds) > 0 { - sgs := expandStringList(securityGroupIds) - request.SecurityGroupIds = &sgs - } - - if securityGroupId != "" { - request.SecurityGroupId = securityGroupId - } - } - - if d.HasChange("scaling_configuration_name") { - request.ScalingConfigurationName = d.Get("scaling_configuration_name").(string) - d.SetPartial("scaling_configuration_name") - } - - if d.HasChange("internet_charge_type") { - request.InternetChargeType = d.Get("internet_charge_type").(string) - d.SetPartial("internet_charge_type") - } - - if d.HasChange("internet_max_bandwidth_out") { - request.InternetMaxBandwidthOut = requests.NewInteger(d.Get("internet_max_bandwidth_out").(int)) - d.SetPartial("internet_max_bandwidth_out") - } - - if d.HasChange("credit_specification") { - request.CreditSpecification = d.Get("credit_specification").(string) - d.SetPartial("credit_specification") - } - - if d.HasChange("system_disk_category") { - request.SystemDiskCategory = d.Get("system_disk_category").(string) - d.SetPartial("system_disk_category") - } - - if d.HasChange("system_disk_size") { - request.SystemDiskSize = requests.NewInteger(d.Get("system_disk_size").(int)) - d.SetPartial("system_disk_size") - } - - if d.HasChange("system_disk_name") { - request.SystemDiskDiskName = d.Get("system_disk_name").(string) - d.SetPartial("system_disk_name") - } - - if d.HasChange("system_disk_description") { - request.SystemDiskDescription = d.Get("system_disk_description").(string) - d.SetPartial("system_disk_description") - } - - if d.HasChange("system_disk_auto_snapshot_policy_id") { - request.SystemDiskAutoSnapshotPolicyId = d.Get("system_disk_auto_snapshot_policy_id").(string) - d.SetPartial("system_disk_auto_snapshot_policy_id") - } - - if d.HasChange("system_disk_performance_level") { - request.SystemDiskPerformanceLevel = d.Get("system_disk_performance_level").(string) - d.SetPartial("system_disk_performance_level") - } - - if d.HasChange("user_data") { - if v, ok := d.GetOk("user_data"); ok && v.(string) != "" { - _, base64DecodeError := base64.StdEncoding.DecodeString(v.(string)) - if base64DecodeError == nil { - request.UserData = v.(string) - } else { - request.UserData = base64.StdEncoding.EncodeToString([]byte(v.(string))) - } - } - d.SetPartial("user_data") - } - - if d.HasChange("role_name") { - request.RamRoleName = d.Get("role_name").(string) - d.SetPartial("role_name") - } - - if d.HasChange("key_name") { - request.KeyPairName = d.Get("key_name").(string) - d.SetPartial("key_name") - } - - if d.HasChange("instance_name") { - request.InstanceName = d.Get("instance_name").(string) - d.SetPartial("instance_name") - } - - if d.HasChange("tags") { - if v, ok := d.GetOk("tags"); ok { - tags := "{" - for key, value := range v.(map[string]interface{}) { - tags += "\"" + key + "\"" + ":" + "\"" + value.(string) + "\"" + "," - } - request.Tags = strings.TrimSuffix(tags, ",") + "}" - } - d.SetPartial("tags") - } - - if d.HasChange("data_disk") { - dds, ok := d.GetOk("data_disk") - if ok { - disks := dds.([]interface{}) - createDataDisks := make([]ess.ModifyScalingConfigurationDataDisk, 0, len(disks)) - for _, e := range disks { - pack := e.(map[string]interface{}) - dataDisk := ess.ModifyScalingConfigurationDataDisk{ - Size: strconv.Itoa(pack["size"].(int)), - Category: pack["category"].(string), - SnapshotId: pack["snapshot_id"].(string), - DeleteWithInstance: strconv.FormatBool(pack["delete_with_instance"].(bool)), - Device: pack["device"].(string), - Encrypted: strconv.FormatBool(pack["encrypted"].(bool)), - KMSKeyId: pack["kms_key_id"].(string), - DiskName: pack["name"].(string), - Description: pack["description"].(string), - AutoSnapshotPolicyId: pack["auto_snapshot_policy_id"].(string), - PerformanceLevel: pack["performance_level"].(string), - } - createDataDisks = append(createDataDisks, dataDisk) - } - request.DataDisk = &createDataDisks - } - d.SetPartial("data_disk") - } - raw, err := client.WithEssClient(func(essClient *ess.Client) (interface{}, error) { - return essClient.ModifyScalingConfiguration(request) - }) - if err != nil { - return WrapErrorf(err, DefaultErrorMsg, d.Id(), request.GetActionName(), AlibabaCloudSdkGoERROR) - } - addDebug(request.GetActionName(), raw, request.RpcRequest, request) - return nil -} - -func enableEssScalingConfiguration(d *schema.ResourceData, meta interface{}) error { - client := meta.(*connectivity.AliyunClient) - essService := EssService{client} - - if d.HasChange("enable") { - sgId := d.Get("scaling_group_id").(string) - group, err := essService.DescribeEssScalingGroup(sgId) - if err != nil { - return WrapError(err) - } - - if d.Get("enable").(bool) { - if group.LifecycleState == string(Inactive) { - - object, err := essService.DescribeEssScalingConfifurations(sgId) - - if err != nil { - return WrapError(err) - } - activeConfig := "" - var csIds []string - for _, c := range object { - csIds = append(csIds, c.ScalingConfigurationId) - if c.LifecycleState == string(Active) { - activeConfig = c.ScalingConfigurationId - } - } - - if activeConfig == "" { - return WrapError(Error("Please active a scaling configuration before enabling scaling group %s. Its all scaling configuration are %s.", - sgId, strings.Join(csIds, ","))) - } - - request := ess.CreateEnableScalingGroupRequest() - request.RegionId = client.RegionId - request.ScalingGroupId = sgId - request.ActiveScalingConfigurationId = activeConfig - - raw, err := client.WithEssClient(func(essClient *ess.Client) (interface{}, error) { - return essClient.EnableScalingGroup(request) - }) - if err != nil { - return WrapErrorf(err, DefaultErrorMsg, d.Id(), request.GetActionName(), AlibabaCloudSdkGoERROR) - } - addDebug(request.GetActionName(), raw, request.RpcRequest, request) - if err := essService.WaitForEssScalingGroup(sgId, Active, DefaultTimeout); err != nil { - return WrapError(err) - } - - d.SetPartial("scaling_configuration_id") - } - } else { - if group.LifecycleState == string(Active) { - request := ess.CreateDisableScalingGroupRequest() - request.RegionId = client.RegionId - request.ScalingGroupId = sgId - raw, err := client.WithEssClient(func(essClient *ess.Client) (interface{}, error) { - return essClient.DisableScalingGroup(request) - }) - if err != nil { - return WrapErrorf(err, DefaultErrorMsg, d.Id(), request.GetActionName(), AlibabaCloudSdkGoERROR) - } - addDebug(request.GetActionName(), raw, request.RpcRequest, request) - if err := essService.WaitForEssScalingGroup(sgId, Inactive, DefaultTimeout); err != nil { - return WrapError(err) - } - } - } - d.SetPartial("enable") - } - - return nil -} - -func resourceAliyunEssScalingConfigurationRead(d *schema.ResourceData, meta interface{}) error { - - client := meta.(*connectivity.AliyunClient) - essService := EssService{client} - if strings.Contains(d.Id(), COLON_SEPARATED) { - d.SetId(strings.Split(d.Id(), COLON_SEPARATED)[1]) - } - object, err := essService.DescribeEssScalingConfiguration(d.Id()) - if err != nil { - if NotFoundError(err) { - d.SetId("") - return nil - } - return WrapError(err) - } - - d.Set("scaling_group_id", object.ScalingGroupId) - d.Set("active", object.LifecycleState == string(Active)) - d.Set("image_id", object.ImageId) - d.Set("image_name", object.ImageName) - d.Set("scaling_configuration_name", object.ScalingConfigurationName) - d.Set("internet_charge_type", object.InternetChargeType) - d.Set("internet_max_bandwidth_in", object.InternetMaxBandwidthIn) - d.Set("internet_max_bandwidth_out", object.InternetMaxBandwidthOut) - d.Set("credit_specification", object.CreditSpecification) - d.Set("system_disk_category", object.SystemDiskCategory) - d.Set("system_disk_size", object.SystemDiskSize) - d.Set("system_disk_name", object.SystemDiskName) - d.Set("system_disk_description", object.SystemDiskDescription) - d.Set("system_disk_auto_snapshot_policy_id", object.SystemDiskAutoSnapshotPolicyId) - d.Set("system_disk_performance_level", object.SystemDiskPerformanceLevel) - d.Set("data_disk", essService.flattenDataDiskMappings(object.DataDisks.DataDisk)) - d.Set("role_name", object.RamRoleName) - d.Set("key_name", object.KeyPairName) - d.Set("force_delete", d.Get("force_delete").(bool)) - d.Set("tags", essTagsToMap(object.Tags.Tag)) - d.Set("instance_name", object.InstanceName) - d.Set("override", d.Get("override").(bool)) - d.Set("password_inherit", object.PasswordInherit) - - if sg, ok := d.GetOk("security_group_id"); ok && sg.(string) != "" { - d.Set("security_group_id", object.SecurityGroupId) - } - if sgs, ok := d.GetOk("security_group_ids"); ok && len(sgs.([]interface{})) > 0 { - d.Set("security_group_ids", object.SecurityGroupIds.SecurityGroupId) - } - if instanceType, ok := d.GetOk("instance_type"); ok && instanceType.(string) != "" { - d.Set("instance_type", object.InstanceType) - } - if instanceTypes, ok := d.GetOk("instance_types"); ok && len(instanceTypes.([]interface{})) > 0 { - d.Set("instance_types", object.InstanceTypes.InstanceType) - } - userData := d.Get("user_data") - if userData.(string) != "" { - _, base64DecodeError := base64.StdEncoding.DecodeString(userData.(string)) - if base64DecodeError == nil { - d.Set("user_data", object.UserData) - } else { - d.Set("user_data", userDataHashSum(object.UserData)) - } - } else { - d.Set("user_data", userDataHashSum(object.UserData)) - } - return nil -} - -func resourceAliyunEssScalingConfigurationDelete(d *schema.ResourceData, meta interface{}) error { - client := meta.(*connectivity.AliyunClient) - essService := EssService{client} - - if strings.Contains(d.Id(), COLON_SEPARATED) { - d.SetId(strings.Split(d.Id(), COLON_SEPARATED)[1]) - } - - object, err := essService.DescribeEssScalingConfiguration(d.Id()) - if err != nil { - if NotFoundError(err) { - return nil - } - return WrapError(err) - } - - request := ess.CreateDescribeScalingConfigurationsRequest() - request.RegionId = client.RegionId - request.ScalingGroupId = object.ScalingGroupId - - raw, err := client.WithEssClient(func(essClient *ess.Client) (interface{}, error) { - return essClient.DescribeScalingConfigurations(request) - }) - if err != nil { - return WrapErrorf(err, DefaultErrorMsg, d.Id(), request.GetActionName(), AlibabaCloudSdkGoERROR) - } - addDebug(request.GetActionName(), raw, request.RpcRequest, request) - response, _ := raw.(*ess.DescribeScalingConfigurationsResponse) - if len(response.ScalingConfigurations.ScalingConfiguration) < 1 { - return nil - } else if len(response.ScalingConfigurations.ScalingConfiguration) == 1 { - if d.Get("force_delete").(bool) { - request := ess.CreateDeleteScalingGroupRequest() - request.ScalingGroupId = object.ScalingGroupId - request.ForceDelete = requests.NewBoolean(true) - request.RegionId = client.RegionId - raw, err := client.WithEssClient(func(essClient *ess.Client) (interface{}, error) { - return essClient.DeleteScalingGroup(request) - }) - - if err != nil { - if IsExpectedErrors(err, []string{"InvalidScalingGroupId.NotFound"}) { - return nil - } - return WrapErrorf(err, DefaultErrorMsg, d.Id(), request.GetActionName(), AlibabaCloudSdkGoERROR) - } - addDebug(request.GetActionName(), raw, request.RpcRequest, request) - return WrapError(essService.WaitForEssScalingGroup(d.Id(), Deleted, DefaultTimeout)) - } - return WrapError(Error("Current scaling configuration %s is the last configuration for the scaling group %s. Please launch a new "+ - "active scaling configuration or set 'force_delete' to 'true' to delete it with deleting its scaling group.", d.Id(), object.ScalingGroupId)) - } - - deleteScalingConfigurationRequest := ess.CreateDeleteScalingConfigurationRequest() - deleteScalingConfigurationRequest.ScalingConfigurationId = d.Id() - - rawDeleteScalingConfiguration, err := client.WithEssClient(func(essClient *ess.Client) (interface{}, error) { - return essClient.DeleteScalingConfiguration(deleteScalingConfigurationRequest) - }) - - if err != nil { - if IsExpectedErrors(err, []string{"InvalidScalingGroupId.NotFound", "InvalidScalingConfigurationId.NotFound"}) { - return nil - } - return WrapErrorf(err, DefaultErrorMsg, d.Id(), request.GetActionName(), AlibabaCloudSdkGoERROR) - } - addDebug(request.GetActionName(), rawDeleteScalingConfiguration, request.RpcRequest, request) - - return WrapError(essService.WaitForScalingConfiguration(d.Id(), Deleted, DefaultTimeout)) -} - -func buildAlicloudEssScalingConfigurationArgs(d *schema.ResourceData, meta interface{}) (*ess.CreateScalingConfigurationRequest, error) { - client := meta.(*connectivity.AliyunClient) - //ecsService := EcsService{client} - //zoneId, validZones, _, err := ecsService.DescribeAvailableResources(d, meta, InstanceTypeResource) - //if err != nil { - // return nil, WrapError(err) - //} - - request := ess.CreateCreateScalingConfigurationRequest() - request.RegionId = client.RegionId - request.ScalingGroupId = d.Get("scaling_group_id").(string) - request.ImageId = d.Get("image_id").(string) - request.SecurityGroupId = d.Get("security_group_id").(string) - request.PasswordInherit = requests.NewBoolean(d.Get("password_inherit").(bool)) - - securityGroupId := d.Get("security_group_id").(string) - securityGroupIds := d.Get("security_group_ids").([]interface{}) - - password := d.Get("password").(string) - kmsPassword := d.Get("kms_encrypted_password").(string) - - if password != "" { - request.Password = password - } else if kmsPassword != "" { - kmsService := KmsService{client} - decryptResp, err := kmsService.Decrypt(kmsPassword, d.Get("kms_encryption_context").(map[string]interface{})) - if err != nil { - return nil, WrapError(err) - } - request.Password = decryptResp - } - - if securityGroupId == "" && (securityGroupIds == nil || len(securityGroupIds) == 0) { - return nil, WrapError(Error("security_group_id or security_group_ids must be assigned")) - } - - if securityGroupIds != nil && len(securityGroupIds) > 0 { - sgs := expandStringList(securityGroupIds) - request.SecurityGroupIds = &sgs - } - - if securityGroupId != "" { - request.SecurityGroupId = securityGroupId - } - - types := make([]string, 0, int(MaxScalingConfigurationInstanceTypes)) - instanceType := d.Get("instance_type").(string) - instanceTypes := d.Get("instance_types").([]interface{}) - if instanceType == "" && (instanceTypes == nil || len(instanceTypes) == 0) { - return nil, WrapError(Error("instance_type or instance_types must be assigned")) - } - - if instanceTypes != nil && len(instanceTypes) > 0 { - types = expandStringList(instanceTypes) - } - - if instanceType != "" { - types = append(types, instanceType) - } - //for _, v := range types { - // if err := ecsService.InstanceTypeValidation(v, zoneId, validZones); err != nil { - // return nil, WrapError(err) - // } - //} - request.InstanceTypes = &types - - if v := d.Get("scaling_configuration_name").(string); v != "" { - request.ScalingConfigurationName = v - } - - if v := d.Get("image_name").(string); v != "" { - request.ImageName = v - } - - if v := d.Get("internet_charge_type").(string); v != "" { - request.InternetChargeType = v - } - - if v := d.Get("internet_max_bandwidth_in").(int); v != 0 { - request.InternetMaxBandwidthIn = requests.NewInteger(v) - } - - request.InternetMaxBandwidthOut = requests.NewInteger(d.Get("internet_max_bandwidth_out").(int)) - - if v := d.Get("credit_specification").(string); v != "" { - request.CreditSpecification = v - } - - if v := d.Get("system_disk_category").(string); v != "" { - request.SystemDiskCategory = v - } - - if v := d.Get("system_disk_size").(int); v != 0 { - request.SystemDiskSize = requests.NewInteger(v) - } - - if v := d.Get("system_disk_name").(string); v != "" { - request.SystemDiskDiskName = v - } - - if v := d.Get("system_disk_description").(string); v != "" { - request.SystemDiskDescription = v - } - - if v := d.Get("system_disk_auto_snapshot_policy_id").(string); v != "" { - request.SystemDiskAutoSnapshotPolicyId = v - } - - if v := d.Get("system_disk_performance_level").(string); v != "" { - request.SystemDiskPerformanceLevel = v - } - - dds, ok := d.GetOk("data_disk") - if ok { - disks := dds.([]interface{}) - createDataDisks := make([]ess.CreateScalingConfigurationDataDisk, 0, len(disks)) - for _, e := range disks { - pack := e.(map[string]interface{}) - dataDisk := ess.CreateScalingConfigurationDataDisk{ - Size: strconv.Itoa(pack["size"].(int)), - Category: pack["category"].(string), - SnapshotId: pack["snapshot_id"].(string), - DeleteWithInstance: strconv.FormatBool(pack["delete_with_instance"].(bool)), - Device: pack["device"].(string), - Encrypted: strconv.FormatBool(pack["encrypted"].(bool)), - KMSKeyId: pack["kms_key_id"].(string), - DiskName: pack["name"].(string), - Description: pack["description"].(string), - AutoSnapshotPolicyId: pack["auto_snapshot_policy_id"].(string), - PerformanceLevel: pack["performance_level"].(string), - } - createDataDisks = append(createDataDisks, dataDisk) - } - request.DataDisk = &createDataDisks - } - - if v, ok := d.GetOk("role_name"); ok && v.(string) != "" { - request.RamRoleName = v.(string) - } - - if v, ok := d.GetOk("key_name"); ok && v.(string) != "" { - request.KeyPairName = v.(string) - } - - if v, ok := d.GetOk("user_data"); ok && v.(string) != "" { - _, base64DecodeError := base64.StdEncoding.DecodeString(v.(string)) - if base64DecodeError == nil { - request.UserData = v.(string) - } else { - request.UserData = base64.StdEncoding.EncodeToString([]byte(v.(string))) - } - } - - if v, ok := d.GetOk("tags"); ok { - tags := "{" - for key, value := range v.(map[string]interface{}) { - tags += "\"" + key + "\"" + ":" + "\"" + value.(string) + "\"" + "," - } - request.Tags = strings.TrimSuffix(tags, ",") + "}" - } - - if v, ok := d.GetOk("instance_name"); ok && v.(string) != "" { - request.InstanceName = v.(string) - } - - return request, nil -} - -func activeSubstituteScalingConfiguration(d *schema.ResourceData, meta interface{}) (configures []ess.ScalingConfiguration, err error) { - client := meta.(*connectivity.AliyunClient) - essService := EssService{client} - substituteId, ok := d.GetOk("substitute") - - c, err := essService.DescribeEssScalingConfiguration(d.Id()) - if err != nil { - err = WrapError(err) - return - } - - request := ess.CreateDescribeScalingConfigurationsRequest() - request.RegionId = client.RegionId - request.ScalingGroupId = c.ScalingGroupId - - raw, err := client.WithEssClient(func(essClient *ess.Client) (interface{}, error) { - return essClient.DescribeScalingConfigurations(request) - }) - if err != nil { - err = WrapErrorf(err, DefaultErrorMsg, d.Id(), request.GetActionName(), AlibabaCloudSdkGoERROR) - return - } - addDebug(request.GetActionName(), raw, request.RpcRequest, request) - response, _ := raw.(*ess.DescribeScalingConfigurationsResponse) - if len(response.ScalingConfigurations.ScalingConfiguration) < 1 { - return - } - - if !ok || substituteId.(string) == "" { - - if len(response.ScalingConfigurations.ScalingConfiguration) == 1 { - return configures, WrapError(Error("Current scaling configuration %s is the last configuration for the scaling group %s, and it can't be inactive.", d.Id(), c.ScalingGroupId)) - } - - var configs []string - for _, cc := range response.ScalingConfigurations.ScalingConfiguration { - if cc.ScalingConfigurationId != d.Id() { - configs = append(configs, cc.ScalingConfigurationId) - } - } - - return configures, WrapError(Error("Before inactivating current scaling configuration, you must select a substitute for scaling group from: %s.", strings.Join(configs, ","))) - - } - - err = essService.ActiveEssScalingConfiguration(c.ScalingGroupId, substituteId.(string)) - if err != nil { - return configures, WrapError(Error("Inactive scaling configuration %s err: %#v. Substitute scaling configuration ID: %s", - d.Id(), err, substituteId.(string))) - } - - return response.ScalingConfigurations.ScalingConfiguration, nil -} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ess_scalinggroup.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ess_scalinggroup.go index eedba1b603a..5141bd94bce 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ess_scalinggroup.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ess_scalinggroup.go @@ -118,6 +118,10 @@ func resourceAlicloudEssScalingGroup() *schema.Resource { Optional: true, Default: false, }, + "launch_template_id": { + Type: schema.TypeString, + Optional: true, + }, }, } } @@ -211,6 +215,7 @@ func resourceAliyunEssScalingGroupRead(d *schema.ResourceData, meta interface{}) } } d.Set("vswitch_ids", vswitchIds) + d.Set("launch_template_id", object.LaunchTemplateId) return nil } @@ -398,6 +403,10 @@ func buildAlicloudEssScalingGroupArgs(d *schema.ResourceData, meta interface{}) request.GroupDeletionProtection = requests.NewBoolean(v.(bool)) } + if v, ok := d.GetOk("launch_template_id"); ok { + request.LaunchTemplateId = v.(string) + } + return request, nil } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_event_bridge_service_linked_role.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_event_bridge_service_linked_role.go new file mode 100644 index 00000000000..2017814caf2 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_event_bridge_service_linked_role.go @@ -0,0 +1,132 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudEventBridgeServiceLinkedRole() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudEventBridgeServiceLinkedRoleCreate, + Read: resourceAlicloudEventBridgeServiceLinkedRoleRead, + Delete: resourceAlicloudEventBridgeServiceLinkedRoleDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "product_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + "AliyunServiceRoleForEventBridgeSourceRocketMQ", + "AliyunServiceRoleForEventBridgeSourceActionTrail", + "AliyunServiceRoleForEventBridgeSourceRabbitMQ", + "AliyunServiceRoleForEventBridgeSendToMNS", + "AliyunServiceRoleForEventBridgeConnectVPC", + "AliyunServiceRoleForEventBridgeSendToFC", + "AliyunServiceRoleForEventBridgeSendToSMS", + "AliyunServiceRoleForEventBridgeSendToDirectMail", + "AliyunServiceRoleForEventBridgeSendToRabbitMQ", + "AliyunServiceRoleForEventBridgeSendToRocketMQ", + }, false), + }, + }, + } +} +func resourceAlicloudEventBridgeServiceLinkedRoleCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + eventbridgeService := EventbridgeService{client} + var response map[string]interface{} + action := "CreateServiceLinkedRoleForProduct" + request := map[string]interface{}{ + "ProductName": d.Get("product_name"), + } + conn, err := client.NewEventbridgeClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(3*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-04-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_event_bridge_service_linked_role", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Code"]) != "Success" { + return WrapError(fmt.Errorf("CreateServiceLinkedRoleForProduct failed, response: %v", response)) + } + d.SetId(request["ProductName"].(string)) + + stateConf := BuildStateConf([]string{}, []string{"true"}, d.Timeout(schema.TimeoutCreate), 10*time.Second, eventbridgeService.CheckRoleForProductRefreshFunc(d.Id(), []string{"false"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return resourceAlicloudEventBridgeServiceLinkedRoleRead(d, meta) +} + +func resourceAlicloudEventBridgeServiceLinkedRoleRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + eventbridgeService := EventbridgeService{client} + object, err := eventbridgeService.DescribeEventBridgeServiceLinkedRole(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_event_bridge_event_bus eventbridgeService.DescribeEventBridgeServiceLinkedRole Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("product_name", object["StsRoleName"]) + return nil +} + +func resourceAlicloudEventBridgeServiceLinkedRoleDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteServiceLinkedRole" + var response map[string]interface{} + conn, err := client.NewResourcemanagerClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "RoleName": d.Id(), + } + wait := incrementalWait(3*time.Second, 0*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-03-31"), StringPointer("AK"), request, nil, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"EntityNotExist.Role"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_event_bridge_slr.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_event_bridge_slr.go deleted file mode 100644 index eefc5d3b549..00000000000 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_event_bridge_slr.go +++ /dev/null @@ -1,132 +0,0 @@ -package alicloud - -import ( - "fmt" - "log" - "time" - - "github.com/hashicorp/terraform-plugin-sdk/helper/validation" - - util "github.com/alibabacloud-go/tea-utils/service" - "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" -) - -func resourceAlicloudEventBridgeSlr() *schema.Resource { - return &schema.Resource{ - Create: resourceAlicloudEventBridgeSlrCreate, - Read: resourceAlicloudEventBridgeSlrRead, - Delete: resourceAlicloudEventBridgeSlrDelete, - Importer: &schema.ResourceImporter{ - State: schema.ImportStatePassthrough, - }, - Schema: map[string]*schema.Schema{ - "product_name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringInSlice([]string{ - "AliyunServiceRoleForEventBridgeSourceRocketMQ", - "AliyunServiceRoleForEventBridgeSourceActionTrail", - "AliyunServiceRoleForEventBridgeSourceRabbitMQ", - "AliyunServiceRoleForEventBridgeSendToMNS", - "AliyunServiceRoleForEventBridgeConnectVPC", - "AliyunServiceRoleForEventBridgeSendToFC", - "AliyunServiceRoleForEventBridgeSendToSMS", - "AliyunServiceRoleForEventBridgeSendToDirectMail", - "AliyunServiceRoleForEventBridgeSendToRabbitMQ", - "AliyunServiceRoleForEventBridgeSendToRocketMQ", - }, false), - }, - }, - } -} -func resourceAlicloudEventBridgeSlrCreate(d *schema.ResourceData, meta interface{}) error { - client := meta.(*connectivity.AliyunClient) - eventbridgeService := EventbridgeService{client} - var response map[string]interface{} - action := "CreateServiceLinkedRoleForProduct" - request := map[string]interface{}{ - "ProductName": d.Get("product_name"), - } - conn, err := client.NewEventbridgeClient() - if err != nil { - return WrapError(err) - } - wait := incrementalWait(3*time.Second, 5*time.Second) - err = resource.Retry(3*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-04-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) - if err != nil { - if NeedRetry(err) { - wait() - return resource.RetryableError(err) - } - return resource.NonRetryableError(err) - } - return nil - }) - addDebug(action, response, request) - if err != nil { - return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_event_bridge_slr", action, AlibabaCloudSdkGoERROR) - } - if fmt.Sprint(response["Code"]) != "Success" { - return WrapError(fmt.Errorf("CreateServiceLinkedRoleForProduct failed, response: %v", response)) - } - d.SetId(request["ProductName"].(string)) - - stateConf := BuildStateConf([]string{}, []string{"true"}, d.Timeout(schema.TimeoutCreate), 10*time.Second, eventbridgeService.CheckRoleForProductRefreshFunc(d.Id(), []string{"false"})) - if _, err := stateConf.WaitForState(); err != nil { - return WrapErrorf(err, IdMsg, d.Id()) - } - return resourceAlicloudEventBridgeSlrRead(d, meta) -} - -func resourceAlicloudEventBridgeSlrRead(d *schema.ResourceData, meta interface{}) error { - client := meta.(*connectivity.AliyunClient) - eventbridgeService := EventbridgeService{client} - object, err := eventbridgeService.DescribeEventBridgeSlr(d.Id()) - if err != nil { - if NotFoundError(err) { - log.Printf("[DEBUG] Resource alicloud_event_bridge_event_bus eventbridgeService.DescribeEventBridgeSlr Failed!!! %s", err) - d.SetId("") - return nil - } - return WrapError(err) - } - d.Set("product_name", object["StsRoleName"]) - return nil -} - -func resourceAlicloudEventBridgeSlrDelete(d *schema.ResourceData, meta interface{}) error { - client := meta.(*connectivity.AliyunClient) - action := "DeleteServiceLinkedRole" - var response map[string]interface{} - conn, err := client.NewResourcemanagerClient() - if err != nil { - return WrapError(err) - } - request := map[string]interface{}{ - "RoleName": d.Id(), - } - wait := incrementalWait(3*time.Second, 0*time.Second) - err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-03-31"), StringPointer("AK"), request, nil, &util.RuntimeOptions{}) - if err != nil { - if NeedRetry(err) { - wait() - return resource.RetryableError(err) - } - return resource.NonRetryableError(err) - } - return nil - }) - addDebug(action, response, request) - if err != nil { - if IsExpectedErrors(err, []string{"EntityNotExist.Role"}) { - return nil - } - return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) - } - return nil -} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_express_connect_virtual_border_router.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_express_connect_virtual_border_router.go new file mode 100644 index 00000000000..1c35fa00251 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_express_connect_virtual_border_router.go @@ -0,0 +1,488 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudExpressConnectVirtualBorderRouter() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudExpressConnectVirtualBorderRouterCreate, + Read: resourceAlicloudExpressConnectVirtualBorderRouterRead, + Update: resourceAlicloudExpressConnectVirtualBorderRouterUpdate, + Delete: resourceAlicloudExpressConnectVirtualBorderRouterDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Update: schema.DefaultTimeout(2 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "associated_physical_connections": { + Type: schema.TypeString, + Optional: true, + }, + "bandwidth": { + Type: schema.TypeInt, + Optional: true, + }, + "circuit_code": { + Type: schema.TypeString, + Optional: true, + }, + "description": { + Type: schema.TypeString, + Optional: true, + }, + "detect_multiplier": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + ValidateFunc: validation.IntBetween(3, 10), + }, + "enable_ipv6": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "local_gateway_ip": { + Type: schema.TypeString, + Required: true, + }, + "local_ipv6_gateway_ip": { + Type: schema.TypeString, + Optional: true, + }, + "min_rx_interval": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + ValidateFunc: validation.IntBetween(200, 1000), + }, + "min_tx_interval": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + ValidateFunc: validation.IntBetween(200, 1000), + }, + "peer_gateway_ip": { + Type: schema.TypeString, + Required: true, + }, + "peer_ipv6_gateway_ip": { + Type: schema.TypeString, + Optional: true, + }, + "peering_ipv6_subnet_mask": { + Type: schema.TypeString, + Optional: true, + }, + "peering_subnet_mask": { + Type: schema.TypeString, + Required: true, + }, + "physical_connection_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"active", "deleting", "recovering", "terminated", "terminating", "unconfirmed"}, false), + }, + "vbr_owner_id": { + Type: schema.TypeString, + Optional: true, + }, + "virtual_border_router_name": { + Type: schema.TypeString, + Optional: true, + }, + "vlan_id": { + Type: schema.TypeInt, + Required: true, + ValidateFunc: validation.IntBetween(0, 2999), + }, + }, + } +} + +func resourceAlicloudExpressConnectVirtualBorderRouterCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateVirtualBorderRouter" + request := make(map[string]interface{}) + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("bandwidth"); ok { + request["Bandwidth"] = v + } + if v, ok := d.GetOk("circuit_code"); ok { + request["CircuitCode"] = v + } + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + if v, ok := d.GetOkExists("enable_ipv6"); ok { + request["EnableIpv6"] = v + } + request["LocalGatewayIp"] = d.Get("local_gateway_ip") + if v, ok := d.GetOk("local_ipv6_gateway_ip"); ok { + request["LocalIpv6GatewayIp"] = v + } + request["PeerGatewayIp"] = d.Get("peer_gateway_ip") + if v, ok := d.GetOk("peer_ipv6_gateway_ip"); ok { + request["PeerIpv6GatewayIp"] = v + } + if v, ok := d.GetOk("peering_ipv6_subnet_mask"); ok { + request["PeeringIpv6SubnetMask"] = v + } + request["PeeringSubnetMask"] = d.Get("peering_subnet_mask") + request["PhysicalConnectionId"] = d.Get("physical_connection_id") + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("vbr_owner_id"); ok { + request["VbrOwnerId"] = v + } + if v, ok := d.GetOk("virtual_border_router_name"); ok { + request["Name"] = v + } + request["VlanId"] = d.Get("vlan_id") + request["ClientToken"] = buildClientToken("CreateVirtualBorderRouter") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_express_connect_virtual_border_router", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["VbrId"])) + + return resourceAlicloudExpressConnectVirtualBorderRouterUpdate(d, meta) +} +func resourceAlicloudExpressConnectVirtualBorderRouterRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vpcService := VpcService{client} + object, err := vpcService.DescribeExpressConnectVirtualBorderRouter(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_express_connect_virtual_border_router vpcService.DescribeExpressConnectVirtualBorderRouter Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("circuit_code", object["CircuitCode"]) + d.Set("description", object["Description"]) + if v, ok := object["DetectMultiplier"]; ok && fmt.Sprint(v) != "0" { + d.Set("detect_multiplier", formatInt(v)) + } + d.Set("enable_ipv6", object["EnableIpv6"]) + d.Set("local_gateway_ip", object["LocalGatewayIp"]) + d.Set("local_ipv6_gateway_ip", object["LocalIpv6GatewayIp"]) + if v, ok := object["MinRxInterval"]; ok && fmt.Sprint(v) != "0" { + d.Set("min_rx_interval", formatInt(v)) + } + if v, ok := object["MinTxInterval"]; ok && fmt.Sprint(v) != "0" { + d.Set("min_tx_interval", formatInt(v)) + } + d.Set("peer_gateway_ip", object["PeerGatewayIp"]) + d.Set("peer_ipv6_gateway_ip", object["PeerIpv6GatewayIp"]) + d.Set("peering_ipv6_subnet_mask", object["PeeringIpv6SubnetMask"]) + d.Set("peering_subnet_mask", object["PeeringSubnetMask"]) + d.Set("physical_connection_id", object["PhysicalConnectionId"]) + d.Set("status", object["Status"]) + d.Set("virtual_border_router_name", object["Name"]) + if v, ok := object["VlanId"]; ok && fmt.Sprint(v) != "0" { + d.Set("vlan_id", formatInt(v)) + } + return nil +} +func resourceAlicloudExpressConnectVirtualBorderRouterUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vpcService := VpcService{client} + var response map[string]interface{} + d.Partial(true) + + update := false + request := map[string]interface{}{ + "VbrId": d.Id(), + } + request["RegionId"] = client.RegionId + if !d.IsNewResource() && d.HasChange("circuit_code") { + update = true + if v, ok := d.GetOk("circuit_code"); ok { + request["CircuitCode"] = v + } + } + if !d.IsNewResource() && d.HasChange("description") { + update = true + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + } + if d.HasChange("detect_multiplier") { + update = true + if v, ok := d.GetOk("detect_multiplier"); ok { + request["DetectMultiplier"] = v + } else if v, ok := d.GetOk("min_rx_interval"); ok && fmt.Sprint(v) != "" { + if v, ok := d.GetOk("min_tx_interval"); ok && fmt.Sprint(v) != "" { + return WrapError(fmt.Errorf("attribute '%s' is required when '%s' is %v and '%s' is %v ", "detect_multiplier", "min_rx_interval", d.Get("min_rx_interval"), "min_tx_interval", d.Get("min_tx_interval"))) + } + } + request["MinRxInterval"] = d.Get("min_rx_interval") + request["MinTxInterval"] = d.Get("min_tx_interval") + } + if !d.IsNewResource() && d.HasChange("enable_ipv6") { + update = true + if v, ok := d.GetOkExists("enable_ipv6"); ok { + request["EnableIpv6"] = v + } + } + if !d.IsNewResource() && d.HasChange("local_gateway_ip") { + update = true + request["LocalGatewayIp"] = d.Get("local_gateway_ip") + } + if !d.IsNewResource() && d.HasChange("local_ipv6_gateway_ip") { + update = true + if v, ok := d.GetOk("local_ipv6_gateway_ip"); ok { + request["LocalIpv6GatewayIp"] = v + } + } + if d.HasChange("min_rx_interval") { + update = true + if v, ok := d.GetOk("min_rx_interval"); ok { + request["MinRxInterval"] = v + } else if v, ok := d.GetOk("detect_multiplier"); ok && fmt.Sprint(v) != "" { + if v, ok := d.GetOk("min_tx_interval"); ok && fmt.Sprint(v) != "" { + return WrapError(fmt.Errorf("attribute '%s' is required when '%s' is %v and '%s' is %v ", "min_rx_interval", "detect_multiplier", d.Get("detect_multiplier"), "min_tx_interval", d.Get("min_tx_interval"))) + } + } + request["DetectMultiplier"] = d.Get("detect_multiplier") + request["MinTxInterval"] = d.Get("min_tx_interval") + } + if d.HasChange("min_tx_interval") { + update = true + if v, ok := d.GetOk("min_tx_interval"); ok { + request["MinTxInterval"] = v + } else if v, ok := d.GetOk("detect_multiplier"); ok && fmt.Sprint(v) != "" { + if v, ok := d.GetOk("min_rx_interval"); ok && fmt.Sprint(v) != "" { + return WrapError(fmt.Errorf("attribute '%s' is required when '%s' is %v and '%s' is %v ", "min_tx_interval", "detect_multiplier", d.Get("detect_multiplier"), "min_rx_interval", d.Get("min_rx_interval"))) + } + } + request["DetectMultiplier"] = d.Get("detect_multiplier") + request["MinRxInterval"] = d.Get("min_rx_interval") + } + if !d.IsNewResource() && d.HasChange("peer_gateway_ip") { + update = true + request["PeerGatewayIp"] = d.Get("peer_gateway_ip") + } + if !d.IsNewResource() && d.HasChange("peer_ipv6_gateway_ip") { + update = true + if v, ok := d.GetOk("peer_ipv6_gateway_ip"); ok { + request["PeerIpv6GatewayIp"] = v + } + } + if !d.IsNewResource() && d.HasChange("peering_ipv6_subnet_mask") { + update = true + if v, ok := d.GetOk("peering_ipv6_subnet_mask"); ok { + request["PeeringIpv6SubnetMask"] = v + } + } + if !d.IsNewResource() && d.HasChange("peering_subnet_mask") { + update = true + request["PeeringSubnetMask"] = d.Get("peering_subnet_mask") + } + if !d.IsNewResource() && d.HasChange("virtual_border_router_name") { + update = true + if v, ok := d.GetOk("virtual_border_router_name"); ok { + request["Name"] = v + } + } + if !d.IsNewResource() && d.HasChange("vlan_id") { + update = true + request["VlanId"] = d.Get("vlan_id") + } + if update { + if v, ok := d.GetOk("associated_physical_connections"); ok { + request["AssociatedPhysicalConnections"] = v + } + if v, ok := d.GetOk("bandwidth"); ok { + request["Bandwidth"] = v + } + action := "ModifyVirtualBorderRouterAttribute" + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("ModifyVirtualBorderRouterAttribute") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("circuit_code") + d.SetPartial("description") + d.SetPartial("detect_multiplier") + d.SetPartial("enable_ipv6") + d.SetPartial("local_gateway_ip") + d.SetPartial("local_ipv6_gateway_ip") + d.SetPartial("min_rx_interval") + d.SetPartial("min_tx_interval") + d.SetPartial("peer_gateway_ip") + d.SetPartial("peer_ipv6_gateway_ip") + d.SetPartial("peering_ipv6_subnet_mask") + d.SetPartial("peering_subnet_mask") + d.SetPartial("virtual_border_router_name") + d.SetPartial("vlan_id") + } + if d.HasChange("status") { + object, err := vpcService.DescribeExpressConnectVirtualBorderRouter(d.Id()) + if err != nil { + return WrapError(err) + } + target := d.Get("status").(string) + if object["Status"].(string) != target { + if target == "active" { + request := map[string]interface{}{ + "VbrId": d.Id(), + } + request["RegionId"] = client.RegionId + action := "RecoverVirtualBorderRouter" + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("RecoverVirtualBorderRouter") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"active"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, vpcService.ExpressConnectVirtualBorderRouterStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + if target == "terminated" { + request := map[string]interface{}{ + "VbrId": d.Id(), + } + request["RegionId"] = client.RegionId + action := "TerminateVirtualBorderRouter" + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("TerminateVirtualBorderRouter") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"terminated"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, vpcService.ExpressConnectVirtualBorderRouterStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + d.SetPartial("status") + } + } + d.Partial(false) + return resourceAlicloudExpressConnectVirtualBorderRouterRead(d, meta) +} +func resourceAlicloudExpressConnectVirtualBorderRouterDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteVirtualBorderRouter" + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "VbrId": d.Id(), + } + + request["RegionId"] = client.RegionId + request["ClientToken"] = buildClientToken("DeleteVirtualBorderRouter") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_fc_function_async_invoke_config.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_fc_function_async_invoke_config.go index 474e6331038..b1202126f9c 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_fc_function_async_invoke_config.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_fc_function_async_invoke_config.go @@ -331,7 +331,7 @@ func parseFCDestinationConfigId(id string) (serviceName string, functionName str return } - return "", "", "", fmt.Errorf("unexpected format of ID (%s), expected service_name:function_name or sevice_name:function_name:qualifier", id) + return "", "", "", fmt.Errorf("unexpected format of ID (%s), expected service_name:function_name or service_name:function_name:qualifier", id) } func flattenFCFunctionEventInvokeConfigDestinationConfig(destinationConfig *fc.DestinationConfig) []interface{} { diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_fc_trigger.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_fc_trigger.go index d9713f03bcb..6171dbb5a86 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_fc_trigger.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_fc_trigger.go @@ -83,7 +83,15 @@ func resourceAlicloudFCTrigger() *schema.Resource { return resolvedOld == resolvedNew } - return removeSpaceAndEnter(old) == removeSpaceAndEnter(new) + resolvedNew, err := resolveFcTriggerConfig(removeSpaceAndEnter(new)) + if err != nil { + panic(err) + } + resolvedOld, err := resolveFcTriggerConfig(removeSpaceAndEnter(old)) + if err != nil { + panic(err) + } + return resolvedNew == resolvedOld }, ValidateFunc: validation.ValidateJsonString, }, diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_fnf_execution.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_fnf_execution.go new file mode 100644 index 00000000000..049a9bf56a4 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_fnf_execution.go @@ -0,0 +1,180 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudFnFExecution() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudFnFExecutionCreate, + Read: resourceAlicloudFnFExecutionRead, + Update: resourceAlicloudFnFExecutionUpdate, + Delete: resourceAlicloudFnFExecutionDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(5 * time.Minute), + Update: schema.DefaultTimeout(5 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "execution_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "flow_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "input": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.ValidateJsonString, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + equal, _ := compareJsonTemplateAreEquivalent(old, new) + return equal + }, + }, + "status": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"Stopped"}, false), + }, + }, + } +} + +func resourceAlicloudFnFExecutionCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "StartExecution" + request := make(map[string]interface{}) + conn, err := client.NewFnfClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("execution_name"); ok { + request["ExecutionName"] = v + } + request["FlowName"] = d.Get("flow_name") + if v, ok := d.GetOk("input"); ok { + request["Input"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-03-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_fnf_execution", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["FlowName"], ":", request["ExecutionName"])) + fnfService := FnfService{client} + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, fnfService.FnFExecutionStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudFnFExecutionUpdate(d, meta) +} +func resourceAlicloudFnFExecutionRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + fnfService := FnfService{client} + object, err := fnfService.DescribeFnFExecution(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_fnf_execution fnfService.DescribeFnFExecution Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Set("execution_name", parts[1]) + d.Set("flow_name", parts[0]) + d.Set("input", object["Input"]) + d.Set("status", object["Status"]) + return nil +} +func resourceAlicloudFnFExecutionUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + fnfService := FnfService{client} + var response map[string]interface{} + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Partial(true) + + if d.HasChange("status") { + object, err := fnfService.DescribeFnFExecution(d.Id()) + if err != nil { + return WrapError(err) + } + target := d.Get("status").(string) + if object["Status"].(string) != target { + if target == "Stopped" { + request := map[string]interface{}{ + "ExecutionName": parts[1], + "FlowName": parts[0], + } + action := "StopExecution" + conn, err := client.NewFnfClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-03-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Stopped"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, fnfService.FnFExecutionStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + d.SetPartial("status") + } + } + d.Partial(false) + return resourceAlicloudFnFExecutionRead(d, meta) +} +func resourceAlicloudFnFExecutionDelete(d *schema.ResourceData, meta interface{}) error { + log.Printf("[WARN] Cannot destroy resourceAlicloudFnFExecution. Terraform will remove this resource from the state file, however resources may remain.") + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_forward_entry.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_forward_entry.go index feea591d712..b6c9e5213e1 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_forward_entry.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_forward_entry.go @@ -171,6 +171,10 @@ func resourceAlicloudForwardEntryUpdate(d *schema.ResourceData, meta interface{} client := meta.(*connectivity.AliyunClient) vpcService := VpcService{client} var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } if !strings.Contains(d.Id(), COLON_SEPARATED) { d.SetId(d.Get("forward_table_id").(string) + COLON_SEPARATED + d.Id()) } @@ -217,10 +221,6 @@ func resourceAlicloudForwardEntryUpdate(d *schema.ResourceData, meta interface{} request["PortBreak"] = d.Get("port_break") } action := "ModifyForwardEntry" - conn, err := client.NewVpcClient() - if err != nil { - return WrapError(err) - } wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ga_accelerator.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ga_accelerator.go index 3e0e61f0461..7007a4326ee 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ga_accelerator.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ga_accelerator.go @@ -7,6 +7,7 @@ import ( util "github.com/alibabacloud-go/tea-utils/service" "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" ) @@ -29,10 +30,13 @@ func resourceAlicloudGaAccelerator() *schema.Resource { Type: schema.TypeString, Optional: true, }, + "auto_renew_duration": { + Type: schema.TypeInt, + Optional: true, + }, "auto_use_coupon": { Type: schema.TypeBool, Optional: true, - Default: false, }, "description": { Type: schema.TypeString, @@ -41,9 +45,23 @@ func resourceAlicloudGaAccelerator() *schema.Resource { "duration": { Type: schema.TypeInt, Required: true, - ForceNew: true, ValidateFunc: validation.IntBetween(1, 9), }, + "pricing_cycle": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"Month", "Year"}, false), + }, + "renewal_status": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + string(RenewAutoRenewal), + string(RenewNormal), + string(RenewNotRenewal)}, false), + }, "spec": { Type: schema.TypeString, Required: true, @@ -67,13 +85,20 @@ func resourceAlicloudGaAcceleratorCreate(d *schema.ResourceData, meta interface{ if err != nil { return WrapError(err) } + // there is an api bug that the name can not effect + //if v, ok := d.GetOk("accelerator_name"); ok { + // request["Name"] = v + //} request["AutoPay"] = true if v, ok := d.GetOkExists("auto_use_coupon"); ok { request["AutoUseCoupon"] = v } - request["Duration"] = d.Get("duration") - request["PricingCycle"] = "Month" + if v, ok := d.GetOk("pricing_cycle"); ok { + request["PricingCycle"] = v + } else { + request["PricingCycle"] = "Month" + } request["RegionId"] = client.RegionId request["Spec"] = d.Get("spec") runtime := util.RuntimeOptions{} @@ -109,46 +134,97 @@ func resourceAlicloudGaAcceleratorRead(d *schema.ResourceData, meta interface{}) d.Set("description", object["Description"]) d.Set("spec", object["Spec"]) d.Set("status", object["State"]) - if val, ok := d.GetOk("auto_use_coupon"); ok { - d.Set("auto_use_coupon", val) + describeAcceleratorAutoRenewAttributeObject, err := gaService.DescribeAcceleratorAutoRenewAttribute(d.Id()) + if err != nil { + return WrapError(err) + } + if v, ok := describeAcceleratorAutoRenewAttributeObject["AutoRenewDuration"]; ok && fmt.Sprint(v) != "0" { + d.Set("auto_renew_duration", formatInt(v)) } + d.Set("renewal_status", describeAcceleratorAutoRenewAttributeObject["RenewalStatus"]) return nil } func resourceAlicloudGaAcceleratorUpdate(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) gaService := GaService{client} var response map[string]interface{} + d.Partial(true) + conn, err := client.NewGaplusClient() + if err != nil { + return WrapError(err) + } update := false request := map[string]interface{}{ "AcceleratorId": d.Id(), } + if d.HasChange("auto_renew_duration") { + update = true + } + if v, ok := d.GetOk("auto_renew_duration"); ok { + request["AutoRenewDuration"] = v + } + request["RegionId"] = client.RegionId + if d.HasChange("renewal_status") { + update = true + } + if v, ok := d.GetOk("renewal_status"); ok { + request["RenewalStatus"] = v + } + if update { + action := "UpdateAcceleratorAutoRenewAttribute" + request["ClientToken"] = buildClientToken("UpdateAcceleratorAutoRenewAttribute") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("auto_renew_duration") + d.SetPartial("renewal_status") + } + update = false + updateAcceleratorReq := map[string]interface{}{ + "AcceleratorId": d.Id(), + } if d.HasChange("accelerator_name") { update = true - request["Name"] = d.Get("accelerator_name") + if v, ok := d.GetOk("accelerator_name"); ok { + updateAcceleratorReq["Name"] = v + } } - request["AutoPay"] = true + updateAcceleratorReq["AutoPay"] = true if d.HasChange("description") { update = true - request["Description"] = d.Get("description") + if v, ok := d.GetOk("description"); ok { + updateAcceleratorReq["Description"] = v + } } - request["RegionId"] = client.RegionId + updateAcceleratorReq["RegionId"] = client.RegionId if !d.IsNewResource() && d.HasChange("spec") { update = true - request["Spec"] = d.Get("spec") + updateAcceleratorReq["Spec"] = d.Get("spec") } if update { - if _, ok := d.GetOkExists("auto_use_coupon"); ok { - request["AutoUseCoupon"] = d.Get("auto_use_coupon") + if v, ok := d.GetOkExists("auto_use_coupon"); ok { + updateAcceleratorReq["AutoUseCoupon"] = v } action := "UpdateAccelerator" - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) request["ClientToken"] = buildClientToken("UpdateAccelerator") - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, updateAcceleratorReq, &runtime) addDebug(action, response, request) if err != nil { return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) @@ -157,7 +233,11 @@ func resourceAlicloudGaAcceleratorUpdate(d *schema.ResourceData, meta interface{ if _, err := stateConf.WaitForState(); err != nil { return WrapErrorf(err, IdMsg, d.Id()) } + d.SetPartial("accelerator_name") + d.SetPartial("description") + d.SetPartial("spec") } + d.Partial(false) return resourceAlicloudGaAcceleratorRead(d, meta) } func resourceAlicloudGaAcceleratorDelete(d *schema.ResourceData, meta interface{}) error { diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ga_acl.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ga_acl.go new file mode 100644 index 00000000000..91aa2d81e5d --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ga_acl.go @@ -0,0 +1,344 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudGaAcl() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudGaAclCreate, + Read: resourceAlicloudGaAclRead, + Update: resourceAlicloudGaAclUpdate, + Delete: resourceAlicloudGaAclDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(5 * time.Minute), + Delete: schema.DefaultTimeout(5 * time.Minute), + Update: schema.DefaultTimeout(5 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "acl_entries": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "entry": { + Type: schema.TypeString, + Optional: true, + }, + "entry_description": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[A-Za-z0-9._/-]{1,256}$`), "The description of the IP entry. The description must be 1 to 256 characters in length, and can contain letters, digits, hyphens (-), forward slashes (/), periods (.),and underscores (_)."), + }, + }, + }, + }, + "acl_name": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-zA-Z][A-Za-z0-9._-]{2,128}$`), "The name must be `2` to `128` characters in length, and can contain letters, digits, periods (.), hyphens (-) and underscores (_). It must start with a letter."), + }, + "address_ip_version": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"IPv4", "IPv6"}, false), + }, + "dry_run": { + Type: schema.TypeBool, + Optional: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudGaAclCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateAcl" + request := make(map[string]interface{}) + conn, err := client.NewGaplusClient() + if err != nil { + return WrapError(err) + } + if m, ok := d.GetOk("acl_entries"); ok { + for k, aclEntries := range m.(*schema.Set).List() { + aclEntriesArg := aclEntries.(map[string]interface{}) + request[fmt.Sprintf("AclEntries.%d.Entry", k+1)] = aclEntriesArg["entry"].(string) + request[fmt.Sprintf("AclEntries.%d.EntryDescription", k+1)] = aclEntriesArg["entry_description"].(string) + } + } + if v, ok := d.GetOk("acl_name"); ok { + request["AclName"] = v + } + request["AddressIPVersion"] = d.Get("address_ip_version") + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + request["RegionId"] = client.RegionId + request["ClientToken"] = buildClientToken("CreateAcl") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_ga_acl", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["AclId"])) + gaService := GaService{client} + stateConf := BuildStateConf([]string{}, []string{"active"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, gaService.GaAclStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudGaAclRead(d, meta) +} +func resourceAlicloudGaAclRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + gaService := GaService{client} + object, err := gaService.DescribeGaAcl(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_ga_acl gaService.DescribeGaAcl Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + if v, ok := object["AclEntries"].([]interface{}); ok { + aclEntries := make([]map[string]interface{}, 0) + for _, val := range v { + item := val.(map[string]interface{}) + temp := map[string]interface{}{ + "entry": item["Entry"], + "entry_description": item["EntryDescription"], + } + aclEntries = append(aclEntries, temp) + } + if err := d.Set("acl_entries", aclEntries); err != nil { + return WrapError(err) + } + } + + d.Set("acl_name", object["AclName"]) + d.Set("address_ip_version", object["AddressIPVersion"]) + d.Set("status", object["AclStatus"]) + return nil +} +func resourceAlicloudGaAclUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + gaService := GaService{client} + var response map[string]interface{} + d.Partial(true) + + update := false + request := map[string]interface{}{ + "AclId": d.Id(), + } + if d.HasChange("acl_name") { + update = true + } + if v, ok := d.GetOk("acl_name"); ok { + request["AclName"] = v + } + request["RegionId"] = client.RegionId + if update { + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + action := "UpdateAclAttribute" + conn, err := client.NewGaplusClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("UpdateAclAttribute") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 20*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if IsExpectedErrors(err, []string{"StateError.Acl"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("acl_name") + } + + if d.HasChange("acl_entries") { + oraw, nraw := d.GetChange("acl_entries") + remove := oraw.(*schema.Set).Difference(nraw.(*schema.Set)).List() + create := nraw.(*schema.Set).Difference(oraw.(*schema.Set)).List() + + if len(remove) > 0 { + removeEntriesFromAclReq := map[string]interface{}{ + "AclId": d.Id(), + } + for k, aclEntries := range remove { + aclEntriesArg := aclEntries.(map[string]interface{}) + removeEntriesFromAclReq[fmt.Sprintf("AclEntries.%d.Entry", k+1)] = aclEntriesArg["entry"].(string) + } + removeEntriesFromAclReq["RegionId"] = client.RegionId + + if v, ok := d.GetOkExists("dry_run"); ok { + removeEntriesFromAclReq["DryRun"] = v + } + action := "RemoveEntriesFromAcl" + conn, err := client.NewGaplusClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("RemoveEntriesFromAcl") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 20*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, removeEntriesFromAclReq, &runtime) + if err != nil { + if IsExpectedErrors(err, []string{"StateError.Acl"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, removeEntriesFromAclReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"active"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, gaService.GaAclStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + + if len(create) > 0 { + addEntriesToAclReq := map[string]interface{}{ + "AclId": d.Id(), + } + for k, aclEntries := range create { + aclEntriesArg := aclEntries.(map[string]interface{}) + addEntriesToAclReq[fmt.Sprintf("AclEntries.%d.Entry", k+1)] = aclEntriesArg["entry"].(string) + addEntriesToAclReq[fmt.Sprintf("AclEntries.%d.EntryDescription", k+1)] = aclEntriesArg["entry_description"].(string) + } + addEntriesToAclReq["RegionId"] = client.RegionId + if v, ok := d.GetOkExists("dry_run"); ok { + addEntriesToAclReq["DryRun"] = v + } + action := "AddEntriesToAcl" + conn, err := client.NewGaplusClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("AddEntriesToAcl") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 20*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, addEntriesToAclReq, &runtime) + if err != nil { + if IsExpectedErrors(err, []string{"StateError.Acl"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, addEntriesToAclReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"active"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, gaService.GaAclStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + + d.SetPartial("acl_entries") + } + + d.Partial(false) + return resourceAlicloudGaAclRead(d, meta) +} +func resourceAlicloudGaAclDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + gaService := GaService{client} + action := "DeleteAcl" + var response map[string]interface{} + conn, err := client.NewGaplusClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "AclId": d.Id(), + } + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + request["RegionId"] = client.RegionId + request["ClientToken"] = buildClientToken("DeleteAcl") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 20*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if IsExpectedErrors(err, []string{"StateError.Acl"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"NotExist.Acl"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{}, d.Timeout(schema.TimeoutDelete), 5*time.Second, gaService.GaAclStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ga_acl_attachment.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ga_acl_attachment.go new file mode 100644 index 00000000000..6b877f0d6b3 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ga_acl_attachment.go @@ -0,0 +1,174 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudGaAclAttachment() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudGaAclAttachmentCreate, + Read: resourceAlicloudGaAclAttachmentRead, + Update: resourceAlicloudGaAclAttachmentUpdate, + Delete: resourceAlicloudGaAclAttachmentDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(5 * time.Minute), + Delete: schema.DefaultTimeout(5 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "acl_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "acl_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"black", "white"}, false), + }, + "dry_run": { + Type: schema.TypeBool, + Optional: true, + }, + "listener_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudGaAclAttachmentCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "AssociateAclsWithListener" + request := make(map[string]interface{}) + conn, err := client.NewGaplusClient() + if err != nil { + return WrapError(err) + } + request["AclIds.1"] = d.Get("acl_id") + request["AclType"] = d.Get("acl_type") + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + request["ListenerId"] = d.Get("listener_id") + request["RegionId"] = client.RegionId + request["ClientToken"] = buildClientToken("AssociateAclsWithListener") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_ga_acl_attachment", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["ListenerId"], ":", d.Get("acl_id"))) + gaService := GaService{client} + stateConf := BuildStateConf([]string{}, []string{"Associated"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, gaService.GaAclAttachmentStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudGaAclAttachmentRead(d, meta) +} +func resourceAlicloudGaAclAttachmentRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + gaService := GaService{client} + object, err := gaService.DescribeGaAclAttachment(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_ga_acl_attachment gaService.DescribeGaAclAttachment Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Set("acl_id", parts[1]) + d.Set("listener_id", parts[0]) + d.Set("acl_type", object["AclType"]) + d.Set("status", object["Status"]) + return nil +} +func resourceAlicloudGaAclAttachmentUpdate(d *schema.ResourceData, meta interface{}) error { + log.Println(fmt.Sprintf("[WARNING] The resouce has not update operation.")) + return resourceAlicloudGaAclAttachmentRead(d, meta) +} +func resourceAlicloudGaAclAttachmentDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + gaService := GaService{client} + action := "DissociateAclsFromListener" + var response map[string]interface{} + conn, err := client.NewGaplusClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "ListenerId": parts[0], + } + + request["AclIds.1"] = parts[1] + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + request["RegionId"] = client.RegionId + request["ClientToken"] = buildClientToken("DissociateAclsFromListener") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{}, d.Timeout(schema.TimeoutDelete), 5*time.Second, gaService.GaAclAttachmentStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ga_additional_certificate.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ga_additional_certificate.go new file mode 100644 index 00000000000..65d85ee8efd --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ga_additional_certificate.go @@ -0,0 +1,145 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudGaAdditionalCertificate() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudGaAdditionalCertificateCreate, + Read: resourceAlicloudGaAdditionalCertificateRead, + Delete: resourceAlicloudGaAdditionalCertificateDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "accelerator_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "certificate_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "domain": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "listener_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudGaAdditionalCertificateCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "AssociateAdditionalCertificatesWithListener" + request := make(map[string]interface{}) + conn, err := client.NewGaplusClient() + if err != nil { + return WrapError(err) + } + request["AcceleratorId"] = d.Get("accelerator_id") + request["Certificates.1.Domain"] = d.Get("domain") + request["Certificates.1.Id"] = d.Get("certificate_id") + request["ListenerId"] = d.Get("listener_id") + request["RegionId"] = client.RegionId + request["ClientToken"] = buildClientToken("AssociateAdditionalCertificatesWithListener") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_ga_additional_certificate", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["AcceleratorId"], ":", request["ListenerId"], ":", request["Certificates.1.Domain"])) + return resourceAlicloudGaAdditionalCertificateRead(d, meta) +} +func resourceAlicloudGaAdditionalCertificateRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + gaService := GaService{client} + object, err := gaService.DescribeGaAdditionalCertificate(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_ga_additional_certificate gaService.DescribeGaAdditionalCertificate Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + d.Set("accelerator_id", parts[0]) + d.Set("domain", parts[2]) + d.Set("listener_id", parts[1]) + d.Set("certificate_id", object["CertificateId"]) + return nil +} +func resourceAlicloudGaAdditionalCertificateDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + action := "DissociateAdditionalCertificatesFromListener" + var response map[string]interface{} + conn, err := client.NewGaplusClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "AcceleratorId": parts[0], + "ListenerId": parts[1], + } + + request["Domains.1"] = parts[2] + request["RegionId"] = client.RegionId + request["ClientToken"] = buildClientToken("DissociateAdditionalCertificatesFromListener") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ga_bandwidth_package.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ga_bandwidth_package.go index 00b7d1e8c0e..f48880e9bea 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ga_bandwidth_package.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ga_bandwidth_package.go @@ -82,7 +82,6 @@ func resourceAlicloudGaBandwidthPackage() *schema.Resource { "duration": { Type: schema.TypeString, Optional: true, - ForceNew: true, }, "payment_type": { Type: schema.TypeString, @@ -246,7 +245,7 @@ func resourceAlicloudGaBandwidthPackageUpdate(d *schema.ResourceData, meta inter err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) if err != nil { - if IsExpectedErrors(err, []string{"NotExist.BandwidthPackage", "StateError.BandwidthPackage", "UpgradeError.BandwidthPackage"}) || NeedRetry(err) { + if IsExpectedErrors(err, []string{"NotExist.BandwidthPackage", "StateError.BandwidthPackage", "UpgradeError.BandwidthPackage", "GreaterThanGa.IpSetBandwidth"}) || NeedRetry(err) { wait() return resource.RetryableError(err) } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ga_bandwidth_package_attachment.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ga_bandwidth_package_attachment.go index f738be81dc5..2da3b87fd8f 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ga_bandwidth_package_attachment.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ga_bandwidth_package_attachment.go @@ -149,7 +149,7 @@ func resourceAlicloudGaBandwidthPackageAttachmentDelete(d *schema.ResourceData, return nil }) if err != nil { - if IsExpectedErrors(err, []string{"NotExist.BandwidthPackage"}) { + if IsExpectedErrors(err, []string{"NotExist.BandwidthPackage", "Exist.EndpointGroup"}) { return nil } return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ga_ip_set.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ga_ip_set.go index 523bda09eac..939a9359649 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ga_ip_set.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ga_ip_set.go @@ -161,7 +161,7 @@ func resourceAlicloudGaIpSetUpdate(d *schema.ResourceData, meta interface{}) err request["ClientToken"] = buildClientToken("UpdateIpSet") response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) if err != nil { - if IsExpectedErrors(err, []string{"StateError.Accelerator", "StateError.IpSet"}) { + if IsExpectedErrors(err, []string{"StateError.Accelerator", "StateError.IpSet", "GreaterThanGa.IpSetBandwidth"}) { wait() return resource.RetryableError(err) } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_gpdb_account.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_gpdb_account.go new file mode 100644 index 00000000000..6fbca7e16cd --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_gpdb_account.go @@ -0,0 +1,186 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudGpdbAccount() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudGpdbAccountCreate, + Read: resourceAlicloudGpdbAccountRead, + Update: resourceAlicloudGpdbAccountUpdate, + Delete: resourceAlicloudGpdbAccountDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(5 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "account_description": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[A-Za-z][\w\\_]{2,255}$`), "The description of the account. The description must be 2 to 256 characters in length and can contain letters, digits, underscores (_)."), + }, + "account_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-z][a-z0-9_]{1,14}[a-z0-9]$`), "The name of the account. The name must be 2 to 16 characters in length and can contain lower letters, digits, underscores (_)."), + }, + "account_password": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringLenBetween(8, 32), + }, + "db_instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudGpdbAccountCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateAccount" + request := make(map[string]interface{}) + conn, err := client.NewGpdbClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("account_description"); ok { + request["AccountDescription"] = v + } + request["AccountName"] = d.Get("account_name") + request["DBInstanceId"] = d.Get("db_instance_id") + request["AccountPassword"] = d.Get("account_password") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-05-03"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_gpdb_account", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["DBInstanceId"], ":", request["AccountName"])) + gpdbService := GpdbService{client} + stateConf := BuildStateConf([]string{}, []string{"1"}, d.Timeout(schema.TimeoutCreate), 60*time.Second, gpdbService.GpdbAccountStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudGpdbAccountRead(d, meta) +} +func resourceAlicloudGpdbAccountRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + gpdbService := GpdbService{client} + object, err := gpdbService.DescribeGpdbAccount(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_gpdb_account gpdbService.DescribeGpdbAccount Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Set("account_name", parts[1]) + d.Set("db_instance_id", parts[0]) + d.Set("account_description", object["AccountDescription"]) + d.Set("status", convertGpdbAccountStatusResponse(object["AccountStatus"])) + return nil +} +func resourceAlicloudGpdbAccountUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + + request := map[string]interface{}{ + "AccountName": parts[1], + "DBInstanceId": parts[0], + } + + update := false + if d.HasChange("account_password") { + update = true + if v, ok := d.GetOk("account_password"); ok { + request["AccountPassword"] = v + } + } + + if update { + action := "ResetAccountPassword" + conn, err := client.NewGpdbClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-05-03"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + + return resourceAlicloudGpdbAccountRead(d, meta) +} +func resourceAlicloudGpdbAccountDelete(d *schema.ResourceData, meta interface{}) error { + log.Printf("[WARN] Cannot destroy resourceAlicloudGpdbAccount. Terraform will remove this resource from the state file, however resources may remain.") + return nil +} +func convertGpdbAccountStatusResponse(source interface{}) interface{} { + switch source { + case "Creating": + return "0" + case "Active": + return "1" + case "Deleting": + return "3" + } + return source +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_gpdb_elastic_instance.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_gpdb_elastic_instance.go index 5e4676d2332..4bf0b8b7548 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_gpdb_elastic_instance.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_gpdb_elastic_instance.go @@ -222,14 +222,20 @@ func resourceAlicloudGpdbElasticInstanceRead(d *schema.ResourceData, meta interf d.Set("seg_storage_type", instance["StorageType"]) d.Set("seg_node_num", instance["SegNodeNum"]) d.Set("storage_size", instance["StorageSize"]) - d.Set("payment_type", convertGpdbInstancePaymentTypeResponse(instance["PayType"].(string))) - d.Set("instance_spec", convertDBInstanceClassToInstanceSpec(instance["DBInstanceClass"].(string))) d.Set("status", instance["DBInstanceStatus"]) d.Set("db_instance_description", instance["DBInstanceDescription"]) d.Set("instance_network_type", instance["InstanceNetworkType"]) d.Set("vswitch_id", instance["VSwitchId"]) d.Set("zone_id", instance["ZoneId"]) d.Set("connection_string", instance["ConnectionString"]) + + if v, exist := instance["DBInstanceClass"]; exist { + d.Set("instance_spec", convertDBInstanceClassToInstanceSpec(v.(string))) + } + if v, exist := instance["PayType"]; exist { + d.Set("payment_type", convertGpdbInstancePaymentTypeResponse(v.(string))) + } + securityIps, err := gpdbService.DescribeGpdbSecurityIps(d.Id()) if err != nil { return WrapError(err) diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_graph_database_db_instance.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_graph_database_db_instance.go new file mode 100644 index 00000000000..f7a3599b6c9 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_graph_database_db_instance.go @@ -0,0 +1,425 @@ +package alicloud + +import ( + "fmt" + "log" + "strings" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudGraphDatabaseDbInstance() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudGraphDatabaseDbInstanceCreate, + Read: resourceAlicloudGraphDatabaseDbInstanceRead, + Update: resourceAlicloudGraphDatabaseDbInstanceUpdate, + Delete: resourceAlicloudGraphDatabaseDbInstanceDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(30 * time.Minute), + Delete: schema.DefaultTimeout(1 * time.Minute), + Update: schema.DefaultTimeout(60 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "db_instance_ip_array": { + Type: schema.TypeSet, + Optional: true, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "db_instance_ip_array_attribute": { + Type: schema.TypeString, + Optional: true, + }, + "db_instance_ip_array_name": { + Type: schema.TypeString, + Optional: true, + }, + "security_ips": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "db_instance_category": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"HA"}, false), + }, + "db_instance_description": { + Type: schema.TypeString, + Optional: true, + }, + "db_instance_network_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"vpc"}, false), + }, + "db_instance_storage_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"cloud_essd", "cloud_ssd"}, false), + }, + "db_node_class": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"gdb.r.xlarge", "gdb.r.2xlarge", "gdb.r.4xlarge", "gdb.r.8xlarge", "gdb.r.16xlarge"}, false), + }, + "db_node_storage": { + Type: schema.TypeInt, + Required: true, + ValidateFunc: validation.IntBetween(20, 32000), + }, + "db_version": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"1.0", "1.0-OpenCypher"}, false), + }, + "payment_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"PayAsYouGo"}, false), + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "vswitch_id": { + Type: schema.TypeString, + Computed: true, + }, + "zone_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudGraphDatabaseDbInstanceCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateDBInstance" + request := make(map[string]interface{}) + conn, err := client.NewGdsClient() + if err != nil { + return WrapError(err) + } + request["DBInstanceCategory"] = strings.ToLower(d.Get("db_instance_category").(string)) + if v, ok := d.GetOk("db_instance_description"); ok { + request["DBInstanceDescription"] = v + } + request["DBInstanceNetworkType"] = d.Get("db_instance_network_type") + request["DBNodeStorageType"] = d.Get("db_instance_storage_type") + request["DBInstanceClass"] = d.Get("db_node_class") + request["DBNodeStorage"] = d.Get("db_node_storage") + request["DBInstanceVersion"] = d.Get("db_version") + request["PayType"] = convertGraphDatabaseDbInstancePaymentTypeRequest(d.Get("payment_type").(string)) + request["RegionId"] = client.RegionId + request["ClientToken"] = buildClientToken("CreateDBInstance") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-03"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_graph_database_db_instance", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["DBInstanceId"])) + gdbService := GdbService{client} + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, gdbService.GraphDatabaseDbInstanceStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudGraphDatabaseDbInstanceUpdate(d, meta) +} +func resourceAlicloudGraphDatabaseDbInstanceRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + gdbService := GdbService{client} + object, err := gdbService.DescribeGraphDatabaseDbInstance(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_graph_database_db_instance gdbService.DescribeGraphDatabaseDbInstance Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("db_instance_category", object["Category"]) + d.Set("db_instance_description", object["DBInstanceDescription"]) + d.Set("db_instance_network_type", object["DBInstanceNetworkType"]) + d.Set("db_instance_storage_type", object["DBInstanceStorageType"]) + d.Set("db_node_class", object["DBNodeClass"]) + d.Set("db_node_storage", formatInt(object["DBNodeStorage"])) + d.Set("db_version", object["DBVersion"]) + d.Set("payment_type", convertGraphDatabaseDbInstancePaymentTypeResponse(object["PayType"])) + d.Set("status", object["DBInstanceStatus"]) + d.Set("vswitch_id", object["VSwitchId"]) + d.Set("zone_id", object["ZoneId"]) + if DBInstanceIPArray, ok := object["DBInstanceIPArray"]; ok { + DBInstanceIPArrayAry, ok := DBInstanceIPArray.([]interface{}) + if ok && len(DBInstanceIPArrayAry) > 0 { + DBInstanceIPArraySli := make([]map[string]interface{}, 0) + for _, DBInstanceIPArrayArg := range DBInstanceIPArrayAry { + DBInstanceIPArrayMap := make(map[string]interface{}) + DBInstanceIPArrayMap["security_ips"] = DBInstanceIPArrayArg.(map[string]interface{})["SecurityIps"] + DBInstanceIPArrayMap["db_instance_ip_array_name"] = DBInstanceIPArrayArg.(map[string]interface{})["DBInstanceIPArrayName"] + if v, ok := DBInstanceIPArrayArg.(map[string]interface{})["DBInstanceIPArrayAttribute"]; ok { + DBInstanceIPArrayMap["db_instance_ip_array_attribute"] = v + } + DBInstanceIPArraySli = append(DBInstanceIPArraySli, DBInstanceIPArrayMap) + } + d.Set("db_instance_ip_array", DBInstanceIPArraySli) + } + } + return nil +} +func resourceAlicloudGraphDatabaseDbInstanceUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + gdbService := GdbService{client} + var response map[string]interface{} + d.Partial(true) + + update := false + request := map[string]interface{}{ + "DBInstanceId": d.Id(), + } + if !d.IsNewResource() && d.HasChange("db_instance_description") { + update = true + } + if v, ok := d.GetOk("db_instance_description"); ok { + request["DBInstanceDescription"] = v + } + if update { + action := "ModifyDBInstanceDescription" + conn, err := client.NewGdsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-03"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, gdbService.GraphDatabaseDbInstanceStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + d.SetPartial("db_instance_description") + } + update = false + modifyDBInstanceAccessWhiteListReq := map[string]interface{}{ + "DBInstanceId": d.Id(), + } + if d.HasChange("db_instance_ip_array") { + oraw, nraw := d.GetChange("db_instance_ip_array") + o := oraw.(*schema.Set) + n := nraw.(*schema.Set) + remove := o.Difference(n).List() + create := n.Difference(o).List() + + if len(remove) > 0 { + for _, dBInstanceIPArray := range remove { + dBInstanceIPArrayArg := dBInstanceIPArray.(map[string]interface{}) + + action := "ModifyDBInstanceAccessWhiteList" + conn, err := client.NewGdsClient() + if err != nil { + return WrapError(err) + } + if v, ok := dBInstanceIPArrayArg["db_instance_ip_array_name"]; !ok || v.(string) == "default" { + continue + } + modifyDBInstanceAccessWhiteListReq["DBInstanceIPArrayName"] = dBInstanceIPArrayArg["db_instance_ip_array_name"] + modifyDBInstanceAccessWhiteListReq["SecurityIps"] = "Empty" + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-03"), StringPointer("AK"), nil, modifyDBInstanceAccessWhiteListReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, modifyDBInstanceAccessWhiteListReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + } + + if len(create) > 0 { + for _, dBInstanceIPArray := range create { + dBInstanceIPArrayArg := dBInstanceIPArray.(map[string]interface{}) + + action := "ModifyDBInstanceAccessWhiteList" + conn, err := client.NewGdsClient() + if err != nil { + return WrapError(err) + } + modifyDBInstanceAccessWhiteListReq["DBInstanceIPArrayAttribute"] = dBInstanceIPArrayArg["db_instance_ip_array_attribute"] + modifyDBInstanceAccessWhiteListReq["DBInstanceIPArrayName"] = dBInstanceIPArrayArg["db_instance_ip_array_name"] + modifyDBInstanceAccessWhiteListReq["SecurityIps"] = dBInstanceIPArrayArg["security_ips"] + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-03"), StringPointer("AK"), nil, modifyDBInstanceAccessWhiteListReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, modifyDBInstanceAccessWhiteListReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + } + + d.SetPartial("db_instance_ip_array") + } + + modifyDBInstanceSpecReq := map[string]interface{}{ + "DBInstanceId": d.Id(), + } + + modifyDBInstanceSpecReq["DBInstanceClass"] = d.Get("db_node_class") + if !d.IsNewResource() && d.HasChange("db_node_class") { + update = true + } + modifyDBInstanceSpecReq["DBInstanceStorage"] = d.Get("db_node_storage") + if !d.IsNewResource() && d.HasChange("db_node_storage") { + update = true + } + modifyDBInstanceSpecReq["RegionId"] = client.RegionId + if update { + modifyDBInstanceSpecReq["DBInstanceStorageType"] = d.Get("db_instance_storage_type") + action := "ModifyDBInstanceSpec" + conn, err := client.NewGdsClient() + if err != nil { + return WrapError(err) + } + modifyDBInstanceSpecReq["ClientToken"] = buildClientToken("ModifyDBInstanceSpec") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-03"), StringPointer("AK"), nil, modifyDBInstanceSpecReq, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, modifyDBInstanceSpecReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, gdbService.GraphDatabaseDbInstanceStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + d.SetPartial("db_instance_storage_type") + d.SetPartial("db_node_class") + d.SetPartial("db_node_storage") + } + d.Partial(false) + return resourceAlicloudGraphDatabaseDbInstanceRead(d, meta) +} +func resourceAlicloudGraphDatabaseDbInstanceDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + gdbService := GdbService{client} + action := "DeleteDBInstance" + var response map[string]interface{} + conn, err := client.NewGdsClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "DBInstanceId": d.Id(), + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-03"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidDBInstance.NotFound"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{}, d.Timeout(schema.TimeoutDelete), 5*time.Second, gdbService.GraphDatabaseDbInstanceStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return nil +} +func convertGraphDatabaseDbInstancePaymentTypeRequest(source interface{}) interface{} { + switch source { + case "PayAsYouGo": + return "Postpaid" + } + return source +} +func convertGraphDatabaseDbInstancePaymentTypeResponse(source interface{}) interface{} { + switch source { + case "Postpaid": + return "PayAsYouGo" + } + return source +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_havip.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_havip.go index b8d48c6773a..cb06a17b5cd 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_havip.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_havip.go @@ -125,6 +125,10 @@ func resourceAlicloudHavipRead(d *schema.ResourceData, meta interface{}) error { func resourceAlicloudHavipUpdate(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } update := false request := map[string]interface{}{ "HaVipId": d.Id(), @@ -140,10 +144,6 @@ func resourceAlicloudHavipUpdate(d *schema.ResourceData, meta interface{}) error } if update { action := "ModifyHaVipAttribute" - conn, err := client.NewVpcClient() - if err != nil { - return WrapError(err) - } wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_hbr_ecs_backup_client.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_hbr_ecs_backup_client.go index eff088a15ad..928f96fdf2f 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_hbr_ecs_backup_client.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_hbr_ecs_backup_client.go @@ -22,9 +22,14 @@ func resourceAlicloudHbrEcsBackupClient() *schema.Resource { State: schema.ImportStatePassthrough, }, Timeouts: &schema.ResourceTimeout{ - Create: schema.DefaultTimeout(1 * time.Minute), + Create: schema.DefaultTimeout(5 * time.Minute), }, Schema: map[string]*schema.Schema{ + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, "data_network_type": { Type: schema.TypeString, Optional: true, @@ -37,11 +42,6 @@ func resourceAlicloudHbrEcsBackupClient() *schema.Resource { Computed: true, ValidateFunc: validation.StringInSlice([]string{"CUSTOM", "DISABLE", "USE_CONTROL_PROXY"}, false), }, - "instance_id": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, "max_cpu_core": { Type: schema.TypeString, Optional: true, diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_hbr_ecs_backup_plan.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_hbr_ecs_backup_plan.go index d2f651f65c4..fab867f7196 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_hbr_ecs_backup_plan.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_hbr_ecs_backup_plan.go @@ -23,13 +23,39 @@ func resourceAlicloudHbrEcsBackupPlan() *schema.Resource { State: schema.ImportStatePassthrough, }, Schema: map[string]*schema.Schema{ + "ecs_backup_plan_name": { + Type: schema.TypeString, + Required: true, + }, + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "vault_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, "backup_type": { Type: schema.TypeString, - Optional: true, - Computed: true, + Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{"COMPLETE"}, false), }, + "retention": { + Type: schema.TypeString, + Required: true, + }, + "schedule": { + Type: schema.TypeString, + Required: true, + }, + "path": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, "disabled": { Type: schema.TypeBool, Computed: true, @@ -39,10 +65,6 @@ func resourceAlicloudHbrEcsBackupPlan() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "ecs_backup_plan_name": { - Type: schema.TypeString, - Required: true, - }, "exclude": { Type: schema.TypeString, Optional: true, @@ -51,40 +73,18 @@ func resourceAlicloudHbrEcsBackupPlan() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "instance_id": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, "options": { Type: schema.TypeString, Optional: true, }, - "path": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "retention": { - Type: schema.TypeString, - Required: true, - }, - "schedule": { - Type: schema.TypeString, - Required: true, - }, "speed_limit": { Type: schema.TypeString, Optional: true, }, "update_paths": { - Type: schema.TypeBool, - Optional: true, - }, - "vault_id": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, + Type: schema.TypeBool, + Optional: true, + Deprecated: "Attribute update_paths has been deprecated in v1.139.0+ and you do not need to set it anymore.", }, }, } @@ -227,14 +227,11 @@ func resourceAlicloudHbrEcsBackupPlanUpdate(d *schema.ResourceData, meta interfa } if d.HasChange("path") { update = true + request["UpdatePaths"] = true if v, ok := d.GetOk("path"); ok { request["Path"] = v - request["UpdatePaths"] = true } } - if v, ok := d.GetOkExists("update_paths"); ok { - request["UpdatePaths"] = v - } if !d.IsNewResource() && d.HasChange("retention") { update = true } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_hbr_nas_backup_plan.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_hbr_nas_backup_plan.go index abd8df59040..5e103fc7df8 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_hbr_nas_backup_plan.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_hbr_nas_backup_plan.go @@ -26,8 +26,7 @@ func resourceAlicloudHbrNasBackupPlan() *schema.Resource { Schema: map[string]*schema.Schema{ "backup_type": { Type: schema.TypeString, - Optional: true, - Computed: true, + Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{"COMPLETE"}, false), }, @@ -37,27 +36,16 @@ func resourceAlicloudHbrNasBackupPlan() *schema.Resource { Optional: true, }, "create_time": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, - "detail": { - Type: schema.TypeString, - Optional: true, - }, - "exclude": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Computed: true, + Deprecated: "Field 'create_time' has been deprecated from provider version 1.153.0.", }, "file_system_id": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, - "include": { - Type: schema.TypeString, - Optional: true, - }, "nas_backup_plan_name": { Type: schema.TypeString, Required: true, @@ -68,7 +56,7 @@ func resourceAlicloudHbrNasBackupPlan() *schema.Resource { }, "path": { Type: schema.TypeList, - Optional: true, + Required: true, Elem: &schema.Schema{Type: schema.TypeString}, }, "retention": { @@ -79,17 +67,9 @@ func resourceAlicloudHbrNasBackupPlan() *schema.Resource { Type: schema.TypeString, Required: true, }, - "speed_limit": { - Type: schema.TypeString, - Optional: true, - }, - "update_paths": { - Type: schema.TypeBool, - Optional: true, - }, "vault_id": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, }, @@ -109,18 +89,9 @@ func resourceAlicloudHbrNasBackupPlanCreate(d *schema.ResourceData, meta interfa if v, ok := d.GetOk("create_time"); ok { request["CreateTime"] = ConvertNasFileSystemStringToUnix(v.(string)) } - if v, ok := d.GetOk("detail"); ok { - request["Detail"] = v - } - if v, ok := d.GetOk("exclude"); ok { - request["Exclude"] = v - } if v, ok := d.GetOk("file_system_id"); ok { request["FileSystemId"] = v } - if v, ok := d.GetOk("include"); ok { - request["Include"] = v - } request["PlanName"] = d.Get("nas_backup_plan_name") if v, ok := d.GetOk("options"); ok { request["Options"] = v @@ -130,9 +101,6 @@ func resourceAlicloudHbrNasBackupPlanCreate(d *schema.ResourceData, meta interfa } request["Schedule"] = d.Get("schedule") request["SourceType"] = "NAS" - if v, ok := d.GetOk("speed_limit"); ok { - request["SpeedLimit"] = v - } if v, ok := d.GetOk("vault_id"); ok { request["VaultId"] = v } @@ -219,9 +187,9 @@ func resourceAlicloudHbrNasBackupPlanUpdate(d *schema.ResourceData, meta interfa } if d.HasChange("path") { update = true + request["UpdatePaths"] = true if v, ok := d.GetOk("path"); ok { request["Path"] = v - request["UpdatePaths"] = true } } if !d.IsNewResource() && d.HasChange("schedule") { @@ -230,21 +198,6 @@ func resourceAlicloudHbrNasBackupPlanUpdate(d *schema.ResourceData, meta interfa } request["SourceType"] = "NAS" if update { - if v, ok := d.GetOk("detail"); ok { - request["Detail"] = v - } - if v, ok := d.GetOk("exclude"); ok { - request["Exclude"] = v - } - if v, ok := d.GetOk("include"); ok { - request["Include"] = v - } - if v, ok := d.GetOk("speed_limit"); ok { - request["SpeedLimit"] = v - } - if v, ok := d.GetOkExists("update_paths"); ok { - request["UpdatePaths"] = v - } action := "UpdateBackupPlan" conn, err := client.NewHbrClient() if err != nil { @@ -389,6 +342,9 @@ func resourceAlicloudHbrNasBackupPlanDelete(d *schema.ResourceData, meta interfa }) addDebug(action, response, request) if err != nil { + if IsExpectedErrors(err, []string{"NasFileSystemNotExist"}) { + return nil + } return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) } if fmt.Sprint(response["Success"]) == "false" { diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_hbr_oss_backup_plan.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_hbr_oss_backup_plan.go index a1ef085d13e..cbccc7e58f4 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_hbr_oss_backup_plan.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_hbr_oss_backup_plan.go @@ -25,8 +25,7 @@ func resourceAlicloudHbrOssBackupPlan() *schema.Resource { Schema: map[string]*schema.Schema{ "backup_type": { Type: schema.TypeString, - Optional: true, - Computed: true, + Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{"COMPLETE"}, false), }, @@ -37,7 +36,7 @@ func resourceAlicloudHbrOssBackupPlan() *schema.Resource { }, "bucket": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "oss_backup_plan_name": { @@ -58,7 +57,7 @@ func resourceAlicloudHbrOssBackupPlan() *schema.Resource { }, "vault_id": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, }, diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_hbr_replication_vault.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_hbr_replication_vault.go new file mode 100644 index 00000000000..42722eb95fb --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_hbr_replication_vault.go @@ -0,0 +1,201 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudHbrReplicationVault() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudHbrReplicationVaultCreate, + Read: resourceAlicloudHbrReplicationVaultRead, + Update: resourceAlicloudHbrReplicationVaultUpdate, + Delete: resourceAlicloudHbrReplicationVaultDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "description": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(0, 255), + }, + "replication_source_region_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "replication_source_vault_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "vault_name": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringLenBetween(1, 64), + }, + "vault_storage_class": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"STANDARD"}, false), + }, + }, + } +} + +func resourceAlicloudHbrReplicationVaultCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateReplicationVault" + request := make(map[string]interface{}) + conn, err := client.NewHbrClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + request["VaultRegionId"] = client.RegionId + request["ReplicationSourceRegionId"] = d.Get("replication_source_region_id") + request["ReplicationSourceVaultId"] = d.Get("replication_source_vault_id") + request["VaultName"] = d.Get("vault_name") + if v, ok := d.GetOk("vault_storage_class"); ok { + request["VaultStorageClass"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-09-08"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_hbr_replication_vault", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + + d.SetId(fmt.Sprint(response["VaultId"])) + + return resourceAlicloudHbrReplicationVaultRead(d, meta) +} +func resourceAlicloudHbrReplicationVaultRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + hbrService := HbrService{client} + object, err := hbrService.DescribeHbrReplicationVault(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_hbr_replication_vault hbrService.DescribeHbrReplicationVault Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("description", object["Description"]) + d.Set("replication_source_region_id", object["ReplicationSourceRegionId"]) + d.Set("replication_source_vault_id", object["ReplicationSourceVaultId"]) + d.Set("status", object["Status"]) + d.Set("vault_name", object["VaultName"]) + d.Set("vault_region_id", object["VaultRegionId"]) + d.Set("vault_storage_class", object["VaultStorageClass"]) + return nil +} +func resourceAlicloudHbrReplicationVaultUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "VaultId": d.Id(), + } + if d.HasChange("description") { + update = true + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + } + if d.HasChange("vault_name") { + update = true + request["VaultName"] = d.Get("vault_name") + } + if update { + action := "UpdateVault" + conn, err := client.NewHbrClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-09-08"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + } + return resourceAlicloudHbrReplicationVaultRead(d, meta) +} +func resourceAlicloudHbrReplicationVaultDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteVault" + var response map[string]interface{} + conn, err := client.NewHbrClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "VaultId": d.Id(), + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-09-08"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_hbr_restore_job.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_hbr_restore_job.go new file mode 100644 index 00000000000..e05e88c460f --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_hbr_restore_job.go @@ -0,0 +1,268 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudHbrRestoreJob() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudHbrRestoreJobCreate, + Read: resourceAlicloudHbrRestoreJobRead, + Update: resourceAlicloudHbrRestoreJobUpdate, + Delete: resourceAlicloudHbrRestoreJobDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(3 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "exclude": { + Type: schema.TypeString, + Optional: true, + }, + "include": { + Type: schema.TypeString, + Optional: true, + }, + "options": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "restore_job_id": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + }, + "restore_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"ECS_FILE", "NAS", "OSS"}, false), + }, + "snapshot_hash": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "snapshot_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "source_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"ECS_FILE", "NAS", "OSS"}, false), + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "target_bucket": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "target_client_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "target_container": { + Type: schema.TypeString, + Optional: true, + }, + "target_container_cluster_id": { + Type: schema.TypeString, + Optional: true, + }, + "target_create_time": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "target_data_source_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "target_file_system_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "target_instance_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "target_path": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "target_prefix": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "vault_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudHbrRestoreJobCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateRestoreJob" + request := make(map[string]interface{}) + conn, err := client.NewHbrClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("exclude"); ok { + request["Exclude"] = v + } + if v, ok := d.GetOk("include"); ok { + request["Include"] = v + } + if v, ok := d.GetOk("options"); ok { + request["Options"] = v + } + if v, ok := d.GetOk("restore_job_id"); ok { + request["RestoreId"] = v + } + request["RestoreType"] = d.Get("restore_type") + if v, ok := d.GetOk("snapshot_hash"); ok { + request["SnapshotHash"] = v + } + if v, ok := d.GetOk("snapshot_id"); ok { + request["SnapshotId"] = v + } + request["SourceType"] = d.Get("source_type") + if v, ok := d.GetOk("target_bucket"); ok { + request["TargetBucket"] = v + } + if v, ok := d.GetOk("target_client_id"); ok { + request["TargetClientId"] = v + } + if v, ok := d.GetOk("target_container"); ok { + request["TargetContainer"] = v + } + if v, ok := d.GetOk("target_container_cluster_id"); ok { + request["TargetContainerClusterId"] = v + } + if v, ok := d.GetOk("target_create_time"); ok { + request["TargetCreateTime"] = ConvertNasFileSystemStringToUnix(v.(string)) + } + if v, ok := d.GetOk("target_data_source_id"); ok { + request["TargetDataSourceId"] = v + } + if v, ok := d.GetOk("target_file_system_id"); ok { + request["TargetFileSystemId"] = v + } + if v, ok := d.GetOk("target_instance_id"); ok { + request["TargetInstanceId"] = v + } + if v, ok := d.GetOk("target_path"); ok { + request["TargetPath"] = v + } + if v, ok := d.GetOk("target_prefix"); ok { + request["TargetPrefix"] = v + } + if v, ok := d.GetOk("vault_id"); ok { + request["VaultId"] = v + } + request["ClientToken"] = buildClientToken("CreateRestoreJob") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-09-08"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_hbr_restore_job", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + + d.SetId(fmt.Sprint(response["RestoreId"], ":", request["RestoreType"])) + hbrService := HbrService{client} + stateConf := BuildStateConf([]string{"PARTIAL_COMPLETE", "CREATED"}, []string{"RUNNING", "COMPLETE", "FAILED"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, hbrService.HbrRestoreJobStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudHbrRestoreJobRead(d, meta) +} +func resourceAlicloudHbrRestoreJobRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + hbrService := HbrService{client} + object, err := hbrService.DescribeHbrRestoreJob(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_hbr_restore_job hbrService.DescribeHbrRestoreJob Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Set("restore_job_id", parts[0]) + d.Set("restore_type", parts[1]) + d.Set("options", object["Options"]) + d.Set("snapshot_hash", object["SnapshotHash"]) + d.Set("snapshot_id", object["SnapshotId"]) + d.Set("source_type", object["SourceType"]) + d.Set("status", object["Status"]) + d.Set("target_bucket", object["TargetBucket"]) + d.Set("target_client_id", object["TargetClientId"]) + if object["TargetCreateTime"] != nil { + t := int64(formatInt(object["TargetCreateTime"])) + d.Set("target_create_time", ConvertNasFileSystemUnixToString(d.Get("target_create_time").(string), t)) + } + d.Set("target_data_source_id", object["TargetDataSourceId"]) + d.Set("target_file_system_id", object["TargetFileSystemId"]) + d.Set("target_instance_id", object["TargetInstanceId"]) + d.Set("target_path", object["TargetPath"]) + d.Set("target_prefix", object["TargetPrefix"]) + d.Set("vault_id", object["VaultId"]) + return nil +} +func resourceAlicloudHbrRestoreJobUpdate(d *schema.ResourceData, meta interface{}) error { + log.Println(fmt.Sprintf("[WARNING] The resouce has not update operation.")) + return resourceAlicloudHbrRestoreJobRead(d, meta) +} +func resourceAlicloudHbrRestoreJobDelete(d *schema.ResourceData, meta interface{}) error { + log.Printf("[WARN] Cannot destroy resourceAlicloudHbrRestoreJob. Terraform will remove this resource from the state file, however resources may remain.") + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_hbr_server_backup_plan.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_hbr_server_backup_plan.go new file mode 100644 index 00000000000..359b68bfbfc --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_hbr_server_backup_plan.go @@ -0,0 +1,335 @@ +package alicloud + +import ( + "fmt" + "log" + "strconv" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudHbrServerBackupPlan() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudHbrServerBackupPlanCreate, + Read: resourceAlicloudHbrServerBackupPlanRead, + Update: resourceAlicloudHbrServerBackupPlanUpdate, + Delete: resourceAlicloudHbrServerBackupPlanDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "disabled": { + Type: schema.TypeBool, + Computed: true, + Optional: true, + }, + "detail": { + Type: schema.TypeSet, + Required: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "app_consistent": { + Type: schema.TypeBool, + Required: true, + }, + "snapshot_group": { + Type: schema.TypeBool, + Required: true, + }, + "enable_fs_freeze": { + Type: schema.TypeBool, + Optional: true, + }, + "pre_script_path": { + Type: schema.TypeString, + Optional: true, + }, + "post_script_path": { + Type: schema.TypeString, + Optional: true, + }, + "timeout_in_seconds": { + Type: schema.TypeInt, + Optional: true, + Default: 30, + }, + "disk_id_list": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "do_copy": { + Type: schema.TypeBool, + Optional: true, + }, + "destination_region_id": { + Type: schema.TypeString, + Optional: true, + }, + "destination_retention": { + Type: schema.TypeInt, + Optional: true, + Default: -1, + }, + }, + }, + }, + "ecs_server_backup_plan_name": { + Type: schema.TypeString, + Required: true, + }, + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "retention": { + Type: schema.TypeInt, + Required: true, + }, + "schedule": { + Type: schema.TypeString, + Required: true, + }, + }, + } +} + +func resourceAlicloudHbrServerBackupPlanCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + hbrService := HbrService{client} + var response map[string]interface{} + action := "CreateBackupPlan" + request := make(map[string]interface{}) + conn, err := client.NewHbrClient() + if err != nil { + return WrapError(err) + } + request["BackupType"] = "COMPLETE" + if v, err := hbrService.convertDetailToString(d.Get("detail").(*schema.Set).List()); err == nil { + request["Detail"] = v + } else { + return WrapError(err) + } + + request["PlanName"] = d.Get("ecs_server_backup_plan_name") + request["InstanceId"] = d.Get("instance_id") + request["UdmRegionId"] = client.RegionId + request["Retention"] = d.Get("retention") + + request["Schedule"] = d.Get("schedule") + request["SourceType"] = "UDM_ECS" + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-09-08"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_hbr_server_backup_plan", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + + d.SetId(fmt.Sprint(response["PlanId"])) + + return resourceAlicloudHbrServerBackupPlanUpdate(d, meta) +} +func resourceAlicloudHbrServerBackupPlanRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + hbrService := HbrService{client} + object, err := hbrService.DescribeHbrServerBackupPlan(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_hbr_server_backup_plan hbrService.DescribeHbrServerBackupPlan Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + if v, ok := object["Detail"].(map[string]interface{}); ok { + details := make([]map[string]interface{}, 0) + detail := make(map[string]interface{}) + detail["app_consistent"] = v["appConsistent"] + detail["snapshot_group"] = v["snapshotGroup"] + detail["enable_fs_freeze"] = v["enableFsFreeze"] + detail["pre_script_path"] = v["preScriptPath"] + detail["post_script_path"] = v["postScriptPath"] + detail["timeout_in_seconds"] = formatInt(v["timeoutInSeconds"]) + detail["do_copy"] = v["doCopy"] + detail["destination_region_id"] = v["destinationRegionId"] + detail["destination_retention"] = v["destinationRetention"] + if v["diskIdList"] != nil { + detail["disk_id_list"] = expandStringList(v["diskIdList"].([]interface{})) + } + details = append(details, detail) + if err := d.Set("detail", details); err != nil { + return WrapError(err) + } + } + d.Set("ecs_server_backup_plan_name", object["PlanName"]) + d.Set("instance_id", object["InstanceId"]) + d.Set("retention", formatInt(object["Retention"])) + d.Set("schedule", object["Schedule"]) + d.Set("disabled", object["Disabled"]) + return nil +} +func resourceAlicloudHbrServerBackupPlanUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + hbrService := HbrService{client} + var response map[string]interface{} + d.Partial(true) + + update := false + request := map[string]interface{}{ + "PlanId": d.Id(), + } + if !d.IsNewResource() && d.HasChange("retention") { + update = true + } + if v, ok := d.GetOk("retention"); ok { + request["Retention"] = v + } + if !d.IsNewResource() && d.HasChange("detail") { + update = true + if v, err := hbrService.convertDetailToString(d.Get("detail").(*schema.Set).List()); err == nil { + request["Detail"] = v + } else { + return WrapError(err) + } + } + if !d.IsNewResource() && d.HasChange("ecs_server_backup_plan_name") { + update = true + request["PlanName"] = d.Get("ecs_server_backup_plan_name") + } + if !d.IsNewResource() && d.HasChange("schedule") { + update = true + request["Schedule"] = d.Get("schedule") + } + request["SourceType"] = "UDM_ECS" + if update { + action := "UpdateBackupPlan" + conn, err := client.NewHbrClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-09-08"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + d.SetPartial("retention") + d.SetPartial("detail") + d.SetPartial("ecs_server_backup_plan_name") + d.SetPartial("schedule") + } + if d.HasChange("disabled") { + object, err := hbrService.DescribeHbrServerBackupPlan(d.Id()) + if err != nil { + return WrapError(err) + } + target := strconv.FormatBool(d.Get("disabled").(bool)) + if strconv.FormatBool(object["Disabled"].(bool)) != target { + if target == "false" { + request := map[string]interface{}{ + "PlanId": d.Id(), + } + request["SourceType"] = "UDM_ECS" + } + action := "EnableBackupPlan" + if target == "false" { + action = "EnableBackupPlan" + } else { + action = "DisableBackupPlan" + } + conn, err := client.NewHbrClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-09-08"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + } + d.SetPartial("disabled") + } + + d.Partial(false) + return resourceAlicloudHbrServerBackupPlanRead(d, meta) +} +func resourceAlicloudHbrServerBackupPlanDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteBackupPlan" + var response map[string]interface{} + conn, err := client.NewHbrClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "PlanId": d.Id(), + } + + request["SourceType"] = "UDM_ECS" + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-09-08"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_hbr_vault.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_hbr_vault.go index 7bfec0a2930..e0838c483da 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_hbr_vault.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_hbr_vault.go @@ -42,7 +42,7 @@ func resourceAlicloudHbrVault() *schema.Resource { Optional: true, Computed: true, ForceNew: true, - ValidateFunc: validation.StringInSlice([]string{"ARCHIVE", "IA", "STANDARD"}, false), + ValidateFunc: validation.StringInSlice([]string{"STANDARD"}, false), }, "vault_type": { Type: schema.TypeString, @@ -184,7 +184,7 @@ func resourceAlicloudHbrVaultDelete(d *schema.ResourceData, meta interface{}) er err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-09-08"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) if err != nil { - if NeedRetry(err) { + if IsExpectedErrors(err, []string{"CannotDeleteReplicationSourceVault"}) || NeedRetry(err) { wait() return resource.RetryableError(err) } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_image.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_image.go index 7f27b84b909..a7320e6f1a0 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_image.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_image.go @@ -135,6 +135,12 @@ func resourceAliCloudImage() *schema.Resource { Default: false, }, "tags": tagsSchema(), + // Not the public attribute and it used to automatically delete dependence snapshots while deleting the image. + // Available in 1.136.0 + "delete_auto_snapshot": { + Type: schema.TypeBool, + Optional: true, + }, }, } } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_image_copy.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_image_copy.go index 00b5c0b37c1..ee80052a6dc 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_image_copy.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_image_copy.go @@ -65,6 +65,12 @@ func resourceAliCloudImageCopy() *schema.Resource { Default: false, }, "tags": tagsSchema(), + // Not the public attribute and it used to automatically delete dependence snapshots while deleting the image. + // Available in 1.136.0 + "delete_auto_snapshot": { + Type: schema.TypeBool, + Optional: true, + }, }, } } @@ -105,6 +111,16 @@ func resourceAliCloudImageCopyCreate(d *schema.ResourceData, meta interface{}) e d.SetId(response.ImageId) stateConf := BuildStateConf([]string{"Creating", "Waiting"}, []string{"Available"}, d.Timeout(schema.TimeoutCreate), 1*time.Minute, ecsService.ImageStateRefreshFunc(d.Id(), []string{"CreateFailed", "UnAvailable"})) if _, err := stateConf.WaitForState(); err != nil { + // If the copying is timeout, the progress should be cancelled + // Currently the product does not support cancel some specify images + //cancelCopyImageRequest := ecs.CreateCancelCopyImageRequest() + //cancelCopyImageRequest.ImageId = d.Id() + //cancelCopyImageRequest.RegionId = client.RegionId + //if _, err := client.WithEcsClient(func(ecsClient *ecs.Client) (interface{}, error) { + // return ecsClient.CancelCopyImage(cancelCopyImageRequest) + //}); err != nil { + // return WrapErrorf(err, DefaultErrorMsg, "alicloud_image_copy", cancelCopyImageRequest.GetActionName(), AlibabaCloudSdkGoERROR) + //} return WrapErrorf(err, IdMsg, d.Id()) } return resourceAliCloudImageCopyRead(d, meta) diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_imm_project.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_imm_project.go new file mode 100644 index 00000000000..200beac0653 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_imm_project.go @@ -0,0 +1,163 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudImmProject() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudImmProjectCreate, + Read: resourceAlicloudImmProjectRead, + Update: resourceAlicloudImmProjectUpdate, + Delete: resourceAlicloudImmProjectDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "project": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-zA-z][a-zA-Z0-9\\-]{1,49}$`), "The length of the project name is limited to 1-50 characters, can only contain English letters, numbers and dashes (-), must start with an English letter, and cannot be ALL (reserved words)"), + }, + "service_role": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + }, + } +} + +func resourceAlicloudImmProjectCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "PutProject" + request := make(map[string]interface{}) + conn, err := client.NewImmClient() + if err != nil { + return WrapError(err) + } + request["Project"] = d.Get("project") + if v, ok := d.GetOk("service_role"); ok { + request["ServiceRole"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-09-06"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_imm_project", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["Project"])) + + return resourceAlicloudImmProjectUpdate(d, meta) +} +func resourceAlicloudImmProjectRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + immService := ImmService{client} + object, err := immService.DescribeImmProject(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_imm_project immService.DescribeImmProject Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + + d.Set("project", d.Id()) + if v, ok := object["CU"]; ok && fmt.Sprint(v) != "0" { + d.Set("compute_unit", formatInt(v)) + } + d.Set("service_role", object["ServiceRole"]) + return nil +} +func resourceAlicloudImmProjectUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "Project": d.Id(), + } + if !d.IsNewResource() && d.HasChange("service_role") { + update = true + if v, ok := d.GetOk("service_role"); ok { + request["NewServiceRole"] = v + } + } + if update { + action := "UpdateProject" + conn, err := client.NewImmClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-09-06"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudImmProjectRead(d, meta) +} +func resourceAlicloudImmProjectDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteProject" + var response map[string]interface{} + conn, err := client.NewImmClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "Project": d.Id(), + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-09-06"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_imp_app_template.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_imp_app_template.go new file mode 100644 index 00000000000..46040b384e9 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_imp_app_template.go @@ -0,0 +1,269 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudImpAppTemplate() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudImpAppTemplateCreate, + Read: resourceAlicloudImpAppTemplateRead, + Update: resourceAlicloudImpAppTemplateUpdate, + Delete: resourceAlicloudImpAppTemplateDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "app_template_name": { + Type: schema.TypeString, + Required: true, + }, + "component_list": { + Type: schema.TypeList, + Required: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + ValidateFunc: validation.StringInSlice([]string{"component.live", "component.liveRecord", "component.liveBeauty", "component.rtc", "component.rtcRecord", "component.im", "component.whiteboard", "component.liveSecurity", "component.chatSecurity"}, false), + }, + ForceNew: true, + }, + "config_list": { + Type: schema.TypeSet, + Optional: true, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "value": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + }, + }, + }, + "integration_mode": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"paasSDK", "standardRoom"}, false), + }, + "scene": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"business", "classroom"}, false), + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudImpAppTemplateCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateAppTemplate" + request := make(map[string]interface{}) + conn, err := client.NewImpClient() + if err != nil { + return WrapError(err) + } + request["AppTemplateName"] = d.Get("app_template_name") + request["ComponentList"] = convertListToJsonString(d.Get("component_list").([]interface{})) + if v, ok := d.GetOk("integration_mode"); ok { + request["IntegrationMode"] = v + } + if v, ok := d.GetOk("scene"); ok { + request["Scene"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-06-30"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_imp_app_template", action, AlibabaCloudSdkGoERROR) + } + responseResult := response["Result"].(map[string]interface{}) + d.SetId(fmt.Sprint(responseResult["AppTemplateId"])) + + return resourceAlicloudImpAppTemplateRead(d, meta) +} +func resourceAlicloudImpAppTemplateRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + impService := ImpService{client} + object, err := impService.DescribeImpAppTemplate(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_imp_app_template impService.DescribeImpAppTemplate Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("app_template_name", object["AppTemplateName"]) + if componentList, ok := object["ComponentList"]; ok && componentList != nil { + d.Set("component_list", componentList) + } + if configList, ok := object["ConfigList"]; ok && configList != nil { + configListMaps := make([]map[string]interface{}, 0) + for _, configListItem := range configList.([]interface{}) { + if configListItemMap, ok := configListItem.(map[string]interface{}); ok { + configListMap := make(map[string]interface{}, 0) + configListMap["key"] = configListItemMap["Key"] + configListMap["value"] = configListItemMap["Value"] + configListMaps = append(configListMaps, configListMap) + } + } + d.Set("config_list", configListMaps) + } + + d.Set("integration_mode", object["IntegrationMode"]) + d.Set("scene", object["Scene"]) + d.Set("status", object["Status"]) + return nil +} +func resourceAlicloudImpAppTemplateUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + d.Partial(true) + + update := false + request := map[string]interface{}{ + "AppTemplateId": d.Id(), + } + if d.HasChange("app_template_name") { + update = true + request["AppTemplateName"] = d.Get("app_template_name") + } + if update { + action := "UpdateAppTemplate" + conn, err := client.NewImpClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-06-30"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("app_template_name") + } + update = false + updateAppTemplateConfigReq := map[string]interface{}{ + "AppTemplateId": d.Id(), + } + if d.HasChanges("config_list") { + update = true + if v, ok := d.GetOk("config_list"); ok { + configListMaps := make([]map[string]interface{}, 0) + for _, configList := range v.(*schema.Set).List() { + configListArg := configList.(map[string]interface{}) + configListMap := map[string]interface{}{ + "Key": configListArg["key"], + "Value": configListArg["value"], + } + configListMaps = append(configListMaps, configListMap) + } + if v, err := convertListMapToJsonString(configListMaps); err != nil { + return WrapError(err) + } else { + updateAppTemplateConfigReq["ConfigList"] = v + } + } + } + if update { + action := "UpdateAppTemplateConfig" + conn, err := client.NewImpClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-06-30"), StringPointer("AK"), nil, updateAppTemplateConfigReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, updateAppTemplateConfigReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("key") + d.SetPartial("value") + } + d.Partial(false) + return resourceAlicloudImpAppTemplateRead(d, meta) +} +func resourceAlicloudImpAppTemplateDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteAppTemplate" + var response map[string]interface{} + conn, err := client.NewImpClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "AppTemplateId": d.Id(), + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-06-30"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidAppTemplateId.App.NotFound"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_instance.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_instance.go index bf4726fe5ff..0e200a0bb85 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_instance.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_instance.go @@ -406,6 +406,34 @@ func resourceAliyunInstance() *schema.Resource { return diff }, }, + "hpc_cluster_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "secondary_private_ips": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Computed: true, + ConflictsWith: []string{"secondary_private_ip_address_count"}, + }, + "secondary_private_ip_address_count": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + ConflictsWith: []string{"secondary_private_ips"}, + }, + "deployment_set_id": { + Type: schema.TypeString, + Optional: true, + }, + "deployment_set_group_no": { + Type: schema.TypeString, + Computed: true, + }, }, } } @@ -472,6 +500,7 @@ func resourceAliyunInstanceRead(d *schema.ResourceData, meta interface{}) error d.SetId("") return nil } + return WrapError(err) } var disk ecs.Disk @@ -513,7 +542,9 @@ func resourceAliyunInstanceRead(d *schema.ResourceData, meta interface{}) error d.Set("credit_specification", instance.CreditSpecification) d.Set("auto_release_time", instance.AutoReleaseTime) d.Set("tags", ecsService.tagsToMap(instance.Tags.Tag)) - + d.Set("hpc_cluster_id", instance.HpcClusterId) + d.Set("deployment_set_id", instance.DeploymentSetId) + d.Set("deployment_set_group_no", instance.DeploymentSetGroupNo) if len(instance.PublicIpAddress.IpAddress) > 0 { d.Set("public_ip", instance.PublicIpAddress.IpAddress[0]) } else { @@ -609,6 +640,27 @@ func resourceAliyunInstanceRead(d *schema.ResourceData, meta interface{}) error //} d.Set("period_unit", periodUnit) } + networkInterfaceId := "" + for _, obj := range instance.NetworkInterfaces.NetworkInterface { + if obj.Type == "Primary" { + networkInterfaceId = obj.NetworkInterfaceId + break + } + } + if len(networkInterfaceId) != 0 { + object, err := ecsService.DescribeEcsNetworkInterface(networkInterfaceId) + if err != nil { + return WrapError(err) + } + secondaryPrivateIpsSli := make([]interface{}, 0, len(object["PrivateIpSets"].(map[string]interface{})["PrivateIpSet"].([]interface{}))) + for _, v := range object["PrivateIpSets"].(map[string]interface{})["PrivateIpSet"].([]interface{}) { + if !v.(map[string]interface{})["Primary"].(bool) { + secondaryPrivateIpsSli = append(secondaryPrivateIpsSli, v.(map[string]interface{})["PrivateIpAddress"]) + } + } + d.Set("secondary_private_ips", secondaryPrivateIpsSli) + d.Set("secondary_private_ip_address_count", len(secondaryPrivateIpsSli)) + } return nil } @@ -616,7 +668,10 @@ func resourceAliyunInstanceRead(d *schema.ResourceData, meta interface{}) error func resourceAliyunInstanceUpdate(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) ecsService := EcsService{client} - + conn, err := client.NewEcsClient() + if err != nil { + return WrapError(err) + } d.Partial(true) if !d.IsNewResource() { @@ -634,10 +689,6 @@ func resourceAliyunInstanceUpdate(d *schema.ResourceData, meta interface{}) erro "RegionId": client.RegionId, "ResourceGroupId": d.Get("resource_group_id"), } - conn, err := client.NewEcsClient() - if err != nil { - return WrapError(err) - } response, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-26"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) if err != nil { return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) @@ -730,7 +781,7 @@ func resourceAliyunInstanceUpdate(d *schema.ResourceData, meta interface{}) erro return WrapError(err) } - if d.HasChange("auto_release_time") { + if !d.IsNewResource() && d.HasChange("auto_release_time") { request := ecs.CreateModifyInstanceAutoReleaseTimeRequest() request.InstanceId = d.Id() request.RegionId = client.RegionId @@ -876,6 +927,194 @@ func resourceAliyunInstanceUpdate(d *schema.ResourceData, meta interface{}) erro d.SetPartial("auto_renew_period") } + if d.HasChange("secondary_private_ips") { + client := meta.(*connectivity.AliyunClient) + ecsService := EcsService{client} + var response map[string]interface{} + instance, err := ecsService.DescribeInstance(d.Id()) + if err != nil { + return WrapError(err) + } + networkInterfaceId := "" + for _, obj := range instance.NetworkInterfaces.NetworkInterface { + if obj.Type == "Primary" { + networkInterfaceId = obj.NetworkInterfaceId + break + } + } + oraw, nraw := d.GetChange("secondary_private_ips") + remove := oraw.(*schema.Set).Difference(nraw.(*schema.Set)).List() + create := nraw.(*schema.Set).Difference(oraw.(*schema.Set)).List() + if len(remove) > 0 { + action := "UnassignPrivateIpAddresses" + request := map[string]interface{}{ + "RegionId": client.RegionId, + "NetworkInterfaceId": networkInterfaceId, + "ClientToken": buildClientToken(action), + } + + for index, val := range remove { + request[fmt.Sprintf("PrivateIpAddress.%d", index+1)] = val + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-26"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) || IsExpectedErrors(err, []string{"OperationConflict"}) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + addDebug(action, response, request) + d.SetPartial("secondary_private_ips") + } + if len(create) > 0 { + action := "AssignPrivateIpAddresses" + request := map[string]interface{}{ + "RegionId": client.RegionId, + "NetworkInterfaceId": networkInterfaceId, + "ClientToken": buildClientToken(action), + } + for index, val := range create { + request[fmt.Sprintf("PrivateIpAddress.%d", index+1)] = val + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-26"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) || IsExpectedErrors(err, []string{"OperationConflict"}) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("secondary_private_ips") + } + + } + + if d.HasChange("secondary_private_ip_address_count") { + client := meta.(*connectivity.AliyunClient) + ecsService := EcsService{client} + var response map[string]interface{} + instance, err := ecsService.DescribeInstance(d.Id()) + if err != nil { + return WrapError(err) + } + // query for the Primary NetworkInterfaceId + networkInterfaceId := "" + for _, obj := range instance.NetworkInterfaces.NetworkInterface { + if obj.Type == "Primary" { + networkInterfaceId = obj.NetworkInterfaceId + break + } + } + privateIpList := expandStringList(d.Get("secondary_private_ips").(*schema.Set).List()) + oldIpsCount, newIpsCount := d.GetChange("secondary_private_ip_address_count") + if oldIpsCount != nil && newIpsCount != nil && newIpsCount != len(privateIpList) { + diff := newIpsCount.(int) - oldIpsCount.(int) + if diff > 0 { + action := "AssignPrivateIpAddresses" + request := map[string]interface{}{ + "RegionId": client.RegionId, + "NetworkInterfaceId": networkInterfaceId, + "ClientToken": buildClientToken(action), + "SecondaryPrivateIpAddressCount": diff, + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-26"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) || IsExpectedErrors(err, []string{"OperationConflict"}) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("secondary_private_ip_address_count") + } + if diff < 0 { + diff *= -1 + action := "UnassignPrivateIpAddresses" + request := map[string]interface{}{ + "RegionId": client.RegionId, + "NetworkInterfaceId": networkInterfaceId, + "ClientToken": buildClientToken(action), + } + for index, val := range privateIpList[:diff] { + request[fmt.Sprintf("PrivateIpAddress.%d", index+1)] = val + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-26"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) || IsExpectedErrors(err, []string{"OperationConflict"}) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + addDebug(action, response, request) + d.SetPartial("secondary_private_ip_address_count") + } + } + } + if !d.IsNewResource() && d.HasChange("deployment_set_id") { + action := "ModifyInstanceDeployment" + var response map[string]interface{} + request := map[string]interface{}{ + "RegionId": client.RegionId, + "InstanceId": d.Id(), + "ClientToken": buildClientToken(action), + } + if v, ok := d.GetOk("deployment_set_id"); ok { + request["DeploymentSetId"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-26"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("deployment_set_id") + } + d.Partial(false) return resourceAliyunInstanceRead(d, meta) } @@ -1125,6 +1364,15 @@ func buildAliyunInstanceArgs(d *schema.ResourceData, meta interface{}) (*ecs.Run } request.DataDisk = &dataDiskRequests } + + if v, ok := d.GetOk("hpc_cluster_id"); ok { + request.HpcClusterId = v.(string) + } + + if v, ok := d.GetOk("deployment_set_id"); ok { + request.DeploymentSetId = v.(string) + } + return request, nil } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_iot_device_group.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_iot_device_group.go new file mode 100644 index 00000000000..a849fe9d9af --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_iot_device_group.go @@ -0,0 +1,196 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudIotDeviceGroup() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudIotDeviceGroupCreate, + Read: resourceAlicloudIotDeviceGroupRead, + Update: resourceAlicloudIotDeviceGroupUpdate, + Delete: resourceAlicloudIotDeviceGroupDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "group_desc": { + Type: schema.TypeString, + Optional: true, + }, + "group_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(0, 30), + }, + "iot_instance_id": { + Type: schema.TypeString, + Optional: true, + }, + "super_group_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudIotDeviceGroupCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateDeviceGroup" + request := make(map[string]interface{}) + conn, err := client.NewIotClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("group_desc"); ok { + request["GroupDesc"] = v + } + request["GroupName"] = d.Get("group_name") + if v, ok := d.GetOk("iot_instance_id"); ok { + request["IotInstanceId"] = v + } + if v, ok := d.GetOk("super_group_id"); ok { + request["SuperGroupId"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-01-20"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_iot_device_group", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + responseData := response["Data"].(map[string]interface{}) + d.SetId(fmt.Sprint(responseData["GroupId"])) + + return resourceAlicloudIotDeviceGroupRead(d, meta) +} +func resourceAlicloudIotDeviceGroupRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + iotService := IotService{client} + object, err := iotService.DescribeIotDeviceGroup(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_iot_device_group iotService.DescribeIotDeviceGroup Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + + descmap := object["Data"].(map[string]interface{}) + if val, exist := descmap["GroupDesc"]; exist { + d.Set("group_desc", val) + } + + d.Set("group_name", object["Data"].(map[string]interface{})["GroupName"]) + return nil +} +func resourceAlicloudIotDeviceGroupUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "GroupId": d.Id(), + } + if d.HasChange("group_desc") { + update = true + if v, ok := d.GetOk("group_desc"); ok { + request["GroupDesc"] = v + } + } + if d.HasChange("iot_instance_id") { + update = true + if v, ok := d.GetOk("iot_instance_id"); ok { + request["IotInstanceId"] = v + } + } + if update { + action := "UpdateDeviceGroup" + conn, err := client.NewIotClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-01-20"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + } + return resourceAlicloudIotDeviceGroupRead(d, meta) +} +func resourceAlicloudIotDeviceGroupDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteDeviceGroup" + var response map[string]interface{} + conn, err := client.NewIotClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "GroupId": d.Id(), + } + + if v, ok := d.GetOk("iot_instance_id"); ok { + request["IotInstanceId"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-01-20"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_kvstore_instance.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_kvstore_instance.go index 037128a12f4..748388f4e11 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_kvstore_instance.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_kvstore_instance.go @@ -1019,7 +1019,7 @@ func resourceAlicloudKvstoreInstanceUpdate(d *schema.ResourceData, meta interfac if err != nil { return WrapErrorf(err, DefaultErrorMsg, d.Id(), modifySecurityIpsReq.GetActionName(), AlibabaCloudSdkGoERROR) } - stateConf := BuildStateConf([]string{}, []string{"Normal"}, d.Timeout(schema.TimeoutUpdate), 120*time.Second, r_kvstoreService.KvstoreInstanceStateRefreshFunc(d.Id(), []string{})) + stateConf := BuildStateConf([]string{}, []string{"Normal"}, d.Timeout(schema.TimeoutUpdate), 1*time.Second, r_kvstoreService.KvstoreInstanceStateRefreshFunc(d.Id(), []string{})) if _, err := stateConf.WaitForState(); err != nil { return WrapErrorf(err, IdMsg, d.Id()) } @@ -1206,7 +1206,7 @@ func refreshParameters(d *schema.ResourceData, meta interface{}) error { m := make(map[string]interface{}) err = json.Unmarshal([]byte(object.Config), &m) if err != nil { - fmt.Println(err) + return WrapError(err) } for k, v := range m { diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_log_audit.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_log_audit.go index 474d1eab609..2e7fd8c11c4 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_log_audit.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_log_audit.go @@ -11,6 +11,7 @@ import ( "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" ) func resourceAlicloudLogAudit() *schema.Resource { @@ -43,6 +44,11 @@ func resourceAlicloudLogAudit() *schema.Resource { Elem: &schema.Schema{Type: schema.TypeString}, Optional: true, }, + "resource_directory_type": { + Type: schema.TypeString, + ValidateFunc: validation.StringInSlice([]string{"custom", "all"}, true), + Optional: true, + }, }, } } @@ -61,7 +67,18 @@ func resourceAlicloudLogAuditUpdate(d *schema.ResourceData, meta interface{}) er var variableMap = map[string]interface{}{} mutiAccount := expandStringList(d.Get("multi_account").(*schema.Set).List()) - if len(mutiAccount) > 0 { + + if resourceDirectoryType, ok := d.GetOk("resource_directory_type"); ok { + resourceDirectoryMap := map[string]interface{}{} + resourceDirectoryMap["type"] = resourceDirectoryType + resourceDirectoryMap["multi_account"] = mutiAccount + data, err := json.Marshal(resourceDirectoryMap) + if err != nil { + return WrapError(err) + } + resultResourceDirectory := string(data) + variableMap["resource_directory"] = resultResourceDirectory + } else if len(mutiAccount) > 0 { mutiAccountList := []map[string]string{} for _, v := range mutiAccount { mutiAccountMap := map[string]string{} @@ -138,6 +155,21 @@ func resourceAlicloudLogAuditRead(d *schema.ResourceData, meta interface{}) erro } d.Set("multi_account", account) } + if resourceDirectory, ok := initMap["resource_directory"]; ok { + resourceDirectoryMap := map[string]interface{}{} + err = json.Unmarshal([]byte(resourceDirectory.(string)), &resourceDirectoryMap) + if err != nil { + return WrapError(err) + } + if len(resourceDirectoryMap) > 0 { + if rd_type, ok := resourceDirectoryMap["type"]; ok { + d.Set("resource_directory_type", rd_type.(string)) + } + if multiAccount, ok := resourceDirectoryMap["multi_account"]; ok { + d.Set("multi_account", multiAccount) + } + } + } for k := range initMap { if strings.HasSuffix(k, "_policy_setting") { delete(initMap, k) @@ -148,6 +180,7 @@ func resourceAlicloudLogAuditRead(d *schema.ResourceData, meta interface{}) erro delete(initMap, "project") delete(initMap, "logstore") delete(initMap, "multi_account") + delete(initMap, "resource_directory") d.Set("variable_map", initMap) return nil } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_log_oss_shipper.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_log_oss_shipper.go index 20ccd5c2fc3..75002499270 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_log_oss_shipper.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_log_oss_shipper.go @@ -286,6 +286,9 @@ func resourceAlicloudLogOssShipperDelete(d *schema.ResourceData, meta interface{ return nil }) if err != nil { + if IsExpectedErrors(err, []string{"ShipperNotExist"}) { + return nil + } return WrapErrorf(err, DefaultErrorMsg, "alicloud_log_oss_shipper", "DeleteLogOssShipper", AliyunLogGoSdkERROR) } return WrapError(logService.WaitForLogOssShipper(d.Id(), Deleted, DefaultTimeout)) diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_log_project.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_log_project.go index 0c8da6dc68a..c2a9d7aa585 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_log_project.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_log_project.go @@ -103,7 +103,7 @@ func buildTags(projectName string, tags map[string]interface{}) *sls.ResourceTag slsTags := []sls.ResourceTag{} for key, value := range tags { - tag := sls.ResourceTag{key, value.(string)} + tag := sls.ResourceTag{Key: key, Value: value.(string)} slsTags = append(slsTags, tag) } projectTags := sls.NewProjectTags(projectName, slsTags) diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_log_store.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_log_store.go index be9dcb1f2ab..7c33339e19b 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_log_store.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_log_store.go @@ -22,6 +22,11 @@ func resourceAlicloudLogStore() *schema.Resource { Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(3 * time.Minute), + Delete: schema.DefaultTimeout(3 * time.Minute), + Read: schema.DefaultTimeout(2 * time.Minute), + }, Schema: map[string]*schema.Schema{ "project": { @@ -157,7 +162,7 @@ func resourceAlicloudLogStoreCreate(d *schema.ResourceData, meta interface{}) er logstore.EncryptConf = encrypt } var requestinfo *sls.Client - err := resource.Retry(3*time.Minute, func() *resource.RetryError { + err := resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { raw, err := client.WithLogClient(func(slsClient *sls.Client) (interface{}, error) { requestinfo = slsClient @@ -165,6 +170,7 @@ func resourceAlicloudLogStoreCreate(d *schema.ResourceData, meta interface{}) er }) if err != nil { if IsExpectedErrors(err, []string{"InternalServerError", LogClientTimeout}) { + time.Sleep(10 * time.Second) return resource.RetryableError(err) } return resource.NonRetryableError(err) @@ -208,10 +214,11 @@ func resourceAlicloudLogStoreRead(d *schema.ResourceData, meta interface{}) erro d.Set("retention_period", object.TTL) d.Set("shard_count", object.ShardCount) var shards []*sls.Shard - err = resource.Retry(2*time.Minute, func() *resource.RetryError { + err = resource.Retry(d.Timeout(schema.TimeoutRead), func() *resource.RetryError { shards, err = object.ListShards() if err != nil { if IsExpectedErrors(err, []string{"InternalServerError"}) { + time.Sleep(10 * time.Second) return resource.RetryableError(err) } return resource.NonRetryableError(err) @@ -326,24 +333,38 @@ func resourceAlicloudLogStoreUpdate(d *schema.ResourceData, meta interface{}) er func resourceAlicloudLogStoreDelete(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) logService := LogService{client} - parts, err := ParseResourceId(d.Id(), 2) if err != nil { return WrapError(err) } - - project, err := logService.DescribeLogProject(parts[0]) - if err != nil { - return WrapError(err) - } - err = project.DeleteLogStore(parts[1]) - if err != nil { - if IsExpectedErrors(err, []string{"LogStoreNotExist"}) { - return nil + var raw interface{} + var requestInfo *sls.Client + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + raw, err = client.WithLogClient(func(slsClient *sls.Client) (interface{}, error) { + requestInfo = slsClient + return nil, slsClient.DeleteLogStore(parts[0], parts[1]) + }) + if err != nil { + if code, ok := err.(*sls.Error); ok { + if "LogStoreNotExist" == code.Code { + return nil + } + } + if IsExpectedErrors(err, []string{"ProjectForbidden", LogClientTimeout}) { + time.Sleep(10 * time.Second) + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) } - return WrapErrorf(err, DefaultErrorMsg, d.Id(), "DeleteLogStore", AliyunLogGoSdkERROR) + return nil + }) + addDebug("DeleteLogStore", raw, requestInfo, map[string]interface{}{ + "project": parts[0], + "logstore": parts[1], + }) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_log_store", "DeleteLogStore", AliyunLogGoSdkERROR) } - addDebug("DeleteLogStore", nil) return WrapError(logService.WaitForLogStore(d.Id(), Deleted, DefaultTimeout)) } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_logtail_config.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_logtail_config.go index e9cfa4c60a1..0268fb814fb 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_logtail_config.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_logtail_config.go @@ -165,7 +165,9 @@ func resourceAlicloudLogtailConfiglUpdate(d *schema.ResourceData, meta interface update = true } if update { - logconfig := &sls.LogConfig{} + logconfig := &sls.LogConfig{ + InputType: d.Get("input_type").(string), + } inputConfigInputDetail := make(map[string]interface{}) data := d.Get("input_detail").(string) conver_err := json.Unmarshal([]byte(data), &inputConfigInputDetail) diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_mhub_app.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_mhub_app.go new file mode 100644 index 00000000000..09d33df139a --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_mhub_app.go @@ -0,0 +1,228 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudMhubApp() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudMhubAppCreate, + Read: resourceAlicloudMhubAppRead, + Update: resourceAlicloudMhubAppUpdate, + Delete: resourceAlicloudMhubAppDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "app_name": { + Type: schema.TypeString, + Required: true, + }, + "product_id": { + Type: schema.TypeString, + Required: true, + }, + "bundle_id": { + Type: schema.TypeString, + Optional: true, + ConflictsWith: []string{"package_name"}, + }, + "encoded_icon": { + Type: schema.TypeString, + Optional: true, + }, + "industry_id": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "package_name": { + Type: schema.TypeString, + Optional: true, + ConflictsWith: []string{"bundle_id"}, + }, + "type": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"Android", "iOS"}, false), + }, + }, + } +} + +func resourceAlicloudMhubAppCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateApp" + request := make(map[string]interface{}) + conn, err := client.NewMhubClient() + if err != nil { + return WrapError(err) + } + request["Name"] = d.Get("app_name") + request["ProductId"] = d.Get("product_id") + + if v, ok := d.GetOk("package_name"); ok { + request["PackageName"] = v.(string) + } else if v, ok := d.GetOk("bundle_id"); ok { + request["BundleId"] = v.(string) + } else { + return WrapError(fmt.Errorf("either bundle_id or package_name must be set")) + } + + request["Type"] = convertTypeRequest(d.Get("type").(string)) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-08-25"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_mhub_app", action, AlibabaCloudSdkGoERROR) + } + responseAppInfo := response["AppInfo"].(map[string]interface{}) + d.SetId(fmt.Sprint(responseAppInfo["ProductId"], ":", responseAppInfo["AppKey"])) + + return resourceAlicloudMhubAppUpdate(d, meta) +} +func resourceAlicloudMhubAppRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + mhubService := MhubService{client} + object, err := mhubService.DescribeMhubApp(d.Id()) + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_mhub_app mhubService.DescribeMhubApp Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("app_name", object["Name"]) + d.Set("bundle_id", object["BundleId"]) + d.Set("product_id", parts[0]) + + d.Set("type", convertTypeResponse(formatInt(object["Type"]))) + d.Set("encoded_icon", object["EncodedIcon"]) + d.Set("industry_id", fmt.Sprint(formatInt(object["IndustryId"]))) + d.Set("package_name", object["PackageName"]) + return nil +} +func resourceAlicloudMhubAppUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "AppKey": parts[1], + } + if !d.IsNewResource() && d.HasChange("app_name") { + update = true + request["Name"] = d.Get("app_name") + } + if d.HasChange("encoded_icon") { + update = true + if v, ok := d.GetOk("encoded_icon"); ok { + request["EncodedIcon"] = v + } + } + if d.HasChange("industry_id") { + update = true + if v, ok := d.GetOk("industry_id"); ok { + request["IndustryId"] = v + } + } + if update { + action := "ModifyApp" + conn, err := client.NewMhubClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-08-25"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudMhubAppRead(d, meta) +} +func resourceAlicloudMhubAppDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteApp" + var response map[string]interface{} + conn, err := client.NewMhubClient() + if err != nil { + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 2) + request := map[string]interface{}{ + "AppKey": parts[1], + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-08-25"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} + +func convertTypeResponse(source int) string { + switch source { + case 1: + return "iOS" + case 2: + return "Android" + } + return "" +} +func convertTypeRequest(source string) string { + switch source { + case "iOS": + return "1" + case "Android": + return "2" + } + return source +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_mhub_product.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_mhub_product.go new file mode 100644 index 00000000000..e5a558eeffc --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_mhub_product.go @@ -0,0 +1,142 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudMhubProduct() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudMhubProductCreate, + Read: resourceAlicloudMhubProductRead, + Update: resourceAlicloudMhubProductUpdate, + Delete: resourceAlicloudMhubProductDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "product_name": { + Type: schema.TypeString, + Required: true, + }, + }, + } +} + +func resourceAlicloudMhubProductCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateProduct" + request := make(map[string]interface{}) + conn, err := client.NewMhubClient() + if err != nil { + return WrapError(err) + } + request["Name"] = d.Get("product_name") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-08-25"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_mhub_product", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["ProductId"])) + + return resourceAlicloudMhubProductRead(d, meta) +} +func resourceAlicloudMhubProductRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + mhubService := MhubService{client} + object, err := mhubService.DescribeMhubProduct(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_mhub_product mhubService.DescribeMhubProduct Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("product_name", object["Name"]) + return nil +} +func resourceAlicloudMhubProductUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + request := map[string]interface{}{ + "ProductId": d.Id(), + } + if d.HasChange("product_name") { + request["Name"] = d.Get("product_name") + } + action := "ModifyProduct" + conn, err := client.NewMhubClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-08-25"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return resourceAlicloudMhubProductRead(d, meta) +} +func resourceAlicloudMhubProductDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteProduct" + var response map[string]interface{} + conn, err := client.NewMhubClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "ProductId": d.Id(), + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-08-25"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"ProductNotExist"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_mongodb_account.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_mongodb_account.go new file mode 100644 index 00000000000..62d255a42a8 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_mongodb_account.go @@ -0,0 +1,201 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudMongodbAccount() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudMongodbAccountCreate, + Read: resourceAlicloudMongodbAccountRead, + Update: resourceAlicloudMongodbAccountUpdate, + Delete: resourceAlicloudMongodbAccountDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(10 * time.Minute), + Update: schema.DefaultTimeout(10 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "account_description": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.All(validation.StringDoesNotMatch(regexp.MustCompile(`(^http://.*)|(^https://.*)`), "It cannot begin with \"http://\", \"https://\"."), validation.StringMatch(regexp.MustCompile(`^[a-zA-Z][a-zA-Z0-9_-]{1,255}$`), "It must be `2` to `256` characters in length, The description must start with a letter, and can contain letters, digits, underscores (_), and hyphens (-).")), + }, + "account_name": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"root"}, false), + }, + "account_password": { + Type: schema.TypeString, + Required: true, + Sensitive: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`[a-zA-Z!#$%^&*()_+-=]{8,32}`), "account_password must consist of uppercase letters, lowercase letters, numbers, and special characters"), + }, + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudMongodbAccountCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "ResetAccountPassword" + request := make(map[string]interface{}) + conn, err := client.NewDdsClient() + if err != nil { + return WrapError(err) + } + request["AccountName"] = d.Get("account_name") + request["AccountPassword"] = d.Get("account_password") + request["DBInstanceId"] = d.Get("instance_id") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-12-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_mongodb_account", action, AlibabaCloudSdkGoERROR) + } + d.SetId(fmt.Sprint(request["DBInstanceId"], ":", request["AccountName"])) + MongoDBService := MongoDBService{client} + stateConf := BuildStateConf([]string{}, []string{"Available"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, MongoDBService.MongodbAccountStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudMongodbAccountUpdate(d, meta) +} +func resourceAlicloudMongodbAccountRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + MongoDBService := MongoDBService{client} + object, err := MongoDBService.DescribeMongodbAccount(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_mongodb_account MongoDBService.DescribeMongodbAccount Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("account_name", object["AccountName"]) + d.Set("instance_id", object["DBInstanceId"]) + d.Set("account_description", object["AccountDescription"]) + d.Set("status", object["AccountStatus"]) + return nil +} +func resourceAlicloudMongodbAccountUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + MongoDBService := MongoDBService{client} + var response map[string]interface{} + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Partial(true) + + if d.HasChange("account_description") { + request := map[string]interface{}{ + "AccountName": parts[1], + "DBInstanceId": parts[0], + } + if v, ok := d.GetOk("account_description"); ok { + request["AccountDescription"] = v + } + action := "ModifyAccountDescription" + conn, err := client.NewDdsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-12-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Available"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, MongoDBService.MongodbAccountStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + d.SetPartial("account_description") + } + + if !d.IsNewResource() && d.HasChange("account_password") { + request := map[string]interface{}{ + "AccountName": parts[1], + "DBInstanceId": parts[0], + } + request["AccountPassword"] = d.Get("account_password") + action := "ResetAccountPassword" + conn, err := client.NewDdsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-12-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Available"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, MongoDBService.MongodbAccountStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + d.SetPartial("account_password") + } + + d.Partial(false) + return resourceAlicloudMongodbAccountRead(d, meta) +} +func resourceAlicloudMongodbAccountDelete(d *schema.ResourceData, meta interface{}) error { + log.Printf("[WARN] Cannot destroy resource Alicloud Mongodb Account. Terraform will remove this resource from the state file, however resources may remain.") + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_mongodb_audit_policy.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_mongodb_audit_policy.go new file mode 100644 index 00000000000..651e0140e4b --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_mongodb_audit_policy.go @@ -0,0 +1,151 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudMongodbAuditPolicy() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudMongodbAuditPolicyCreate, + Read: resourceAlicloudMongodbAuditPolicyRead, + Update: resourceAlicloudMongodbAuditPolicyUpdate, + Delete: resourceAlicloudMongodbAuditPolicyDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "db_instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "audit_status": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"disabled", "enable"}, false), + }, + "storage_period": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validation.IntBetween(1, 30), + }, + }, + } +} + +func resourceAlicloudMongodbAuditPolicyCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "ModifyAuditPolicy" + request := make(map[string]interface{}) + conn, err := client.NewDdsClient() + if err != nil { + return WrapError(err) + } + request["DBInstanceId"] = d.Get("db_instance_id") + request["AuditStatus"] = d.Get("audit_status") + if v, ok := d.GetOk("storage_period"); ok { + request["StoragePeriod"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-12-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_mongodb_audit_policy", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["DBInstanceId"])) + + return resourceAlicloudMongodbAuditPolicyRead(d, meta) +} +func resourceAlicloudMongodbAuditPolicyRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + MongoDBService := MongoDBService{client} + object, err := MongoDBService.DescribeMongodbAuditPolicy(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_mongodb_audit_policy MongoDBService.DescribeMongodbAuditPolicy Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + + d.Set("db_instance_id", d.Id()) + d.Set("audit_status", convertMongodbAuditPolicyResponse(object["LogAuditStatus"].(string))) + return nil +} +func resourceAlicloudMongodbAuditPolicyUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "DBInstanceId": d.Id(), + } + request["AuditStatus"] = d.Get("audit_status") + if d.HasChange("audit_status") { + update = true + } + if v, ok := d.GetOk("storage_period"); ok { + request["StoragePeriod"] = v + update = true + } + if update { + action := "ModifyAuditPolicy" + conn, err := client.NewDdsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-12-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + + return resourceAlicloudMongodbAuditPolicyRead(d, meta) +} +func resourceAlicloudMongodbAuditPolicyDelete(d *schema.ResourceData, meta interface{}) error { + log.Printf("[WARN] Cannot destroy resource Alicloud Mongodb AuditPolicy. Terraform will remove this resource from the state file, however resources may remain.") + return nil +} + +func convertMongodbAuditPolicyResponse(source string) string { + switch source { + case "Enable": + return "enable" + case "Disabled": + return "disabled" + } + + return source +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_mongodb_instance.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_mongodb_instance.go index 8f326351684..d723a01d8ce 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_mongodb_instance.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_mongodb_instance.go @@ -163,11 +163,56 @@ func resourceAlicloudMongoDBInstance() *schema.Resource { Optional: true, Computed: true, }, + "order_type": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"UPGRADE", "DOWNGRADE"}, false), + }, "ssl_status": { Type: schema.TypeString, Computed: true, }, "tags": tagsSchema(), + "replica_sets": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "vswitch_id": { + Type: schema.TypeString, + Computed: true, + }, + "connection_port": { + Type: schema.TypeString, + Computed: true, + }, + "replica_set_role": { + Type: schema.TypeString, + Computed: true, + }, + "connection_domain": { + Type: schema.TypeString, + Computed: true, + }, + "vpc_cloud_instance_id": { + Type: schema.TypeString, + Computed: true, + }, + "network_type": { + Type: schema.TypeString, + Computed: true, + }, + "vpc_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "auto_renew": { + Type: schema.TypeBool, + Optional: true, + }, }, } } @@ -238,6 +283,9 @@ func buildMongoDBCreateRequest(d *schema.ResourceData, meta interface{}) (*dds.C request.SecurityIPList = strings.Join(expandStringList(d.Get("security_ip_list").(*schema.Set).List())[:], COMMA_SEPARATED) } + if v, ok := d.GetOk("auto_renew"); ok { + request.AutoRenew = strconv.FormatBool(v.(bool)) + } request.ClientToken = buildClientToken(request.GetActionName()) return request, nil } @@ -261,9 +309,7 @@ func resourceAlicloudMongoDBInstanceCreate(d *schema.ResourceData, meta interfac addDebug(request.GetActionName(), raw, request.RpcRequest, request) response, _ := raw.(*dds.CreateDBInstanceResponse) - d.SetId(response.DBInstanceId) - stateConf := BuildStateConf([]string{"Creating"}, []string{"Running"}, d.Timeout(schema.TimeoutCreate), 1*time.Minute, ddsService.RdsMongodbDBInstanceStateRefreshFunc(d.Id(), []string{"Deleting"})) if _, err := stateConf.WaitForState(); err != nil { return WrapError(err) @@ -285,6 +331,21 @@ func resourceAlicloudMongoDBInstanceRead(d *schema.ResourceData, meta interface{ return WrapError(err) } + if len(instance.ReplicaSets.ReplicaSet) > 0 { + replicaSets := make([]map[string]interface{}, 0) + for _, v := range instance.ReplicaSets.ReplicaSet { + replicaSets = append(replicaSets, map[string]interface{}{ + "vswitch_id": v.VSwitchId, + "connection_port": v.ConnectionPort, + "replica_set_role": v.ReplicaSetRole, + "connection_domain": v.ConnectionDomain, + "vpc_cloud_instance_id": v.VPCCloudInstanceId, + "network_type": v.NetworkType, + "vpc_id": v.VPCId, + }) + } + d.Set("replica_sets", replicaSets) + } backupPolicy, err := ddsService.DescribeMongoDBBackupPolicy(d.Id()) if err != nil { return WrapError(err) @@ -359,6 +420,9 @@ func resourceAlicloudMongoDBInstanceUpdate(d *schema.ResourceData, meta interfac prePaidRequest.InstanceId = d.Id() prePaidRequest.AutoPay = requests.NewBoolean(true) prePaidRequest.Period = requests.NewInteger(d.Get("period").(int)) + if v, ok := d.GetOk("auto_renew"); ok { + prePaidRequest.AutoRenew = strconv.FormatBool(v.(bool)) + } raw, err := client.WithDdsClient(func(client *dds.Client) (interface{}, error) { return client.TransformToPrePaid(prePaidRequest) }) @@ -520,6 +584,11 @@ func resourceAlicloudMongoDBInstanceUpdate(d *schema.ResourceData, meta interfac } addDebug(request.GetActionName(), raw, request.RpcRequest, request) d.SetPartial("ssl_action") + // wait instance status is running after modifying + stateConf := BuildStateConf([]string{"SSLModifying"}, []string{"Running"}, d.Timeout(schema.TimeoutUpdate), 0, ddsService.RdsMongodbDBInstanceStateRefreshFunc(d.Id(), []string{"Deleting"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapError(err) + } } if d.HasChange("db_instance_storage") || @@ -529,6 +598,11 @@ func resourceAlicloudMongoDBInstanceUpdate(d *schema.ResourceData, meta interfac request := dds.CreateModifyDBInstanceSpecRequest() request.DBInstanceId = d.Id() + if d.Get("instance_charge_type").(string) == "PrePaid" { + if v, ok := d.GetOk("order_type"); ok { + request.OrderType = v.(string) + } + } request.DBInstanceClass = d.Get("db_instance_class").(string) request.DBInstanceStorage = strconv.Itoa(d.Get("db_instance_storage").(int)) request.ReplicationFactor = strconv.Itoa(d.Get("replication_factor").(int)) @@ -566,6 +640,11 @@ func resourceAlicloudMongoDBInstanceUpdate(d *schema.ResourceData, meta interfac } func resourceAlicloudMongoDBInstanceDelete(d *schema.ResourceData, meta interface{}) error { + // Pre paid instance can not be release. + if d.Get("instance_charge_type").(string) == string(PrePaid) { + log.Printf("[WARN] Cannot destroy resourceAlicloudMongoDBInstance. Terraform will remove this resource from the state file, however resources may remain.") + return nil + } client := meta.(*connectivity.AliyunClient) ddsService := MongoDBService{client} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_mongodb_serverless_instance.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_mongodb_serverless_instance.go new file mode 100644 index 00000000000..6e6b7adc76b --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_mongodb_serverless_instance.go @@ -0,0 +1,474 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudMongodbServerlessInstance() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudMongodbServerlessInstanceCreate, + Read: resourceAlicloudMongodbServerlessInstanceRead, + Update: resourceAlicloudMongodbServerlessInstanceUpdate, + Delete: resourceAlicloudMongodbServerlessInstanceDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(10 * time.Minute), + Update: schema.DefaultTimeout(10 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "account_password": { + Type: schema.TypeString, + Required: true, + Sensitive: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`[a-zA-Z!#$%^&*()_+-=]{8,32}`), "account_password must consist of uppercase letters, lowercase letters, numbers, and special characters"), + }, + "auto_renew": { + Type: schema.TypeBool, + Optional: true, + }, + "capacity_unit": { + Type: schema.TypeInt, + Required: true, + ValidateFunc: validation.IntBetween(100, 8000), + }, + "db_instance_description": { + Type: schema.TypeString, + Optional: true, + }, + "db_instance_storage": { + Type: schema.TypeInt, + Required: true, + ValidateFunc: validation.IntBetween(1, 100), + }, + "engine": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"MongoDB"}, false), + }, + "engine_version": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"4.2"}, false), + }, + "maintain_end_time": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "maintain_start_time": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "period": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validation.IntInSlice([]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24, 36}), + }, + "period_price_type": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"Day", "Month"}, false), + }, + "resource_group_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Computed: true, + }, + "security_ip_groups": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "security_ip_group_attribute": { + Type: schema.TypeString, + Optional: true, + }, + "security_ip_group_name": { + Type: schema.TypeString, + Optional: true, + }, + "security_ip_list": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "storage_engine": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"WiredTiger"}, false), + }, + "tags": tagsSchema(), + "vswitch_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "zone_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "vpc_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudMongodbServerlessInstanceCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateServerlessDBInstance" + request := make(map[string]interface{}) + conn, err := client.NewDdsClient() + if err != nil { + return WrapError(err) + } + request["AccountPassword"] = d.Get("account_password") + if v, ok := d.GetOkExists("auto_renew"); ok { + request["AutoRenew"] = v + } + if v, ok := d.GetOk("db_instance_description"); ok { + request["DBInstanceDescription"] = v + } + request["DBInstanceStorage"] = d.Get("db_instance_storage") + request["CapacityUnit"] = d.Get("capacity_unit") + if v, ok := d.GetOk("engine"); ok { + request["Engine"] = v + } + request["EngineVersion"] = d.Get("engine_version") + if v, ok := d.GetOk("period"); ok { + request["Period"] = v + } + if v, ok := d.GetOk("period_price_type"); ok { + request["PeriodPriceType"] = v + } + if v, ok := d.GetOk("resource_group_id"); ok { + request["ResourceGroupId"] = v + } + if v, ok := d.GetOk("storage_engine"); ok { + request["StorageEngine"] = v + } + request["ZoneId"] = d.Get("zone_id") + request["VpcId"] = d.Get("vpc_id") + request["VSwitchId"] = d.Get("vswitch_id") + request["RegionId"] = client.RegionId + request["ClientToken"] = buildClientToken("CreateServerlessDBInstance") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-12-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_mongodb_serverless_instance", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["DBInstanceId"])) + MongoDBService := MongoDBService{client} + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, MongoDBService.MongodbServerlessInstanceStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudMongodbServerlessInstanceUpdate(d, meta) +} +func resourceAlicloudMongodbServerlessInstanceRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + mongoDBService := MongoDBService{client} + object, err := mongoDBService.DescribeMongodbServerlessInstance(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_mongodb_serverless_instance MongoDBService.DescribeMongodbServerlessInstance Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("capacity_unit", formatInt(object["CapacityUnit"])) + d.Set("db_instance_description", object["DBInstanceDescription"]) + if v, ok := object["DBInstanceStorage"]; ok && fmt.Sprint(v) != "0" { + d.Set("db_instance_storage", formatInt(v)) + } + d.Set("engine", object["Engine"]) + d.Set("engine_version", object["EngineVersion"]) + d.Set("maintain_end_time", object["MaintainEndTime"]) + d.Set("maintain_start_time", object["MaintainStartTime"]) + d.Set("resource_group_id", object["ResourceGroupId"]) + d.Set("status", object["DBInstanceStatus"]) + d.Set("storage_engine", convertMongodbServerlessInstanceStorageEngineResponse(object["StorageEngine"].(string))) + + listTagResourcesObject, err := mongoDBService.ListTagResources(d.Id(), "INSTANCE") + if err != nil { + return WrapError(err) + } + d.Set("tags", tagsToMap(listTagResourcesObject)) + d.Set("vswitch_id", object["VSwitchId"]) + d.Set("zone_id", object["ZoneId"]) + d.Set("vpc_id", object["VPCId"]) + securityIpGroupsObject, err := mongoDBService.DescribeSecurityIps(d.Id()) + if err != nil { + return WrapError(err) + } + if securityIpGroupsMap, ok := securityIpGroupsObject["SecurityIpGroups"].(map[string]interface{}); ok && securityIpGroupsMap != nil { + if securityIpGroup, ok := securityIpGroupsMap["SecurityIpGroup"]; ok && securityIpGroup != nil { + securityIpGroupMaps := make([]map[string]interface{}, 0) + for _, iPArrayListItem := range securityIpGroup.([]interface{}) { + if v, ok := iPArrayListItem.(map[string]interface{}); ok { + if v["SecurityIpGroupName"].(string) == "default" { + continue + } + iPArrayListItemMap := make(map[string]interface{}) + iPArrayListItemMap["security_ip_group_attribute"] = v["SecurityIpGroupAttribute"] + iPArrayListItemMap["security_ip_group_name"] = v["SecurityIpGroupName"] + iPArrayListItemMap["security_ip_list"] = v["SecurityIpList"] + securityIpGroupMaps = append(securityIpGroupMaps, iPArrayListItemMap) + } + } + d.Set("security_ip_groups", securityIpGroupMaps) + } + } + return nil +} +func resourceAlicloudMongodbServerlessInstanceUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + MongoDBService := MongoDBService{client} + var response map[string]interface{} + d.Partial(true) + if d.HasChange("tags") { + if err := MongoDBService.SetResourceTags(d, "INSTANCE"); err != nil { + return WrapError(err) + } + } + if !d.IsNewResource() && d.HasChange("db_instance_description") { + request := map[string]interface{}{ + "DBInstanceId": d.Id(), + } + if v, ok := d.GetOk("db_instance_description"); ok { + request["DBInstanceDescription"] = v + } + action := "ModifyDBInstanceDescription" + conn, err := client.NewDdsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-12-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("db_instance_description") + } + if d.HasChange("maintain_end_time") || d.HasChange("maintain_start_time") { + request := map[string]interface{}{ + "DBInstanceId": d.Id(), + } + request["MaintainStartTime"] = d.Get("maintain_start_time") + request["MaintainEndTime"] = d.Get("maintain_end_time") + action := "ModifyDBInstanceMaintainTime" + conn, err := client.NewDdsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-12-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("maintain_end_time") + d.SetPartial("maintain_start_time") + } + if d.HasChange("security_ip_groups") { + oraw, nraw := d.GetChange("security_ip_groups") + remove := oraw.(*schema.Set).Difference(nraw.(*schema.Set)).List() + create := nraw.(*schema.Set).Difference(oraw.(*schema.Set)).List() + if len(remove) > 0 { + removeSecurityIpsReq := map[string]interface{}{ + "DBInstanceId": d.Id(), + "ModifyMode": "Delete", + } + for _, whiteList := range remove { + whiteListArg := whiteList.(map[string]interface{}) + removeSecurityIpsReq["SecurityIpGroupAttribute"] = whiteListArg["security_ip_group_attribute"] + removeSecurityIpsReq["SecurityIpGroupName"] = whiteListArg["security_ip_group_name"] + removeSecurityIpsReq["SecurityIps"] = whiteListArg["security_ip_list"] + + action := "ModifySecurityIps" + conn, err := client.NewDdsClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-12-01"), StringPointer("AK"), nil, removeSecurityIpsReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, removeSecurityIpsReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + } + if len(create) > 0 { + createSecurityIpsReq := map[string]interface{}{ + "DBInstanceId": d.Id(), + "ModifyMode": "Append", + } + for _, whiteList := range create { + whiteListArg := whiteList.(map[string]interface{}) + createSecurityIpsReq["SecurityIpGroupAttribute"] = whiteListArg["security_ip_group_attribute"] + createSecurityIpsReq["SecurityIpGroupName"] = whiteListArg["security_ip_group_name"] + createSecurityIpsReq["SecurityIps"] = whiteListArg["security_ip_list"] + + action := "ModifySecurityIps" + conn, err := client.NewDdsClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-12-01"), StringPointer("AK"), nil, createSecurityIpsReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, createSecurityIpsReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + } + d.SetPartial("security_ip_groups") + } + if !d.IsNewResource() && (d.HasChange("db_instance_storage") || d.HasChange("capacity_unit")) { + request := map[string]interface{}{ + "DBInstanceId": d.Id(), + } + if v, ok := d.GetOk("capacity_unit"); ok { + request["DBInstanceClass"] = v + } + if v, ok := d.GetOk("db_instance_storage"); ok { + request["DBInstanceStorage"] = v + } + action := "ModifyDBInstanceSpec" + conn, err := client.NewDdsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-12-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, MongoDBService.MongodbServerlessInstanceStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + d.SetPartial("capacity_unit") + d.SetPartial("db_instance_storage") + } + d.Partial(false) + + return resourceAlicloudMongodbServerlessInstanceRead(d, meta) +} +func resourceAlicloudMongodbServerlessInstanceDelete(d *schema.ResourceData, meta interface{}) error { + log.Printf("[WARN] Cannot destroy resource Alicloud Resource Mongodb Serverless Subscription Instance. Terraform will remove this resource from the state file, however resources may remain.") + return nil +} + +func convertMongodbServerlessInstancePayTypeResponse(source string) string { + switch source { + case "PrePaid": + return "Subscription" + } + return source +} + +func convertMongodbServerlessInstanceStorageEngineResponse(source string) string { + switch source { + case "wiredTiger": + return "WiredTiger" + } + return source +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_mongodb_sharding_instance.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_mongodb_sharding_instance.go index 9449140e977..9ddbdbd1f5d 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_mongodb_sharding_instance.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_mongodb_sharding_instance.go @@ -1,6 +1,7 @@ package alicloud import ( + "log" "strconv" "strings" "time" @@ -47,7 +48,6 @@ func resourceAlicloudMongoDBShardingInstance() *schema.Resource { Type: schema.TypeString, ValidateFunc: validation.StringInSlice([]string{string(PrePaid), string(PostPaid)}, false), Optional: true, - ForceNew: true, Computed: true, }, "period": { @@ -122,7 +122,6 @@ func resourceAlicloudMongoDBShardingInstance() *schema.Resource { Optional: true, Computed: true, }, - //Computed "retention_period": { Type: schema.TypeInt, Computed: true, @@ -184,7 +183,56 @@ func resourceAlicloudMongoDBShardingInstance() *schema.Resource { MinItems: 2, MaxItems: 32, }, + "order_type": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"UPGRADE", "DOWNGRADE"}, false), + }, "tags": tagsSchema(), + "auto_renew": { + Type: schema.TypeBool, + Optional: true, + }, + "config_server_list": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "max_iops": { + Type: schema.TypeInt, + Computed: true, + }, + "connect_string": { + Type: schema.TypeString, + Computed: true, + }, + "node_class": { + Type: schema.TypeString, + Computed: true, + }, + "max_connections": { + Type: schema.TypeInt, + Computed: true, + }, + "port": { + Type: schema.TypeInt, + Computed: true, + }, + "node_description": { + Type: schema.TypeString, + Computed: true, + }, + "node_id": { + Type: schema.TypeString, + Computed: true, + }, + "node_storage": { + Type: schema.TypeInt, + Computed: true, + }, + }, + }, + }, }, } } @@ -223,7 +271,7 @@ func buildMongoDBShardingCreateRequest(d *schema.ResourceData, meta interface{}) } class := item["node_class"].(string) nodeStorage := item["node_storage"].(int) - replicaSets = append(replicaSets, dds.CreateShardingDBInstanceReplicaSet{strconv.Itoa(readonlyReplicas), strconv.Itoa(nodeStorage), class}) + replicaSets = append(replicaSets, dds.CreateShardingDBInstanceReplicaSet{ReadonlyReplicas: strconv.Itoa(readonlyReplicas), Storage: strconv.Itoa(nodeStorage), Class: class}) } request.ReplicaSet = &replicaSets } @@ -234,12 +282,12 @@ func buildMongoDBShardingCreateRequest(d *schema.ResourceData, meta interface{}) for _, rew := range mongoList.([]interface{}) { item := rew.(map[string]interface{}) class := item["node_class"].(string) - mongos = append(mongos, dds.CreateShardingDBInstanceMongos{class}) + mongos = append(mongos, dds.CreateShardingDBInstanceMongos{Class: class}) } request.Mongos = &mongos } - request.ConfigServer = &[]dds.CreateShardingDBInstanceConfigServer{{"20", "dds.cs.mid"}} + request.ConfigServer = &[]dds.CreateShardingDBInstanceConfigServer{{Storage: "20", Class: "dds.cs.mid"}} request.NetworkType = string(Classic) vswitchId := Trim(d.Get("vswitch_id").(string)) @@ -276,6 +324,9 @@ func buildMongoDBShardingCreateRequest(d *schema.ResourceData, meta interface{}) if len(d.Get("security_ip_list").(*schema.Set).List()) > 0 { request.SecurityIPList = strings.Join(expandStringList(d.Get("security_ip_list").(*schema.Set).List()), COMMA_SEPARATED) } + if v, ok := d.GetOk("auto_renew"); ok { + request.AutoRenew = strconv.FormatBool(v.(bool)) + } request.ClientToken = buildClientToken(request.GetActionName()) return request, nil @@ -396,6 +447,22 @@ func resourceAlicloudMongoDBShardingInstanceRead(d *schema.ResourceData, meta in } d.Set("tags", ddsService.tagsInAttributeToMap(instance.Tags.Tag)) + + configServerSets := make([]map[string]interface{}, 0) + for _, v := range instance.ConfigserverList.ConfigserverAttribute { + configServerSets = append(configServerSets, map[string]interface{}{ + "max_iops": v.MaxIOPS, + "connect_string": v.ConnectString, + "node_class": v.NodeClass, + "max_connections": v.MaxConnections, + "port": v.Port, + "node_description": v.NodeDescription, + "node_id": v.NodeId, + "node_storage": v.NodeStorage, + }) + } + err = d.Set("config_server_list", configServerSets) + return nil } @@ -461,7 +528,7 @@ func resourceAlicloudMongoDBShardingInstanceUpdate(d *schema.ResourceData, meta if d.IsNewResource() { d.Partial(false) - return resourceAlicloudMongoDBInstanceRead(d, meta) + return resourceAlicloudMongoDBShardingInstanceRead(d, meta) } if d.HasChange("shard_list") { @@ -534,11 +601,38 @@ func resourceAlicloudMongoDBShardingInstanceUpdate(d *schema.ResourceData, meta } d.SetPartial("security_ip_list") } + if !d.IsNewResource() && (d.HasChange("instance_charge_type") && d.Get("instance_charge_type").(string) == "PrePaid") { + prePaidRequest := dds.CreateTransformToPrePaidRequest() + prePaidRequest.InstanceId = d.Id() + prePaidRequest.AutoPay = requests.NewBoolean(true) + prePaidRequest.Period = requests.NewInteger(d.Get("period").(int)) + if v, ok := d.GetOk("auto_renew"); ok { + prePaidRequest.AutoRenew = strconv.FormatBool(v.(bool)) + } + raw, err := client.WithDdsClient(func(client *dds.Client) (interface{}, error) { + return client.TransformToPrePaid(prePaidRequest) + }) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), prePaidRequest.GetActionName(), AlibabaCloudSdkGoERROR) + } + addDebug(prePaidRequest.GetActionName(), raw, prePaidRequest.RpcRequest, prePaidRequest) + // wait instance status is running after modifying + stateConf := BuildStateConf([]string{"DBInstanceClassChanging", "DBInstanceNetTypeChanging"}, []string{"Running"}, d.Timeout(schema.TimeoutUpdate), 0, ddsService.RdsMongodbDBInstanceStateRefreshFunc(d.Id(), []string{"Deleting"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapError(err) + } + d.SetPartial("instance_charge_type") + d.SetPartial("period") + } d.Partial(false) return resourceAlicloudMongoDBShardingInstanceRead(d, meta) } func resourceAlicloudMongoDBShardingInstanceDelete(d *schema.ResourceData, meta interface{}) error { + if d.Get("instance_charge_type").(string) == string(PrePaid) { + log.Printf("[WARN] Cannot destroy resourceAlicloudMongoDBShardingInstance. Terraform will remove this resource from the state file, however resources may remain.") + return nil + } client := meta.(*connectivity.AliyunClient) ddsService := MongoDBService{client} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_mongodb_sharding_network_public_address.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_mongodb_sharding_network_public_address.go new file mode 100644 index 00000000000..4ac1a1aab3c --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_mongodb_sharding_network_public_address.go @@ -0,0 +1,210 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudMongodbShardingNetworkPublicAddress() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudMongodbShardingNetworkPublicAddressCreate, + Read: resourceAlicloudMongodbShardingNetworkPublicAddressRead, + Delete: resourceAlicloudMongodbShardingNetworkPublicAddressDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(5 * time.Minute), + Delete: schema.DefaultTimeout(5 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "db_instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "node_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "network_address": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "expired_time": { + Type: schema.TypeString, + Computed: true, + }, + "ip_address": { + Type: schema.TypeString, + Computed: true, + }, + "network_address": { + Type: schema.TypeString, + Computed: true, + }, + "network_type": { + Type: schema.TypeString, + Computed: true, + }, + "node_id": { + Type: schema.TypeString, + Computed: true, + }, + "node_type": { + Type: schema.TypeString, + Computed: true, + }, + "port": { + Type: schema.TypeString, + Computed: true, + }, + "role": { + Type: schema.TypeString, + Computed: true, + }, + "vpc_id": { + Type: schema.TypeString, + Computed: true, + }, + "vswitch_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func resourceAlicloudMongodbShardingNetworkPublicAddressCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "AllocatePublicNetworkAddress" + request := make(map[string]interface{}) + conn, err := client.NewDdsClient() + if err != nil { + return WrapError(err) + } + request["DBInstanceId"] = d.Get("db_instance_id") + request["NodeId"] = d.Get("node_id") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-12-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_mongodb_sharding_network_public_address", action, AlibabaCloudSdkGoERROR) + } + d.SetId(fmt.Sprint(request["DBInstanceId"], ":", request["NodeId"])) + + MongoDBService := MongoDBService{client} + nodeType, err := MongoDBService.DescribeShardingNodeType(d.Id()) + if err != nil { + return WrapError(err) + } + + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, MongoDBService.MongodbShardingNetworkPublicAddressStateRefreshFunc(d.Id(), nodeType, []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudMongodbShardingNetworkPublicAddressRead(d, meta) +} +func resourceAlicloudMongodbShardingNetworkPublicAddressRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + MongoDBService := MongoDBService{client} + object, err := MongoDBService.DescribeMongodbShardingNetworkPublicAddress(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_mongodb_sharding_network_public_address MongoDBService.DescribeMongodbShardingNetworkPublicAddress Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Set("db_instance_id", parts[0]) + d.Set("node_id", parts[1]) + s := make([]map[string]interface{}, 0) + for _, item := range object["NetworkAddress"].([]map[string]interface{}) { + mapping := map[string]interface{}{ + "expired_time": item["ExpiredTime"], + "ip_address": item["IPAddress"], + "network_address": item["NetworkAddress"], + "network_type": item["NetworkType"], + "node_type": item["NodeType"], + "port": item["Port"], + "role": item["Role"], + "vpc_id": item["VPCId"], + "vswitch_id": item["VswitchId"], + "node_id": parts[1], + } + s = append(s, mapping) + } + d.Set("network_address", s) + return nil +} +func resourceAlicloudMongodbShardingNetworkPublicAddressDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + action := "ReleasePublicNetworkAddress" + var response map[string]interface{} + conn, err := client.NewDdsClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "DBInstanceId": parts[0], + "NodeId": parts[1], + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-12-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + MongoDBService := MongoDBService{client} + nodeType, err := MongoDBService.DescribeShardingNodeType(d.Id()) + if err != nil { + return WrapError(err) + } + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutDelete), 5*time.Second, MongoDBService.MongodbShardingNetworkPublicAddressStateRefreshFunc(d.Id(), nodeType, []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_msc_sub_contact.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_msc_sub_contact.go index daba8ab083f..f26ff6eaedb 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_msc_sub_contact.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_msc_sub_contact.go @@ -26,7 +26,7 @@ func resourceAlicloudMscSubContact() *schema.Resource { "contact_name": { Type: schema.TypeString, Required: true, - ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-zA-Z]{2,12}$`), "The name must be 2 to 12 characters in length, and can contain uppercase and lowercase letters."), + ValidateFunc: validation.StringMatch(regexp.MustCompile("^[\u4E00-\u9FA5a-zA-Z]{2,12}$"), "The name must be 2 to 12 characters in length."), }, "email": { Type: schema.TypeString, @@ -41,6 +41,7 @@ func resourceAlicloudMscSubContact() *schema.Resource { "position": { Type: schema.TypeString, Required: true, + ForceNew: true, ValidateFunc: validation.StringInSlice([]string{"CEO", "Finance Director", "Maintenance Director", "Other", "Project Director", "Technical Director"}, false), }, }, @@ -61,6 +62,7 @@ func resourceAlicloudMscSubContactCreate(d *schema.ResourceData, meta interface{ request["Mobile"] = d.Get("mobile") request["Position"] = d.Get("position") request["ClientToken"] = buildClientToken("CreateContact") + request["Locale"] = "en" runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) @@ -102,7 +104,7 @@ func resourceAlicloudMscSubContactRead(d *schema.ResourceData, meta interface{}) d.Set("contact_name", object["ContactName"]) d.Set("email", object["Email"]) d.Set("mobile", object["Mobile"]) - d.Set("position", object["Position"]) + d.Set("position", convertMscSubContactPositionResponse(fmt.Sprint(object["Position"]))) return nil } func resourceAlicloudMscSubContactUpdate(d *schema.ResourceData, meta interface{}) error { @@ -191,3 +193,11 @@ func resourceAlicloudMscSubContactDelete(d *schema.ResourceData, meta interface{ } return nil } + +func convertMscSubContactPositionResponse(source string) string { + switch source { + case "Others": + return "Other" + } + return source +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_msc_sub_subscription.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_msc_sub_subscription.go new file mode 100644 index 00000000000..e79adf2a558 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_msc_sub_subscription.go @@ -0,0 +1,240 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudMscSubSubscription() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudMscSubSubscriptionCreate, + Read: resourceAlicloudMscSubSubscriptionRead, + Update: resourceAlicloudMscSubSubscriptionUpdate, + Delete: resourceAlicloudMscSubSubscriptionDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "channel": { + Type: schema.TypeString, + Computed: true, + }, + "contact_ids": { + Type: schema.TypeList, + Optional: true, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "email_status": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validation.IntInSlice([]int{-1, -2, 0, 1}), + }, + "item_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "pmsg_status": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validation.IntInSlice([]int{-1, -2, 0, 1}), + }, + "sms_status": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validation.IntInSlice([]int{-1, -2, 0, 1}), + }, + "tts_status": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validation.IntInSlice([]int{-1, -2, 0, 1}), + }, + "webhook_ids": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "webhook_status": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validation.IntInSlice([]int{-1, -2, 0, 1}), + }, + }, + } +} + +func resourceAlicloudMscSubSubscriptionCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateSubscriptionItem" + request := make(map[string]interface{}) + conn, err := client.NewMscopensubscriptionClient() + if err != nil { + return WrapError(err) + } + request["ItemName"] = d.Get("item_name") + request["Locale"] = "en" + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-07-13"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_msc_sub_subscription", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + responseSubscriptionItem := response["SubscriptionItem"].(map[string]interface{}) + d.SetId(fmt.Sprint(responseSubscriptionItem["ItemId"])) + + return resourceAlicloudMscSubSubscriptionUpdate(d, meta) +} +func resourceAlicloudMscSubSubscriptionRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + mscOpenSubscriptionService := MscOpenSubscriptionService{client} + object, err := mscOpenSubscriptionService.DescribeMscSubSubscription(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_msc_sub_subscription mscOpenSubscriptionService.DescribeMscSubSubscription Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("channel", object["Channel"]) + + if contactIds, ok := object["ContactIds"]; ok && contactIds != nil { + d.Set("contact_ids", convertJsonStringToStringList(contactIds)) + } + d.Set("description", object["Description"]) + if v, ok := object["EmailStatus"]; ok { + d.Set("email_status", formatInt(v)) + } + d.Set("item_name", object["ItemName"]) + if v, ok := object["PmsgStatus"]; ok { + d.Set("pmsg_status", formatInt(v)) + } + if v, ok := object["SmsStatus"]; ok { + d.Set("sms_status", formatInt(v)) + } + if v, ok := object["TtsStatus"]; ok { + d.Set("tts_status", formatInt(v)) + } + + if webhookIds, ok := object["WebhookIds"]; ok && webhookIds != nil { + d.Set("webhook_ids", convertJsonStringToStringList(webhookIds)) + } + if v, ok := object["WebhookStatus"]; ok { + d.Set("webhook_status", formatInt(v)) + } + return nil +} +func resourceAlicloudMscSubSubscriptionUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "ItemId": d.Id(), + } + if d.HasChange("email_status") { + update = true + } + if v, ok := d.GetOkExists("email_status"); ok { + request["EmailStatus"] = v + } + if d.HasChange("pmsg_status") { + update = true + } + if v, ok := d.GetOkExists("pmsg_status"); ok { + request["PmsgStatus"] = v + } + if d.HasChange("sms_status") { + update = true + } + if v, ok := d.GetOkExists("sms_status"); ok { + request["SmsStatus"] = v + } + if d.HasChange("tts_status") { + update = true + } + if v, ok := d.GetOkExists("tts_status"); ok { + request["TtsStatus"] = v + } + if d.HasChange("webhook_status") { + update = true + } + if v, ok := d.GetOkExists("webhook_status"); ok { + request["WebhookStatus"] = v + } + if d.HasChange("contact_ids") { + update = true + if v, ok := d.GetOk("contact_ids"); ok { + request["ContactIds"] = convertListToJsonString(v.([]interface{})) + } + } + request["Locale"] = "en" + request["RegionId"] = client.RegionId + if d.HasChange("webhook_ids") { + update = true + if v, ok := d.GetOk("webhook_ids"); ok { + request["WebhookIds"] = convertListToJsonString(v.([]interface{})) + } + } + + if update { + action := "UpdateSubscriptionItem" + conn, err := client.NewMscopensubscriptionClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("UpdateSubscriptionItem") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-07-13"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + } + + return resourceAlicloudMscSubSubscriptionRead(d, meta) +} +func resourceAlicloudMscSubSubscriptionDelete(d *schema.ResourceData, meta interface{}) error { + log.Printf("[WARN] Cannot destroy resourceAlicloudMscSubSubscription. Terraform will remove this resource from the state file, however resources may remain.") + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_msc_sub_webhook.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_msc_sub_webhook.go new file mode 100644 index 00000000000..987397cb268 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_msc_sub_webhook.go @@ -0,0 +1,179 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudMscSubWebhook() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudMscSubWebhookCreate, + Read: resourceAlicloudMscSubWebhookRead, + Update: resourceAlicloudMscSubWebhookUpdate, + Delete: resourceAlicloudMscSubWebhookDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "server_url": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^https://oapi.dingtalk.com/robot/send\?access_token=[a-zA-Z0-9]+$`), "The serverUrl of the Webhook."), + }, + "webhook_name": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-zA-Z]{2,12}$`), "The name must be 2 to 12 characters in length, and can contain uppercase and lowercase letters."), + }, + }, + } +} + +func resourceAlicloudMscSubWebhookCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateWebhook" + request := make(map[string]interface{}) + conn, err := client.NewMscopensubscriptionClient() + if err != nil { + return WrapError(err) + } + request["Locale"] = "en" + request["ServerUrl"] = d.Get("server_url") + request["WebhookName"] = d.Get("webhook_name") + request["ClientToken"] = buildClientToken("CreateWebhook") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-07-13"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_msc_sub_webhook", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Code"]) != "200" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + + d.SetId(fmt.Sprint(response["WebhookId"])) + + return resourceAlicloudMscSubWebhookRead(d, meta) +} +func resourceAlicloudMscSubWebhookRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + mscOpenSubscriptionService := MscOpenSubscriptionService{client} + object, err := mscOpenSubscriptionService.DescribeMscSubWebhook(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_msc_sub_webhook mscOpenSubscriptionService.DescribeMscSubWebhook Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("server_url", object["ServerUrl"]) + d.Set("webhook_name", object["WebhookName"]) + return nil +} +func resourceAlicloudMscSubWebhookUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "WebhookId": d.Id(), + } + if d.HasChange("server_url") { + update = true + } + request["ServerUrl"] = d.Get("server_url") + if d.HasChange("webhook_name") { + update = true + } + request["WebhookName"] = d.Get("webhook_name") + if update { + request["Locale"] = "en" + action := "UpdateWebhook" + conn, err := client.NewMscopensubscriptionClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("UpdateWebhook") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-07-13"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + } + return resourceAlicloudMscSubWebhookRead(d, meta) +} +func resourceAlicloudMscSubWebhookDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteWebhook" + var response map[string]interface{} + conn, err := client.NewMscopensubscriptionClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "WebhookId": d.Id(), + "Locale": "en", + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-07-13"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"ResourceNotFound"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_nas_auto_snapshot_policy.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_nas_auto_snapshot_policy.go new file mode 100644 index 00000000000..3ac853f9b9a --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_nas_auto_snapshot_policy.go @@ -0,0 +1,222 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "strings" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudNasAutoSnapshotPolicy() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudNasAutoSnapshotPolicyCreate, + Read: resourceAlicloudNasAutoSnapshotPolicyRead, + Update: resourceAlicloudNasAutoSnapshotPolicyUpdate, + Delete: resourceAlicloudNasAutoSnapshotPolicyDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(1 * time.Minute), + Delete: schema.DefaultTimeout(1 * time.Minute), + Update: schema.DefaultTimeout(1 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "auto_snapshot_policy_name": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.All(validation.StringDoesNotMatch(regexp.MustCompile(`(^http://.*)|(^https://.*)`), "It cannot begin with 'http://', 'https://'."), validation.StringMatch(regexp.MustCompile(`^[a-zA-Z][a-zA-Z0-9:_-]{1,127}$`), `The name must start with a letter. It must be 2 to 128 characters in length. It can contain digits, colons (:), underscores (_), and hyphens (-).`)), + }, + "repeat_weekdays": { + Type: schema.TypeSet, + Required: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "retention_days": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + ValidateFunc: validation.Any(validation.IntInSlice([]int{-1}), validation.IntBetween(1, 65536)), + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "time_points": { + Type: schema.TypeSet, + Required: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + }, + } +} + +func resourceAlicloudNasAutoSnapshotPolicyCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateAutoSnapshotPolicy" + request := make(map[string]interface{}) + conn, err := client.NewNasClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("auto_snapshot_policy_name"); ok { + request["AutoSnapshotPolicyName"] = v + } + request["FileSystemType"] = "extreme" + request["RepeatWeekdays"] = convertListToCommaSeparate(d.Get("repeat_weekdays").(*schema.Set).List()) + if v, ok := d.GetOk("retention_days"); ok { + request["RetentionDays"] = v + } + request["TimePoints"] = convertListToCommaSeparate(d.Get("time_points").(*schema.Set).List()) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-06-26"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_nas_auto_snapshot_policy", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["AutoSnapshotPolicyId"])) + nasService := NasService{client} + stateConf := BuildStateConf([]string{}, []string{"Available"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, nasService.NasAutoSnapshotPolicyStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudNasAutoSnapshotPolicyRead(d, meta) +} +func resourceAlicloudNasAutoSnapshotPolicyRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + nasService := NasService{client} + object, err := nasService.DescribeNasAutoSnapshotPolicy(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_nas_auto_snapshot_policy nasService.DescribeNasAutoSnapshotPolicy Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("auto_snapshot_policy_name", object["AutoSnapshotPolicyName"]) + d.Set("repeat_weekdays", strings.Split(object["RepeatWeekdays"].(string), ",")) + d.Set("retention_days", formatInt(object["RetentionDays"])) + d.Set("status", object["Status"]) + d.Set("time_points", strings.Split(object["TimePoints"].(string), ",")) + return nil +} +func resourceAlicloudNasAutoSnapshotPolicyUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + nasService := NasService{client} + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "AutoSnapshotPolicyId": d.Id(), + } + if d.HasChange("auto_snapshot_policy_name") { + update = true + if v, ok := d.GetOk("auto_snapshot_policy_name"); ok { + request["AutoSnapshotPolicyName"] = v + } + } + if d.HasChange("repeat_weekdays") { + update = true + request["RepeatWeekdays"] = convertListToCommaSeparate(d.Get("repeat_weekdays").(*schema.Set).List()) + } + if d.HasChange("retention_days") { + update = true + if v, ok := d.GetOk("retention_days"); ok { + request["RetentionDays"] = v + } + } + if d.HasChange("time_points") { + update = true + request["TimePoints"] = convertListToCommaSeparate(d.Get("time_points").(*schema.Set).List()) + } + if update { + action := "ModifyAutoSnapshotPolicy" + conn, err := client.NewNasClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-06-26"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Available"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, nasService.NasAutoSnapshotPolicyStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + return resourceAlicloudNasAutoSnapshotPolicyRead(d, meta) +} +func resourceAlicloudNasAutoSnapshotPolicyDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + nasService := NasService{client} + action := "DeleteAutoSnapshotPolicy" + var response map[string]interface{} + conn, err := client.NewNasClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "AutoSnapshotPolicyId": d.Id(), + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-06-26"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidLifecyclePolicy.NotFound"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{}, d.Timeout(schema.TimeoutDelete), 5*time.Second, nasService.NasAutoSnapshotPolicyStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_nas_file_system.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_nas_file_system.go index 122ea80afb4..9636513e962 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_nas_file_system.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_nas_file_system.go @@ -21,7 +21,11 @@ func resourceAlicloudNasFileSystem() *schema.Resource { Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, - + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(10 * time.Minute), + Update: schema.DefaultTimeout(10 * time.Minute), + Delete: schema.DefaultTimeout(10 * time.Minute), + }, Schema: map[string]*schema.Schema{ "storage_type": { Type: schema.TypeString, @@ -30,6 +34,10 @@ func resourceAlicloudNasFileSystem() *schema.Resource { ValidateFunc: validation.StringInSlice([]string{ "Capacity", "Performance", + "standard", + "advance", + "advance_100", + "advance_200", }, false), }, "protocol_type": { @@ -39,8 +47,17 @@ func resourceAlicloudNasFileSystem() *schema.Resource { ValidateFunc: validation.StringInSlice([]string{ "NFS", "SMB", + "cpfs", }, false), }, + "vpc_id": { + Type: schema.TypeString, + Optional: true, + }, + "vswitch_id": { + Type: schema.TypeString, + Optional: true, + }, "description": { Type: schema.TypeString, Optional: true, @@ -50,9 +67,33 @@ func resourceAlicloudNasFileSystem() *schema.Resource { Type: schema.TypeInt, Optional: true, ForceNew: true, - ValidateFunc: validation.IntInSlice([]int{0, 1}), + ValidateFunc: validation.IntInSlice([]int{0, 1, 2}), Default: 0, }, + "file_system_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"extreme", "standard", "cpfs"}, false), + Default: "standard", + }, + "capacity": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + }, + "zone_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Computed: true, + }, + "kms_key_id": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "tags": tagsSchema(), }, } } @@ -68,14 +109,32 @@ func resourceAlicloudNasFileSystemCreate(d *schema.ResourceData, meta interface{ } request["RegiondId"] = client.RegionId request["ProtocolType"] = d.Get("protocol_type") + if v, ok := d.GetOk("file_system_type"); ok { + request["FileSystemType"] = v + } request["StorageType"] = d.Get("storage_type") request["EncryptType"] = d.Get("encrypt_type") + if v, ok := d.GetOk("zone_id"); ok { + request["ZoneId"] = v + } + if v, ok := d.GetOk("capacity"); ok { + request["Capacity"] = v + } + if v, ok := d.GetOk("kms_key_id"); ok { + request["KmsKeyId"] = v + } + if v, ok := d.GetOk("vpc_id"); ok { + request["VpcId"] = v + } + if v, ok := d.GetOk("vswitch_id"); ok { + request["VSwitchId"] = v + } wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-06-26"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) if err != nil { - if NeedRetry(err) { + if NeedRetry(err) && IsExpectedErrors(err, []string{InvalidFileSystemStatus_Ordering}) { wait() return resource.RetryableError(err) } @@ -89,16 +148,34 @@ func resourceAlicloudNasFileSystemCreate(d *schema.ResourceData, meta interface{ } d.SetId(fmt.Sprint(response["FileSystemId"])) + // Creating an extreme/cpfs filesystem is asynchronous, so you need to block and wait until the creation is complete + if d.Get("file_system_type") == "extreme" || d.Get("file_system_type") == "cpfs" { + nasService := NasService{client} + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutCreate), 3*time.Second, nasService.DescribeNasFileSystemStateRefreshFunc(d.Id(), "Pending", []string{"Stopped", "Stopping", "Deleting"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } return resourceAlicloudNasFileSystemUpdate(d, meta) } func resourceAlicloudNasFileSystemUpdate(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) + nasService := NasService{client} var response map[string]interface{} request := map[string]interface{}{ "RegionId": client.RegionId, "FileSystemId": d.Id(), } + d.Partial(true) + + if d.HasChange("tags") { + if err := nasService.SetResourceTags(d, "filesystem"); err != nil { + return WrapError(err) + } + d.SetPartial("tags") + } + if d.HasChange("description") { request["Description"] = d.Get("description") action := "ModifyFileSystem" @@ -110,7 +187,7 @@ func resourceAlicloudNasFileSystemUpdate(d *schema.ResourceData, meta interface{ err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-06-26"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) if err != nil { - if NeedRetry(err) { + if NeedRetry(err) && IsExpectedErrors(err, []string{InvalidFileSystemStatus_Ordering}) { wait() return resource.RetryableError(err) } @@ -122,7 +199,9 @@ func resourceAlicloudNasFileSystemUpdate(d *schema.ResourceData, meta interface{ if err != nil { return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) } + d.SetPartial("description") } + d.Partial(false) return resourceAlicloudNasFileSystemRead(d, meta) } @@ -143,6 +222,13 @@ func resourceAlicloudNasFileSystemRead(d *schema.ResourceData, meta interface{}) d.Set("protocol_type", object["ProtocolType"]) d.Set("storage_type", object["StorageType"]) d.Set("encrypt_type", object["EncryptType"]) + d.Set("file_system_type", object["FileSystemType"]) + d.Set("capacity", object["Capacity"]) + d.Set("zone_id", object["ZoneId"]) + d.Set("kms_key_id", object["KMSKeyId"]) + + tagResp, _ := nasService.ListTagResources(d.Id(), "filesystem") + d.Set("tags", tagsToMap(tagResp)) return nil } @@ -162,7 +248,7 @@ func resourceAlicloudNasFileSystemDelete(d *schema.ResourceData, meta interface{ err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-06-26"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) if err != nil { - if NeedRetry(err) { + if NeedRetry(err) && IsExpectedErrors(err, []string{InvalidFileSystemStatus_Ordering}) { wait() return resource.RetryableError(err) } @@ -177,5 +263,13 @@ func resourceAlicloudNasFileSystemDelete(d *schema.ResourceData, meta interface{ } return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) } + + if d.Get("file_system_type") == "cpfs" { + nasService := NasService{client} + stateConf := BuildStateConf([]string{}, []string{}, d.Timeout(schema.TimeoutDelete), 3*time.Second, nasService.DescribeNasFileSystemStateRefreshFunc(d.Id(), "Running", []string{"Pending"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } return nil } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_nas_fileset.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_nas_fileset.go new file mode 100644 index 00000000000..89aa1c6de5a --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_nas_fileset.go @@ -0,0 +1,222 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudNasFileset() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudNasFilesetCreate, + Read: resourceAlicloudNasFilesetRead, + Update: resourceAlicloudNasFilesetUpdate, + Delete: resourceAlicloudNasFilesetDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(2 * time.Minute), + Delete: schema.DefaultTimeout(2 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "description": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.All(validation.StringLenBetween(2, 128), validation.StringDoesNotMatch(regexp.MustCompile(`(^http://.*)|(^https://.*)`), "It cannot begin with \"http://\", \"https://\".")), + }, + "dry_run": { + Type: schema.TypeBool, + Optional: true, + }, + "file_system_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "file_system_path": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "fileset_id": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudNasFilesetCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateFileset" + request := make(map[string]interface{}) + conn, err := client.NewNasClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + request["FileSystemId"] = d.Get("file_system_id") + request["FileSystemPath"] = d.Get("file_system_path") + request["ClientToken"] = buildClientToken("CreateFileset") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-06-26"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_nas_fileset", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["FileSystemId"], ":", response["FsetId"])) + nasService := NasService{client} + stateConf := BuildStateConf([]string{}, []string{"CREATED"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, nasService.NasFilesetStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudNasFilesetRead(d, meta) +} +func resourceAlicloudNasFilesetRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + nasService := NasService{client} + object, err := nasService.DescribeNasFileset(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_nas_fileset nasService.DescribeNasFileset Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Set("file_system_id", parts[0]) + d.Set("fileset_id", parts[1]) + d.Set("description", object["Description"]) + d.Set("file_system_path", object["FileSystemPath"]) + d.Set("status", object["Status"]) + return nil +} +func resourceAlicloudNasFilesetUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "FileSystemId": parts[0], + "FsetId": parts[1], + } + if d.HasChange("description") { + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + } + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + action := "ModifyFileset" + conn, err := client.NewNasClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("ModifyFileset") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-06-26"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return resourceAlicloudNasFilesetRead(d, meta) +} +func resourceAlicloudNasFilesetDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + action := "DeleteFileset" + var response map[string]interface{} + conn, err := client.NewNasClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "FileSystemId": parts[0], + "FsetId": parts[1], + } + + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + request["ClientToken"] = buildClientToken("DeleteFileset") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-06-26"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + nasService := NasService{client} + stateConf := BuildStateConf([]string{}, []string{}, d.Timeout(schema.TimeoutCreate), 5*time.Second, nasService.NasFilesetStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_nas_lifecycle_policy.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_nas_lifecycle_policy.go new file mode 100644 index 00000000000..56a58f404b5 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_nas_lifecycle_policy.go @@ -0,0 +1,190 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudNasLifecyclePolicy() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudNasLifecyclePolicyCreate, + Read: resourceAlicloudNasLifecyclePolicyRead, + Update: resourceAlicloudNasLifecyclePolicyUpdate, + Delete: resourceAlicloudNasLifecyclePolicyDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "file_system_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "lifecycle_policy_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "lifecycle_rule_name": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"DEFAULT_ATIME_14", "DEFAULT_ATIME_30", "DEFAULT_ATIME_60", "DEFAULT_ATIME_90"}, false), + }, + "paths": { + Type: schema.TypeList, + Required: true, + MaxItems: 10, + Elem: &schema.Schema{Type: schema.TypeString}, + ForceNew: true, + }, + "storage_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"InfrequentAccess"}, false), + }, + }, + } +} + +func resourceAlicloudNasLifecyclePolicyCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateLifecyclePolicy" + request := make(map[string]interface{}) + conn, err := client.NewNasClient() + if err != nil { + return WrapError(err) + } + request["FileSystemId"] = d.Get("file_system_id") + request["LifecyclePolicyName"] = d.Get("lifecycle_policy_name") + request["LifecycleRuleName"] = d.Get("lifecycle_rule_name") + request["Paths"] = d.Get("paths") + request["StorageType"] = d.Get("storage_type") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-06-26"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_nas_lifecycle_policy", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["FileSystemId"], ":", request["LifecyclePolicyName"])) + + return resourceAlicloudNasLifecyclePolicyRead(d, meta) +} +func resourceAlicloudNasLifecyclePolicyRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + nasService := NasService{client} + object, err := nasService.DescribeNasLifecyclePolicy(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_nas_lifecycle_policy nasService.DescribeNasLifecyclePolicy Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("file_system_id", object["FileSystemId"]) + d.Set("lifecycle_policy_name", object["LifecyclePolicyName"]) + d.Set("lifecycle_rule_name", object["LifecycleRuleName"]) + d.Set("paths", object["Paths"]) + d.Set("storage_type", object["StorageType"]) + return nil +} +func resourceAlicloudNasLifecyclePolicyUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + update := false + request := map[string]interface{}{ + "FileSystemId": parts[0], + "LifecyclePolicyName": parts[1], + } + + request["LifecycleRuleName"] = d.Get("lifecycle_rule_name") + if d.HasChange("lifecycle_rule_name") { + update = true + } + if update { + action := "ModifyLifecyclePolicy" + conn, err := client.NewNasClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-06-26"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudNasLifecyclePolicyRead(d, meta) +} +func resourceAlicloudNasLifecyclePolicyDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + action := "DeleteLifecyclePolicy" + var response map[string]interface{} + conn, err := client.NewNasClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "FileSystemId": parts[0], + "LifecyclePolicyName": parts[1], + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-06-26"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidFileSystem.NotFound", "InvalidLifecyclePolicy.NotFound"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_nas_snapshot.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_nas_snapshot.go new file mode 100644 index 00000000000..4d6091f2ec2 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_nas_snapshot.go @@ -0,0 +1,163 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudNasSnapshot() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudNasSnapshotCreate, + Read: resourceAlicloudNasSnapshotRead, + Delete: resourceAlicloudNasSnapshotDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(5 * time.Minute), + Delete: schema.DefaultTimeout(5 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "description": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.All(validation.StringLenBetween(2, 256), validation.StringDoesNotMatch(regexp.MustCompile(`(^http://.*)|(^https://.*)`), "It must be `2` to `256` characters in length and cannot start with `https://` or `https://`.")), + }, + "file_system_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "retention_days": { + Type: schema.TypeInt, + Optional: true, + ForceNew: true, + }, + "snapshot_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.All(validation.StringLenBetween(2, 128), validation.StringDoesNotMatch(regexp.MustCompile(`(^http://.*)|(^https://.*)`), "It must be `2` to `128` characters in length and must start with a letter, but cannot start with `https://` or `https://`.")), + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudNasSnapshotCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateSnapshot" + request := make(map[string]interface{}) + conn, err := client.NewNasClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + request["FileSystemId"] = d.Get("file_system_id") + if v, ok := d.GetOk("retention_days"); ok { + request["RetentionDays"] = v + } + if v, ok := d.GetOk("snapshot_name"); ok { + request["SnapshotName"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-06-26"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_nas_snapshot", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["SnapshotId"])) + nasService := NasService{client} + stateConf := BuildStateConf([]string{}, []string{"accomplished"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, nasService.NasSnapshotStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudNasSnapshotRead(d, meta) +} +func resourceAlicloudNasSnapshotRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + nasService := NasService{client} + object, err := nasService.DescribeNasSnapshot(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_nas_snapshot nasService.DescribeNasSnapshot Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("description", object["Description"]) + if v, ok := object["RetentionDays"]; ok && fmt.Sprint(v) != "0" { + d.Set("retention_days", formatInt(v)) + } + d.Set("snapshot_name", object["SnapshotName"]) + d.Set("file_system_id", object["SourceFileSystemId"]) + d.Set("status", object["Status"]) + return nil +} +func resourceAlicloudNasSnapshotDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + nasService := NasService{client} + action := "DeleteSnapshot" + var response map[string]interface{} + conn, err := client.NewNasClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "SnapshotId": d.Id(), + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-06-26"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidFileSystem.NotFound"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{}, d.Timeout(schema.TimeoutDelete), 5*time.Second, nasService.NasSnapshotStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_nat_gateway.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_nat_gateway.go index 8f4d827a70d..2871785978d 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_nat_gateway.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_nat_gateway.go @@ -68,7 +68,7 @@ func resourceAlicloudNatGateway() *schema.Resource { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringInSlice([]string{"Enhanced", "Normal"}, false), - Default: "Normal", + Computed: true, }, "payment_type": { Type: schema.TypeString, @@ -139,7 +139,7 @@ func resourceAlicloudNatGateway() *schema.Resource { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringInSlice([]string{"Large", "Middle", "Small", "XLarge.1"}, false), - Default: "Small", + Computed: true, DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { return d.Get("internet_charge_type").(string) == "PayByLcu" }, @@ -166,6 +166,12 @@ func resourceAlicloudNatGateway() *schema.Resource { Optional: true, Computed: true, }, + "network_type": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"internet", "intranet"}, false), + }, }, } } @@ -219,7 +225,9 @@ func resourceAlicloudNatGatewayCreate(d *schema.ResourceData, meta interface{}) if v, ok := d.GetOk("vswitch_id"); ok { request["VSwitchId"] = v } - + if v, ok := d.GetOk("network_type"); ok { + request["NetworkType"] = v + } request["VpcId"] = d.Get("vpc_id") request["ClientToken"] = buildClientToken("CreateNatGateway") runtime := util.RuntimeOptions{} @@ -275,6 +283,7 @@ func resourceAlicloudNatGatewayRead(d *schema.ResourceData, meta interface{}) er d.Set("nat_type", object["NatType"]) d.Set("payment_type", convertNatGatewayPaymentTypeResponse(object["InstanceChargeType"].(string))) d.Set("instance_charge_type", object["InstanceChargeType"]) + d.Set("network_type", object["NetworkType"]) //if object["InstanceChargeType"] == "PrePaid" { // period, err := computePeriodByUnit(object["CreationTime"], object["ExpiredTime"], d.Get("period").(int), "Month") // if err != nil { @@ -479,6 +488,10 @@ func resourceAlicloudNatGatewayUpdate(d *schema.ResourceData, meta interface{}) return resourceAlicloudNatGatewayRead(d, meta) } func resourceAlicloudNatGatewayDelete(d *schema.ResourceData, meta interface{}) error { + if d.Get("payment_type").(string) == "Subscription" || d.Get("instance_charge_type").(string) == "Prepaid" { + log.Printf("[WARN] Cannot destroy Subscription resource: alicloud_nat_gateway. Terraform will remove this resource from the state file, however resources may remain.") + return nil + } client := meta.(*connectivity.AliyunClient) vpcService := VpcService{client} action := "DeleteNatGateway" diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_oos_application.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_oos_application.go new file mode 100644 index 00000000000..1e0e1343f8d --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_oos_application.go @@ -0,0 +1,189 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudOosApplication() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudOosApplicationCreate, + Read: resourceAlicloudOosApplicationRead, + Update: resourceAlicloudOosApplicationUpdate, + Delete: resourceAlicloudOosApplicationDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "application_name": { + Type: schema.TypeString, + Required: true, + }, + "description": { + Type: schema.TypeString, + Optional: true, + }, + "resource_group_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "tags": tagsSchema(), + }, + } +} + +func resourceAlicloudOosApplicationCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateApplication" + request := make(map[string]interface{}) + conn, err := client.NewOosClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + request["Name"] = d.Get("application_name") + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("resource_group_id"); ok { + request["ResourceGroupId"] = v + } + if v, ok := d.GetOk("tags"); ok { + respJson, err := convertMaptoJsonString(v.(map[string]interface{})) + if err != nil { + return WrapError(err) + } + request["Tags"] = respJson + } + request["ClientToken"] = buildClientToken("CreateApplication") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_oos_application", action, AlibabaCloudSdkGoERROR) + } + responseApplication := response["Application"].(map[string]interface{}) + d.SetId(fmt.Sprint(responseApplication["Name"])) + + return resourceAlicloudOosApplicationRead(d, meta) +} +func resourceAlicloudOosApplicationRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + oosService := OosService{client} + object, err := oosService.DescribeOosApplication(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_oos_application oosService.DescribeOosApplication Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("description", object["Description"]) + d.Set("application_name", object["Name"]) + d.Set("resource_group_id", object["ResourceGroupId"]) + d.Set("tags", tagsToMap(object["Tags"])) + return nil +} +func resourceAlicloudOosApplicationUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "Name": d.Id(), + } + if d.HasChange("description") { + update = true + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + } + request["RegionId"] = client.RegionId + if d.HasChange("tags") { + update = true + if v, ok := d.GetOk("tags"); ok { + respJson, err := convertMaptoJsonString(v.(map[string]interface{})) + if err != nil { + return WrapError(err) + } + request["Tags"] = respJson + } + } + if update { + action := "UpdateApplication" + conn, err := client.NewOosClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudOosApplicationRead(d, meta) +} +func resourceAlicloudOosApplicationDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteApplication" + var response map[string]interface{} + conn, err := client.NewOosClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "Name": d.Id(), + } + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"EntityNotExists.Application"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_oos_application_group.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_oos_application_group.go new file mode 100644 index 00000000000..6b17d20a5db --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_oos_application_group.go @@ -0,0 +1,176 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudOosApplicationGroup() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudOosApplicationGroupCreate, + Read: resourceAlicloudOosApplicationGroupRead, + Delete: resourceAlicloudOosApplicationGroupDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "application_group_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "application_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "deploy_region_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "description": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "import_tag_key": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Computed: true, + }, + "import_tag_value": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Computed: true, + }, + }, + } +} + +func resourceAlicloudOosApplicationGroupCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateApplicationGroup" + request := make(map[string]interface{}) + conn, err := client.NewOosClient() + if err != nil { + return WrapError(err) + } + request["Name"] = d.Get("application_group_name") + request["ApplicationName"] = d.Get("application_name") + request["DeployRegionId"] = d.Get("deploy_region_id") + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + if v, ok := d.GetOk("import_tag_key"); ok { + if _, ok := d.GetOk("import_tag_value"); !ok { + return WrapError(fmt.Errorf("The tag key must be passed in at the same time as the tag value (import_tag_value) or none, not just one. ")) + } + request["ImportTagKey"] = v + } + if v, ok := d.GetOk("import_tag_value"); ok { + if _, ok := d.GetOk("import_tag_key"); !ok { + return WrapError(fmt.Errorf("The tag value must be passed in at the same time as the tag key (import_tag_key) or none, not just one. ")) + } + request["ImportTagValue"] = v + } + request["RegionId"] = client.RegionId + request["ClientToken"] = buildClientToken("CreateApplicationGroup") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + + if NeedRetry(err) { + + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_oos_application_group", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["ApplicationName"], ":", request["Name"])) + + return resourceAlicloudOosApplicationGroupRead(d, meta) +} +func resourceAlicloudOosApplicationGroupRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + oosService := OosService{client} + object, err := oosService.DescribeOosApplicationGroup(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_oos_application_group oosService.DescribeOosApplicationGroup Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Set("application_group_name", parts[1]) + d.Set("application_name", parts[0]) + d.Set("deploy_region_id", object["DeployRegionId"]) + d.Set("description", object["Description"]) + d.Set("import_tag_key", object["ImportTagKey"]) + d.Set("import_tag_value", object["ImportTagValue"]) + return nil +} +func resourceAlicloudOosApplicationGroupDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + action := "DeleteApplicationGroup" + var response map[string]interface{} + conn, err := client.NewOosClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "Name": parts[1], + "ApplicationName": parts[0], + } + + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + + if NeedRetry(err) { + + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_oos_parameter.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_oos_parameter.go new file mode 100644 index 00000000000..40c75f67c6d --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_oos_parameter.go @@ -0,0 +1,230 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudOosParameter() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudOosParameterCreate, + Read: resourceAlicloudOosParameterRead, + Update: resourceAlicloudOosParameterUpdate, + Delete: resourceAlicloudOosParameterDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "constraints": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.ValidateJsonString, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + equal, _ := compareJsonTemplateAreEquivalent(old, new) + return equal + }, + }, + "description": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringLenBetween(1, 200), + }, + "parameter_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.All(validation.StringDoesNotMatch(regexp.MustCompile(`(^ALIYUN.*)|(^ACS.*)|(^ALIBABA.*)|(^ALICLOUD.*)|(^OOS.*)`), "It cannot start with `ALIYUN`, `ACS`, `ALIBABA`, `ALICLOUD`, or `OOS`"), validation.StringMatch(regexp.MustCompile(`^[a-zA-Z0-9_/-]{2,180}`), "The name must be `2` to `180` characters in length, and can contain letters, digits, hyphens (-), forward slashes (/) and underscores (_).")), + }, + "resource_group_id": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "tags": tagsSchema(), + "type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"String", "StringList"}, false), + }, + "value": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringLenBetween(1, 4096), + }, + }, + } +} + +func resourceAlicloudOosParameterCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateParameter" + request := make(map[string]interface{}) + conn, err := client.NewOosClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("constraints"); ok { + request["Constraints"] = v + } + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + if v, ok := d.GetOk("resource_group_id"); ok { + request["ResourceGroupId"] = v + } + if v, ok := d.GetOk("tags"); ok { + respJson, err := convertMaptoJsonString(v.(map[string]interface{})) + if err != nil { + return WrapError(err) + } + request["Tags"] = respJson + } + request["Name"] = d.Get("parameter_name") + request["Type"] = d.Get("type") + request["Value"] = d.Get("value") + request["ClientToken"] = buildClientToken("CreateParameter") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_oos_parameter", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["Name"])) + + return resourceAlicloudOosParameterRead(d, meta) +} +func resourceAlicloudOosParameterRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + oosService := OosService{client} + object, err := oosService.DescribeOosParameter(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_oos_parameter oosService.DescribeOosParameter Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + + d.Set("parameter_name", d.Id()) + d.Set("constraints", object["Constraints"]) + d.Set("description", object["Description"]) + d.Set("resource_group_id", object["ResourceGroupId"]) + d.Set("tags", tagsToMap(object["Tags"])) + d.Set("type", object["Type"]) + d.Set("value", object["Value"]) + return nil +} +func resourceAlicloudOosParameterUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "Name": d.Id(), + } + if d.HasChange("value") { + update = true + } + request["Value"] = d.Get("value") + if d.HasChange("description") { + update = true + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + } + if d.HasChange("resource_group_id") { + update = true + if v, ok := d.GetOk("resource_group_id"); ok { + request["ResourceGroupId"] = v + } + } + if d.HasChange("tags") { + update = true + if v, ok := d.GetOk("tags"); ok { + respJson, err := convertMaptoJsonString(v.(map[string]interface{})) + if err != nil { + return WrapError(err) + } + request["Tags"] = respJson + } + } + if update { + action := "UpdateParameter" + conn, err := client.NewOosClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudOosParameterRead(d, meta) +} +func resourceAlicloudOosParameterDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteParameter" + var response map[string]interface{} + conn, err := client.NewOosClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "Name": d.Id(), + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_oos_patch_baseline.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_oos_patch_baseline.go new file mode 100644 index 00000000000..a779ebfdf2c --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_oos_patch_baseline.go @@ -0,0 +1,185 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudOosPatchBaseline() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudOosPatchBaselineCreate, + Read: resourceAlicloudOosPatchBaselineRead, + Update: resourceAlicloudOosPatchBaselineUpdate, + Delete: resourceAlicloudOosPatchBaselineDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "approval_rules": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.ValidateJsonString, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + equal, _ := compareJsonTemplateAreEquivalent(old, new) + return equal + }, + }, + "description": { + Type: schema.TypeString, + Optional: true, + }, + "operation_system": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"AliyunLinux", "Anolis", "Centos", "Debian", "RedhatEnterpriseLinux", "Ubuntu", "Windows"}, false), + }, + "patch_baseline_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudOosPatchBaselineCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreatePatchBaseline" + request := make(map[string]interface{}) + conn, err := client.NewOosClient() + if err != nil { + return WrapError(err) + } + request["ApprovalRules"] = d.Get("approval_rules") + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + request["OperationSystem"] = d.Get("operation_system") + request["Name"] = d.Get("patch_baseline_name") + request["ClientToken"] = buildClientToken("CreatePatchBaseline") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_oos_patch_baseline", action, AlibabaCloudSdkGoERROR) + } + d.SetId(fmt.Sprint(request["Name"])) + return resourceAlicloudOosPatchBaselineRead(d, meta) +} +func resourceAlicloudOosPatchBaselineRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + oosService := OosService{client} + object, err := oosService.DescribeOosPatchBaseline(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_oos_patch_baseline oosService.DescribeOosPatchBaseline Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("patch_baseline_name", object["Name"]) + approvalRules, err := convertMaptoJsonString(object["ApprovalRules"].(map[string]interface{})) + if err != nil { + return WrapError(err) + } + d.Set("approval_rules", approvalRules) + d.Set("description", object["Description"]) + d.Set("operation_system", object["OperationSystem"]) + return nil +} +func resourceAlicloudOosPatchBaselineUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "Name": d.Id(), + } + if d.HasChange("approval_rules") { + update = true + } + request["ApprovalRules"] = d.Get("approval_rules") + if d.HasChange("description") { + update = true + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + } + if update { + action := "UpdatePatchBaseline" + conn, err := client.NewOosClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("UpdatePatchBaseline") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudOosPatchBaselineRead(d, meta) +} +func resourceAlicloudOosPatchBaselineDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeletePatchBaseline" + var response map[string]interface{} + conn, err := client.NewOosClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "Name": d.Id(), + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_oos_secret_parameter.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_oos_secret_parameter.go new file mode 100644 index 00000000000..b6fc453737f --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_oos_secret_parameter.go @@ -0,0 +1,243 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudOosSecretParameter() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudOosSecretParameterCreate, + Read: resourceAlicloudOosSecretParameterRead, + Update: resourceAlicloudOosSecretParameterUpdate, + Delete: resourceAlicloudOosSecretParameterDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "constraints": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.ValidateJsonString, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + equal, _ := compareJsonTemplateAreEquivalent(old, new) + return equal + }, + }, + "description": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(1, 200), + }, + "key_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "resource_group_id": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "secret_parameter_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.All(validation.StringDoesNotMatch(regexp.MustCompile(`(^ALIYUN.*)|(^ACS.*)|(^ALIBABA.*)|(^ALICLOUD.*)|(^OOS.*)`), "It cannot start with `ALIYUN`, `ACS`, `ALIBABA`, `ALICLOUD`, or `OOS`"), validation.StringMatch(regexp.MustCompile(`^[a-zA-Z0-9_/-]{2,180}`), "The name must be `2` to `180` characters in length, and can contain letters, digits, hyphens (-), forward slashes (/) and underscores (_).")), + }, + "tags": tagsSchema(), + "type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"Secret"}, false), + }, + "value": { + Type: schema.TypeString, + Required: true, + Sensitive: true, + ValidateFunc: validation.StringLenBetween(1, 4096), + }, + }, + } +} + +func resourceAlicloudOosSecretParameterCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateSecretParameter" + request := make(map[string]interface{}) + conn, err := client.NewOosClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("constraints"); ok { + request["Constraints"] = v + } + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + if v, ok := d.GetOk("key_id"); ok { + request["KeyId"] = v + } + if v, ok := d.GetOk("resource_group_id"); ok { + request["ResourceGroupId"] = v + } + if v, ok := d.GetOk("tags"); ok { + respJson, err := convertMaptoJsonString(v.(map[string]interface{})) + if err != nil { + return WrapError(err) + } + request["Tags"] = respJson + } + if v, ok := d.GetOk("type"); ok { + request["Type"] = v + } + request["RegionId"] = client.RegionId + request["Name"] = d.Get("secret_parameter_name") + request["Value"] = d.Get("value") + request["ClientToken"] = buildClientToken("CreateSecretParameter") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_oos_secret_parameter", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["Name"])) + + return resourceAlicloudOosSecretParameterRead(d, meta) +} +func resourceAlicloudOosSecretParameterRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + oosService := OosService{client} + object, err := oosService.DescribeOosSecretParameter(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_oos_secret_parameter oosService.DescribeOosSecretParameter Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("secret_parameter_name", object["Name"]) + d.Set("constraints", object["Constraints"]) + d.Set("description", object["Description"]) + d.Set("key_id", object["KeyId"]) + d.Set("resource_group_id", object["ResourceGroupId"]) + d.Set("tags", tagsToMap(object["Tags"])) + d.Set("type", object["Type"]) + return nil +} +func resourceAlicloudOosSecretParameterUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "Name": d.Id(), + } + if d.HasChange("value") { + update = true + } + request["Value"] = d.Get("value") + if d.HasChange("description") { + update = true + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + } + request["RegionId"] = client.RegionId + if d.HasChange("resource_group_id") { + update = true + if v, ok := d.GetOk("resource_group_id"); ok { + request["ResourceGroupId"] = v + } + } + if d.HasChange("tags") { + update = true + if v, ok := d.GetOk("tags"); ok { + if v, err := convertMaptoJsonString(v.(map[string]interface{})); err == nil { + request["Tags"] = v + } else { + return WrapError(err) + } + } + } + if update { + action := "UpdateSecretParameter" + conn, err := client.NewOosClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudOosSecretParameterRead(d, meta) +} +func resourceAlicloudOosSecretParameterDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteSecretParameter" + var response map[string]interface{} + conn, err := client.NewOosClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "Name": d.Id(), + } + + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_oos_service_setting.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_oos_service_setting.go new file mode 100644 index 00000000000..fbf614ebc93 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_oos_service_setting.go @@ -0,0 +1,198 @@ +package alicloud + +import ( + "fmt" + "log" + "strings" + "time" + + "github.com/google/uuid" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudOosServiceSetting() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudOosServiceSettingCreate, + Read: resourceAlicloudOosServiceSettingRead, + Update: resourceAlicloudOosServiceSettingUpdate, + Delete: resourceAlicloudOosServiceSettingDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "delivery_oss_bucket_name": { + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOkExists("delivery_sls_enabled"); ok && v.(bool) { + return false + } + return true + }, + }, + "delivery_oss_enabled": { + Type: schema.TypeBool, + Optional: true, + }, + "delivery_oss_key_prefix": { + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOkExists("delivery_sls_enabled"); ok && v.(bool) { + return false + } + return true + }, + }, + "delivery_sls_enabled": { + Type: schema.TypeBool, + Optional: true, + }, + "delivery_sls_project_name": { + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOkExists("delivery_sls_enabled"); ok && v.(bool) { + return false + } + return true + }, + }, + }, + } +} + +func resourceAlicloudOosServiceSettingCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "SetServiceSettings" + request := make(map[string]interface{}) + conn, err := client.NewOosClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("delivery_oss_bucket_name"); ok { + request["DeliveryOssBucketName"] = v + } + if v, ok := d.GetOkExists("delivery_oss_enabled"); ok { + request["DeliveryOssEnabled"] = v + } + if v, ok := d.GetOk("delivery_oss_key_prefix"); ok { + request["DeliveryOssKeyPrefix"] = v + } + if v, ok := d.GetOkExists("delivery_sls_enabled"); ok { + request["DeliverySlsEnabled"] = v + } + if v, ok := d.GetOk("delivery_sls_project_name"); ok { + request["DeliverySlsProjectName"] = v + } + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_oos_service_setting", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(strings.Trim(uuid.New().String(), "-"))) + return resourceAlicloudOosServiceSettingRead(d, meta) +} +func resourceAlicloudOosServiceSettingRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + oosService := OosService{client} + object, err := oosService.DescribeOosServiceSetting(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_oos_service_setting oosService.DescribeOosServiceSetting Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("delivery_oss_bucket_name", object["DeliveryOssBucketName"]) + d.Set("delivery_oss_enabled", object["DeliveryOssEnabled"]) + d.Set("delivery_oss_key_prefix", object["DeliveryOssKeyPrefix"]) + d.Set("delivery_sls_enabled", object["DeliverySlsEnabled"]) + d.Set("delivery_sls_project_name", object["DeliverySlsProjectName"]) + d.Set("rdc_enterprise_id", object["RdcEnterpriseId"]) + return nil +} +func resourceAlicloudOosServiceSettingUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{} + if d.HasChange("delivery_oss_enabled") { + update = true + if v, ok := d.GetOkExists("delivery_oss_enabled"); ok { + request["DeliveryOssEnabled"] = v + } + } + if d.HasChange("delivery_oss_bucket_name") { + update = true + if v, ok := d.GetOk("delivery_oss_bucket_name"); ok { + request["DeliveryOssBucketName"] = v + } + } + if d.HasChange("delivery_oss_key_prefix") { + update = true + if v, ok := d.GetOk("delivery_oss_key_prefix"); ok { + request["DeliveryOssKeyPrefix"] = v + } + } + if d.HasChange("delivery_sls_enabled") { + update = true + if v, ok := d.GetOkExists("delivery_sls_enabled"); ok { + request["DeliverySlsEnabled"] = v + } + } + if d.HasChange("delivery_sls_project_name") { + update = true + if v, ok := d.GetOk("delivery_sls_project_name"); ok { + request["DeliverySlsProjectName"] = v + } + } + if update { + action := "SetServiceSettings" + conn, err := client.NewOosClient() + if err != nil { + return WrapError(err) + } + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudOosServiceSettingRead(d, meta) +} +func resourceAlicloudOosServiceSettingDelete(d *schema.ResourceData, meta interface{}) error { + log.Printf("[WARN] Cannot destroy resourceAlicloudOosServiceSetting. Terraform will remove this resource from the state file, however resources may remain.") + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_oos_state_configuration.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_oos_state_configuration.go new file mode 100644 index 00000000000..3a45c8e4669 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_oos_state_configuration.go @@ -0,0 +1,281 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudOosStateConfiguration() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudOosStateConfigurationCreate, + Read: resourceAlicloudOosStateConfigurationRead, + Update: resourceAlicloudOosStateConfigurationUpdate, + Delete: resourceAlicloudOosStateConfigurationDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "configure_mode": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"ApplyAndAutoCorrect", "ApplyAndMonitor", "ApplyOnly"}, false), + }, + "description": { + Type: schema.TypeString, + Optional: true, + }, + "parameters": { + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + equal, _ := compareJsonTemplateAreEquivalent(old, new) + return equal + }, + }, + "resource_group_id": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "schedule_expression": { + Type: schema.TypeString, + Required: true, + }, + "schedule_type": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"rate"}, false), + }, + "tags": tagsSchema(), + "targets": { + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + equal, _ := compareJsonTemplateAreEquivalent(old, new) + return equal + }, + }, + "template_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"ACS-ECS-InventoryDataCollection"}, false), + }, + "template_version": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudOosStateConfigurationCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateStateConfiguration" + request := make(map[string]interface{}) + conn, err := client.NewOosClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("configure_mode"); ok { + request["ConfigureMode"] = v + } + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + if v, ok := d.GetOk("parameters"); ok { + request["Parameters"] = v + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("resource_group_id"); ok { + request["ResourceGroupId"] = v + } + request["ScheduleExpression"] = d.Get("schedule_expression") + request["ScheduleType"] = d.Get("schedule_type") + if v, ok := d.GetOk("tags"); ok { + respJson, err := convertMaptoJsonString(v.(map[string]interface{})) + if err != nil { + return WrapError(err) + } + request["Tags"] = respJson + } + request["Targets"] = d.Get("targets") + request["TemplateName"] = d.Get("template_name") + if v, ok := d.GetOk("template_version"); ok { + request["TemplateVersion"] = v + } + request["ClientToken"] = buildClientToken("CreateStateConfiguration") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_oos_state_configuration", action, AlibabaCloudSdkGoERROR) + } + responseStateConfiguration := response["StateConfiguration"].(map[string]interface{}) + d.SetId(fmt.Sprint(responseStateConfiguration["StateConfigurationId"])) + + return resourceAlicloudOosStateConfigurationRead(d, meta) +} +func resourceAlicloudOosStateConfigurationRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + oosService := OosService{client} + object, err := oosService.DescribeOosStateConfiguration(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_oos_state_configuration oosService.DescribeOosStateConfiguration Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("configure_mode", object["ConfigureMode"]) + d.Set("description", object["Description"]) + d.Set("parameters", object["Parameters"]) + d.Set("resource_group_id", object["ResourceGroupId"]) + d.Set("schedule_expression", object["ScheduleExpression"]) + d.Set("schedule_type", object["ScheduleType"]) + d.Set("tags", tagsToMap(object["Tags"])) + d.Set("targets", object["Targets"]) + d.Set("template_name", object["TemplateName"]) + d.Set("template_version", object["TemplateVersion"]) + return nil +} +func resourceAlicloudOosStateConfigurationUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "StateConfigurationId": d.Id(), + } + if d.HasChange("configure_mode") { + update = true + if v, ok := d.GetOk("configure_mode"); ok { + request["ConfigureMode"] = v + } + } + if d.HasChange("description") { + update = true + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + } + if d.HasChange("parameters") { + update = true + if v, ok := d.GetOk("parameters"); ok { + request["Parameters"] = v + } + } + request["RegionId"] = client.RegionId + if d.HasChange("resource_group_id") { + update = true + if v, ok := d.GetOk("resource_group_id"); ok { + request["ResourceGroupId"] = v + } + } + if d.HasChange("schedule_expression") { + update = true + request["ScheduleExpression"] = d.Get("schedule_expression") + } + if d.HasChange("schedule_type") { + update = true + request["ScheduleType"] = d.Get("schedule_type") + } + if d.HasChange("tags") { + update = true + if v, ok := d.GetOk("tags"); ok { + respJson, err := convertMaptoJsonString(v.(map[string]interface{})) + if err != nil { + return WrapError(err) + } + request["Tags"] = respJson + } + } + if d.HasChange("targets") { + update = true + request["Targets"] = d.Get("targets") + } + if update { + action := "UpdateStateConfiguration" + conn, err := client.NewOosClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("UpdateStateConfiguration") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudOosStateConfigurationRead(d, meta) +} +func resourceAlicloudOosStateConfigurationDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteStateConfigurations" + var response map[string]interface{} + conn, err := client.NewOosClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "StateConfigurationIds": convertListToJsonString([]interface{}{d.Id()}), + } + + request["RegionId"] = client.RegionId + request["ClientToken"] = buildClientToken("DeleteStateConfigurations") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_open_search_app_group.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_open_search_app_group.go new file mode 100644 index 00000000000..aeb5342830c --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_open_search_app_group.go @@ -0,0 +1,400 @@ +package alicloud + +import ( + "encoding/json" + "fmt" + "log" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudOpenSearchAppGroup() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudOpenSearchAppGroupCreate, + Read: resourceAlicloudOpenSearchAppGroupRead, + Update: resourceAlicloudOpenSearchAppGroupUpdate, + Delete: resourceAlicloudOpenSearchAppGroupDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "app_group_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"standard", "enhanced"}, false), + }, + "payment_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"PayAsYouGo", "Subscription"}, false), + }, + "quota": { + Type: schema.TypeSet, + Required: true, + ForceNew: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "doc_size": { + Type: schema.TypeInt, + Required: true, + }, + "compute_resource": { + Type: schema.TypeInt, + Required: true, + }, + "qps": { + Type: schema.TypeInt, + Optional: true, + }, + "spec": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"opensearch.share.junior", "opensearch.share.common", "opensearch.share.compute", "opensearch.share.storage", "opensearch.private.common", "opensearch.private.compute", "opensearch.private.storage"}, false), + }, + }, + }, + }, + "order": { + Type: schema.TypeSet, + Optional: true, + ForceNew: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "duration": { + Type: schema.TypeInt, + Optional: true, + }, + "pricing_cycle": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"Year", "Month"}, false), + }, + "auto_renew": { + Type: schema.TypeBool, + Optional: true, + }, + }, + }, + }, + "order_type": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"UPGRADE", "DOWNGRADE"}, false), + }, + "charge_way": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"compute_resource", "qps"}, false), + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Optional: true, + }, + "current_version": { + Type: schema.TypeString, + Optional: true, + }, + }, + } +} + +func resourceAlicloudOpenSearchAppGroupCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "/v4/openapi/app-groups" + body := make(map[string]interface{}) + conn, err := client.NewOpensearchClient() + if err != nil { + return WrapError(err) + } + body["name"] = d.Get("app_group_name") + body["type"] = d.Get("type") + body["chargeType"] = convertOpenSearchAppGroupPaymentTypeRequest(d.Get("payment_type").(string)) + quotaMaps := make(map[string]interface{}, 0) + for _, quotas := range d.Get("quota").(*schema.Set).List() { + quota := quotas.(map[string]interface{}) + quotaMaps = map[string]interface{}{ + "docSize": quota["doc_size"], + "computeResource": quota["compute_resource"], + "spec": quota["spec"], + "qps": quota["qps"], + } + } + body["quota"] = quotaMaps + + if _, ok := d.GetOk("order"); ok { + orderMaps := make(map[string]interface{}, 0) + for _, quotas := range d.Get("order").(*schema.Set).List() { + quota := quotas.(map[string]interface{}) + orderMaps = map[string]interface{}{ + "duration": quota["duration"], + "pricingCycle": quota["pricing_cycle"], + "autoRenew": quota["auto_renew"], + } + } + body["order"] = orderMaps + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer("2017-12-25"), nil, StringPointer("POST"), StringPointer("AK"), StringPointer(action), nil, nil, body, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug("POST "+action, response, body) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_open_search_app_group", "POST "+action, AlibabaCloudSdkGoERROR) + } + if respBody, isExist := response["body"]; isExist { + response = respBody.(map[string]interface{}) + } else { + return WrapError(fmt.Errorf("%s failed, response: %v", "POST "+action, response)) + } + d.SetId(fmt.Sprint(response["result"].(map[string]interface{})["name"])) + + return resourceAlicloudOpenSearchAppGroupUpdate(d, meta) +} +func resourceAlicloudOpenSearchAppGroupRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + openSearchService := OpenSearchService{client} + object, err := openSearchService.DescribeOpenSearchAppGroup(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_open_search_app_group openSearchService.DescribeOpenSearchAppGroup Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("payment_type", convertOpenSearchAppGroupPaymentTypeResponse(object["chargeType"].(string))) + d.Set("app_group_name", object["name"]) + d.Set("description", object["description"]) + d.Set("type", object["type"]) + d.Set("current_version", object["currentVersion"]) + d.Set("status", object["status"]) + d.Set("charge_way", convertOpenSearchchargingWayResponse(object["chargingWay"].(json.Number).String())) + quotaSli := make([]map[string]interface{}, 0) + if _, exist := object["quota"]; exist { + quotaval := object["quota"].(map[string]interface{}) + quotaSli = append(quotaSli, map[string]interface{}{ + "doc_size": quotaval["docSize"], + "compute_resource": quotaval["computeResource"], + "spec": quotaval["spec"], + "qps": quotaval["qps"], + }) + } + d.Set("quota", quotaSli) + return nil +} + +func resourceAlicloudOpenSearchAppGroupUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + openSearchService := OpenSearchService{client} + var response map[string]interface{} + update := false + body := map[string]interface{}{ + "appGroupIdentity": d.Id(), + } + if d.HasChange("description") || d.IsNewResource() { + if v, ok := d.GetOk("description"); ok { + body["description"] = v + update = true + } + } + if d.HasChange("current_version") || d.IsNewResource() { + if v, ok := d.GetOk("current_version"); ok { + body["currentVersion"] = v + update = true + } + } + if d.HasChange("charge_way") || d.IsNewResource() { + if v, ok := d.GetOk("charge_way"); ok { + body["chargingWay"] = convertOpenSearchchargingWayRequest(v.(string)) + update = true + } + } + if update { + action := "/v4/openapi/app-groups/" + d.Id() + conn, err := client.NewOpensearchClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer("2017-12-25"), nil, StringPointer("PUT"), StringPointer("AK"), StringPointer(action), nil, nil, body, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug("PUT "+action, response, body) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if respBody, isExist := response["body"]; isExist { + response = respBody.(map[string]interface{}) + } else { + return WrapError(fmt.Errorf("%s failed, response: %v", "POST "+action, response)) + } + if code, exist := response["code"]; exist && code.(string) != "Success" { + return WrapError(Error("Update AppGroup failed for " + response["message"].(string))) + } + + } + update = false + if d.HasChange("quota") && !d.IsNewResource() { + update = true + if val, exist := d.GetOk("order_type"); exist { + body["orderType"] = val + } else { + return WrapError(fmt.Errorf("attribute '%s' is required when '%s' is updated ", "order_type", "quota")) + } + for _, quotas := range d.Get("quota").(*schema.Set).List() { + quota := quotas.(map[string]interface{}) + body["docSize"] = quota["doc_size"] + body["computeResource"] = quota["compute_resource"] + body["spec"] = quota["spec"] + } + } + if update { + action := fmt.Sprintf("/v4/openapi/app-groups/%s/quota", d.Id()) + conn, err := client.NewOpensearchClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer("2017-12-25"), nil, StringPointer("PUT"), StringPointer("AK"), StringPointer(action), nil, nil, body, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug("PUT "+action, response, body) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if respBody, isExist := response["body"]; isExist { + response = respBody.(map[string]interface{}) + } else { + return WrapError(fmt.Errorf("%s failed, response: %v", "POST "+action, response)) + } + if code, exist := response["code"]; exist && code.(string) != "Success" { + return WrapError(Error("Update AppGroup failed for " + response["message"].(string))) + } + } + stateConf := BuildStateConf([]string{}, []string{"config_pending", "normal"}, d.Timeout(schema.TimeoutDelete), 5*time.Second, openSearchService.OpenSearchAppStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudOpenSearchAppGroupRead(d, meta) +} + +func resourceAlicloudOpenSearchAppGroupDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + if d.Get("payment_type").(string) == "Subscription" { + log.Printf("[WARN] Cannot destroy resource: alicloud_open_search_app_group. Terraform will remove this resource from the state file, however resources may remain.") + return nil + } + action := "/v4/openapi/app-groups/" + d.Id() + var response map[string]interface{} + conn, err := client.NewOpensearchClient() + if err != nil { + return WrapError(err) + } + request := map[string]*string{ + "appGroupIdentity": StringPointer(d.Id()), + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer("2017-12-25"), nil, StringPointer("DELETE"), StringPointer("AK"), StringPointer(action), request, nil, nil, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug("DELETE "+action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} + +func convertOpenSearchAppGroupPaymentTypeRequest(source string) string { + switch source { + case "PayAsYouGo": + return "POSTPAY" + case "Subscription": + return "PREPAY" + } + return source +} +func convertOpenSearchAppGroupPaymentTypeResponse(source string) string { + switch source { + case "POSTPAY": + return "PayAsYouGo" + case "PREPAY": + return "Subscription" + } + return source +} + +func convertOpenSearchchargingWayRequest(source string) interface{} { + switch source { + case "compute_resource": + return 1 + case "qps": + return 2 + } + return source +} +func convertOpenSearchchargingWayResponse(source string) interface{} { + switch source { + case "1": + return "compute_resource" + case "2": + return "qps" + } + return source +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_polardb_cluster.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_polardb_cluster.go index c69a40fbd6f..b1bc1569d87 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_polardb_cluster.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_polardb_cluster.go @@ -563,11 +563,16 @@ func resourceAlicloudPolarDBClusterRead(d *schema.ResourceData, meta interface{} return WrapError(err) } - if err = polarDBService.DBClusterIPArrays(d, "db_cluster_ip_array"); err != nil { + dbClusterIPArrayName := "default" + if v, ok := d.GetOk("db_cluster_ip_array_name"); ok { + dbClusterIPArrayName = v.(string) + } + + if err = polarDBService.DBClusterIPArrays(d, "db_cluster_ip_array", dbClusterIPArrayName); err != nil { return WrapError(err) } - ips, err := polarDBService.DescribeDBSecurityIps(d.Id()) + ips, err := polarDBService.DescribeDBSecurityIps(d.Id(), dbClusterIPArrayName) if err != nil { return WrapError(err) } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_pvtz_endpoint.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_pvtz_endpoint.go new file mode 100644 index 00000000000..5d818eaac26 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_pvtz_endpoint.go @@ -0,0 +1,252 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudPvtzEndpoint() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudPvtzEndpointCreate, + Read: resourceAlicloudPvtzEndpointRead, + Update: resourceAlicloudPvtzEndpointUpdate, + Delete: resourceAlicloudPvtzEndpointDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(10 * time.Minute), + Update: schema.DefaultTimeout(10 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "endpoint_name": { + Type: schema.TypeString, + Required: true, + }, + "ip_configs": { + Type: schema.TypeSet, + Required: true, + MaxItems: 6, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "zone_id": { + Type: schema.TypeString, + Required: true, + }, + "cidr_block": { + Type: schema.TypeString, + Required: true, + }, + "ip": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "vswitch_id": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + "security_group_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "vpc_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "vpc_region_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudPvtzEndpointCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "AddResolverEndpoint" + request := make(map[string]interface{}) + conn, err := client.NewPvtzClient() + if err != nil { + return WrapError(err) + } + request["Name"] = d.Get("endpoint_name") + for k, ipConfig := range d.Get("ip_configs").(*schema.Set).List() { + ipConfigArg := ipConfig.(map[string]interface{}) + request[fmt.Sprintf("IpConfig.%d.VSwitchId", k+1)] = ipConfigArg["vswitch_id"] + request[fmt.Sprintf("IpConfig.%d.AzId", k+1)] = ipConfigArg["zone_id"] + request[fmt.Sprintf("IpConfig.%d.CidrBlock", k+1)] = ipConfigArg["cidr_block"] + request[fmt.Sprintf("IpConfig.%d.Ip", k+1)] = ipConfigArg["ip"] + } + + request["Lang"] = "en" + request["SecurityGroupId"] = d.Get("security_group_id") + request["VpcId"] = d.Get("vpc_id") + request["VpcRegionId"] = d.Get("vpc_region_id") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_pvtz_endpoint", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["EndpointId"])) + pvtzService := PvtzService{client} + stateConf := BuildStateConf([]string{}, []string{"SUCCESS"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, pvtzService.PvtzEndpointStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return resourceAlicloudPvtzEndpointRead(d, meta) +} +func resourceAlicloudPvtzEndpointRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + pvtzService := PvtzService{client} + object, err := pvtzService.DescribePvtzEndpoint(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_pvtz_endpoint pvtzService.DescribePvtzEndpoint Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("endpoint_name", object["Name"]) + ipConfigsSli := make([]map[string]interface{}, 0) + if ipConfigs, ok := object["IpConfigs"].([]interface{}); ok { + for _, ipConfigArgs := range ipConfigs { + ipConfigArg := ipConfigArgs.(map[string]interface{}) + ipConfigsMap := make(map[string]interface{}) + ipConfigsMap["zone_id"] = ipConfigArg["AzId"] + ipConfigsMap["cidr_block"] = ipConfigArg["CidrBlock"] + ipConfigsMap["ip"] = ipConfigArg["Ip"] + ipConfigsMap["vswitch_id"] = ipConfigArg["VSwitchId"] + ipConfigsSli = append(ipConfigsSli, ipConfigsMap) + } + } + d.Set("ip_configs", ipConfigsSli) + d.Set("security_group_id", object["SecurityGroupId"]) + d.Set("status", object["Status"]) + d.Set("vpc_id", object["VpcId"]) + d.Set("vpc_region_id", object["VpcRegionId"]) + return nil +} +func resourceAlicloudPvtzEndpointUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + request := map[string]interface{}{ + "EndpointId": d.Id(), + } + + update := false + if d.HasChange("endpoint_name") { + update = true + if v, ok := d.GetOk("endpoint_name"); ok { + request["Name"] = v + } + } + + if d.HasChange("ip_configs") { + update = true + for k, ipConfig := range d.Get("ip_configs").(*schema.Set).List() { + ipConfigArg := ipConfig.(map[string]interface{}) + request[fmt.Sprintf("IpConfig.%d.VSwitchId", k+1)] = ipConfigArg["vswitch_id"] + request[fmt.Sprintf("IpConfig.%d.AzId", k+1)] = ipConfigArg["zone_id"] + request[fmt.Sprintf("IpConfig.%d.CidrBlock", k+1)] = ipConfigArg["cidr_block"] + request[fmt.Sprintf("IpConfig.%d.Ip", k+1)] = ipConfigArg["ip"] + } + } + request["Lang"] = "en" + if update { + action := "UpdateResolverEndpoint" + conn, err := client.NewPvtzClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + + pvtzService := PvtzService{client} + stateConf := BuildStateConf([]string{}, []string{"SUCCESS"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, pvtzService.PvtzEndpointStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + } + return resourceAlicloudPvtzEndpointRead(d, meta) +} +func resourceAlicloudPvtzEndpointDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteResolverEndpoint" + var response map[string]interface{} + conn, err := client.NewPvtzClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "EndpointId": d.Id(), + } + + request["Lang"] = "en" + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"ResolverEndpoint.NotExists"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_pvtz_rule.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_pvtz_rule.go new file mode 100644 index 00000000000..01ba51e87e0 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_pvtz_rule.go @@ -0,0 +1,219 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudPvtzRule() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudPvtzRuleCreate, + Read: resourceAlicloudPvtzRuleRead, + Update: resourceAlicloudPvtzRuleUpdate, + Delete: resourceAlicloudPvtzRuleDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "endpoint_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "forward_ips": { + Type: schema.TypeSet, + Required: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "ip": { + Type: schema.TypeString, + Required: true, + }, + "port": { + Type: schema.TypeInt, + Required: true, + }, + }, + }, + }, + "rule_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"OUTBOUND"}, false), + }, + "zone_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudPvtzRuleCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "AddResolverRule" + request := make(map[string]interface{}) + conn, err := client.NewPvtzClient() + if err != nil { + return WrapError(err) + } + request["EndpointId"] = d.Get("endpoint_id") + request["Lang"] = "en" + request["Name"] = d.Get("rule_name") + if v, ok := d.GetOk("type"); ok { + request["Type"] = v + } + for k, forwardConfig := range d.Get("forward_ips").(*schema.Set).List() { + forwardConfigArg := forwardConfig.(map[string]interface{}) + request[fmt.Sprintf("ForwardIp.%d.Port", k+1)] = forwardConfigArg["port"] + request[fmt.Sprintf("ForwardIp.%d.Ip", k+1)] = forwardConfigArg["ip"] + } + + request["ZoneName"] = d.Get("zone_name") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_pvtz_rule", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["RuleId"])) + + return resourceAlicloudPvtzRuleRead(d, meta) +} +func resourceAlicloudPvtzRuleRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + pvtzService := PvtzService{client} + object, err := pvtzService.DescribePvtzRule(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_pvtz_rule pvtzService.DescribePvtzRule Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("endpoint_id", object["EndpointId"]) + d.Set("rule_name", object["Name"]) + forwardConfigsSli := make([]map[string]interface{}, 0) + if forwardConfigs, ok := object["ForwardIps"].([]interface{}); ok { + for _, forwardConfigArgs := range forwardConfigs { + forwardConfigArg := forwardConfigArgs.(map[string]interface{}) + forwardConfigsMap := make(map[string]interface{}) + forwardConfigsMap["ip"] = forwardConfigArg["Ip"] + forwardConfigsMap["port"] = formatInt(forwardConfigArg["Port"]) + forwardConfigsSli = append(forwardConfigsSli, forwardConfigsMap) + } + } + d.Set("forward_ips", forwardConfigsSli) + d.Set("type", object["Type"]) + d.Set("zone_name", object["ZoneName"]) + return nil +} +func resourceAlicloudPvtzRuleUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "RuleId": d.Id(), + } + + if d.HasChange("rule_name") { + update = true + request["Name"] = d.Get("rule_name") + } + + if d.HasChange("forward_ips") { + update = true + for k, forwardConfig := range d.Get("forward_ips").(*schema.Set).List() { + forwardConfigArg := forwardConfig.(map[string]interface{}) + request[fmt.Sprintf("ForwardIp.%d.Port", k+1)] = forwardConfigArg["port"] + request[fmt.Sprintf("ForwardIp.%d.Ip", k+1)] = forwardConfigArg["ip"] + } + } + + if update { + request["Lang"] = "en" + action := "UpdateResolverRule" + conn, err := client.NewPvtzClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudPvtzRuleRead(d, meta) +} +func resourceAlicloudPvtzRuleDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteResolverRule" + var response map[string]interface{} + conn, err := client.NewPvtzClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "RuleId": d.Id(), + } + + request["Lang"] = "en" + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"ResolverRule.NotExists"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_pvtz_rule_attachment.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_pvtz_rule_attachment.go new file mode 100644 index 00000000000..e48fdcebf84 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_pvtz_rule_attachment.go @@ -0,0 +1,193 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudPvtzRuleAttachment() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudPvtzRuleAttachmentCreate, + Read: resourceAlicloudPvtzRuleAttachmentRead, + Update: resourceAlicloudPvtzRuleAttachmentUpdate, + Delete: resourceAlicloudPvtzRuleAttachmentDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "rule_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "vpcs": { + Type: schema.TypeSet, + Required: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "region_id": { + Type: schema.TypeString, + Required: true, + }, + "vpc_id": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + }, + } +} + +func resourceAlicloudPvtzRuleAttachmentCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "BindResolverRuleVpc" + request := make(map[string]interface{}) + conn, err := client.NewPvtzClient() + if err != nil { + return WrapError(err) + } + request["Lang"] = "en" + request["RuleId"] = d.Get("rule_id") + + for k, vpcConfig := range d.Get("vpcs").(*schema.Set).List() { + vpcConfigArg := vpcConfig.(map[string]interface{}) + request[fmt.Sprintf("Vpc.%d.VpcId", k+1)] = vpcConfigArg["vpc_id"] + request[fmt.Sprintf("Vpc.%d.RegionId", k+1)] = vpcConfigArg["region_id"] + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_pvtz_rule_attachment", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["RuleId"])) + + return resourceAlicloudPvtzRuleAttachmentRead(d, meta) +} +func resourceAlicloudPvtzRuleAttachmentRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + pvtzService := PvtzService{client} + object, err := pvtzService.DescribePvtzRuleAttachment(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_pvtz_rule_attachment pvtzService.DescribePvtzRuleAttachment Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + + vpcsSli := make([]map[string]interface{}, 0) + if vpcs, ok := object["BindVpcs"].([]interface{}); ok { + for _, vpcConfigArgs := range vpcs { + vpcConfigArg := vpcConfigArgs.(map[string]interface{}) + vpcsMap := make(map[string]interface{}) + vpcsMap["region_id"] = vpcConfigArg["RegionId"] + vpcsMap["vpc_id"] = vpcConfigArg["VpcId"] + vpcsSli = append(vpcsSli, vpcsMap) + } + } + d.Set("vpcs", vpcsSli) + d.Set("rule_id", d.Id()) + return nil +} +func resourceAlicloudPvtzRuleAttachmentUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "RuleId": d.Id(), + } + request["RegionId"] = client.RegionId + if d.HasChange("vpcs") { + update = true + for k, vpcConfig := range d.Get("vpcs").(*schema.Set).List() { + vpcConfigArg := vpcConfig.(map[string]interface{}) + request[fmt.Sprintf("Vpc.%d.VpcId", k+1)] = vpcConfigArg["vpc_id"] + request[fmt.Sprintf("Vpc.%d.RegionId", k+1)] = vpcConfigArg["region_id"] + } + } + + if update { + request["Lang"] = "en" + action := "BindResolverRuleVpc" + conn, err := client.NewPvtzClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudPvtzRuleAttachmentRead(d, meta) +} +func resourceAlicloudPvtzRuleAttachmentDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "BindResolverRuleVpc" + var response map[string]interface{} + conn, err := client.NewPvtzClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "RuleId": d.Id(), + } + + request["Lang"] = "en" + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"ResolverRule.NotExists"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_pvtz_user_vpc_authorization.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_pvtz_user_vpc_authorization.go new file mode 100644 index 00000000000..7000fabb7de --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_pvtz_user_vpc_authorization.go @@ -0,0 +1,147 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudPvtzUserVpcAuthorization() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudPvtzUserVpcAuthorizationCreate, + Read: resourceAlicloudPvtzUserVpcAuthorizationRead, + Update: resourceAlicloudPvtzUserVpcAuthorizationUpdate, + Delete: resourceAlicloudPvtzUserVpcAuthorizationDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(2 * time.Minute), + Delete: schema.DefaultTimeout(2 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "auth_channel": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"RESOURCE_DIRECTORY"}, false), + }, + "auth_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"NORMAL", "CLOUD_PRODUCT"}, false), + }, + "authorized_user_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudPvtzUserVpcAuthorizationCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "AddUserVpcAuthorization" + request := make(map[string]interface{}) + conn, err := client.NewPvtzClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("auth_channel"); ok { + request["AuthChannel"] = v + } + if v, ok := d.GetOk("auth_type"); ok { + request["AuthType"] = v + } + request["AuthorizedUserId"] = d.Get("authorized_user_id") + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"System.Busy"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_pvtz_user_vpc_authorization", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["AuthorizedUserId"], ":", request["AuthType"])) + + return resourceAlicloudPvtzUserVpcAuthorizationRead(d, meta) +} +func resourceAlicloudPvtzUserVpcAuthorizationRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + pvtzService := PvtzService{client} + _, err := pvtzService.DescribePvtzUserVpcAuthorization(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_pvtz_user_vpc_authorization pvtzService.DescribePvtzUserVpcAuthorization Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Set("auth_type", parts[1]) + d.Set("authorized_user_id", parts[0]) + return nil +} +func resourceAlicloudPvtzUserVpcAuthorizationUpdate(d *schema.ResourceData, meta interface{}) error { + log.Println(fmt.Sprintf("[WARNING] The resouce has not update operation.")) + return resourceAlicloudPvtzUserVpcAuthorizationRead(d, meta) +} +func resourceAlicloudPvtzUserVpcAuthorizationDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + action := "DeleteUserVpcAuthorization" + var response map[string]interface{} + conn, err := client.NewPvtzClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "AuthType": parts[1], + "AuthorizedUserId": parts[0], + } + + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"System.Busy"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"ZoneVpc.Auth.NotExists"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_pvtz_zone.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_pvtz_zone.go index d58b4930e93..ab008fe33a2 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_pvtz_zone.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_pvtz_zone.go @@ -84,6 +84,29 @@ func resourceAlicloudPvtzZone() *schema.Resource { Computed: true, Removed: "Field 'update_time' has been removed from provider version 1.107.0", }, + "user_info": { + Type: schema.TypeSet, + Optional: true, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "user_id": { + Type: schema.TypeString, + Optional: true, + }, + "region_ids": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + }, + "sync_status": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"ON", "OFF"}, false), + }, }, } } @@ -158,10 +181,33 @@ func resourceAlicloudPvtzZoneRead(d *schema.ResourceData, meta interface{}) erro d.Set("remark", object["Remark"]) d.Set("zone_name", object["ZoneName"]) d.Set("name", object["ZoneName"]) + + if v, ok := object["SyncHostTask"]; ok && v != nil { + syncObject := v.(map[string]interface{}) + syncArray := make([]map[string]interface{}, 0) + for _, raw := range syncObject["EcsRegions"].(map[string]interface{})["EcsRegion"].([]interface{}) { + obj := raw.(map[string]interface{}) + user := make(map[string]interface{}, 0) + user["user_id"] = obj["UserId"] + regions := make([]interface{}, 0) + for _, region := range obj["RegionIds"].(map[string]interface{})["RegionId"].([]interface{}) { + regions = append(regions, region) + } + user["region_ids"] = regions + syncArray = append(syncArray, user) + } + d.Set("user_info", syncArray) + d.Set("sync_status", syncObject["Status"]) + } return nil } func resourceAlicloudPvtzZoneUpdate(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) + pvtzService := PvtzService{client} + conn, err := client.NewPvtzClient() + if err != nil { + return WrapError(err) + } var response map[string]interface{} d.Partial(true) @@ -181,10 +227,6 @@ func resourceAlicloudPvtzZoneUpdate(d *schema.ResourceData, meta interface{}) er request["UserClientIp"] = d.Get("user_client_ip") } action := "SetProxyPattern" - conn, err := client.NewPvtzClient() - if err != nil { - return WrapError(err) - } wait := incrementalWait(3*time.Second, 5*time.Second) err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) @@ -219,10 +261,6 @@ func resourceAlicloudPvtzZoneUpdate(d *schema.ResourceData, meta interface{}) er updateZoneRemarkReq["UserClientIp"] = d.Get("user_client_ip") } action := "UpdateZoneRemark" - conn, err := client.NewPvtzClient() - if err != nil { - return WrapError(err) - } wait := incrementalWait(3*time.Second, 5*time.Second) err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-01-01"), StringPointer("AK"), nil, updateZoneRemarkReq, &util.RuntimeOptions{}) @@ -241,6 +279,70 @@ func resourceAlicloudPvtzZoneUpdate(d *schema.ResourceData, meta interface{}) er } d.SetPartial("remark") } + + update = false + UpdateSyncEcsHostTaskReq := map[string]interface{}{ + "ZoneId": d.Id(), + } + if d.HasChange("sync_status") || d.HasChange("user_info") { + update = true + } + if v, ok := d.GetOk("sync_status"); ok { + UpdateSyncEcsHostTaskReq["Status"] = v + } + if v, ok := d.GetOk("user_info"); ok { + for _, raw := range v.(*schema.Set).List() { + obj := raw.(map[string]interface{}) + for index, val := range obj["region_ids"].(*schema.Set).List() { + UpdateSyncEcsHostTaskReq[fmt.Sprintf("Region.%d.UserId", index+1)] = obj["user_id"] + UpdateSyncEcsHostTaskReq[fmt.Sprintf("Region.%d.RegionId", index+1)] = val + } + } + } + if update { + if _, ok := d.GetOk("lang"); ok { + updateZoneRemarkReq["Lang"] = d.Get("lang") + } + if _, ok := d.GetOk("user_info"); !ok { + object, err := pvtzService.DescribePvtzZone(d.Id()) + if err != nil { + return WrapError(err) + } + if v, ok := object["SyncHostTask"]; ok && v != nil { + syncObject := v.(map[string]interface{}) + for _, raw := range syncObject["EcsRegions"].(map[string]interface{})["EcsRegion"].([]interface{}) { + obj := raw.(map[string]interface{}) + for index, region := range obj["RegionIds"].(map[string]interface{})["RegionId"].([]interface{}) { + UpdateSyncEcsHostTaskReq[fmt.Sprintf("Region.%d.UserId", index+1)] = obj["user_id"] + UpdateSyncEcsHostTaskReq[fmt.Sprintf("Region.%d.RegionId", index+1)] = region + } + } + } + } + action := "UpdateSyncEcsHostTask" + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-01-01"), StringPointer("AK"), nil, UpdateSyncEcsHostTaskReq, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"MissingRegion"}) { + log.Printf("[DEBUG] Resource alicloud_private_zone_zone UpdateSyncEcsHostTask Missed Region!!! %s", err) + return nil + } + if IsExpectedErrors(err, []string{"ServiceUnavailable", "System.Busy", "Throttling.User"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + addDebug(action, response, request) + return nil + }) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("sync_status") + d.SetPartial("user_info") + } d.Partial(false) return resourceAlicloudPvtzZoneRead(d, meta) } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_quick_bi_user.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_quick_bi_user.go new file mode 100644 index 00000000000..3e4bf66b76c --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_quick_bi_user.go @@ -0,0 +1,224 @@ +package alicloud + +import ( + "fmt" + "log" + "strings" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudQuickBiUser() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudQuickBiUserCreate, + Read: resourceAlicloudQuickBiUserRead, + Update: resourceAlicloudQuickBiUserUpdate, + Delete: resourceAlicloudQuickBiUserDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "account_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "account_name": { + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + parts := strings.Split(new, ":") + if len(parts) < 2 { + return false + } + return parts[1] == old + }, + }, + "admin_user": { + Type: schema.TypeBool, + Required: true, + }, + "auth_admin_user": { + Type: schema.TypeBool, + Required: true, + }, + "nick_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "user_type": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"Analyst", "Developer", "Visitor"}, false), + }, + }, + } +} + +func resourceAlicloudQuickBiUserCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "AddUser" + request := make(map[string]interface{}) + conn, err := client.NewQuickbiClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("account_id"); ok { + request["AccountId"] = v + } + request["AccountName"] = d.Get("account_name") + request["AdminUser"] = d.Get("admin_user") + request["AuthAdminUser"] = d.Get("auth_admin_user") + request["NickName"] = d.Get("nick_name") + request["UserType"] = convertQuickBiUserUserTypeRequest(d.Get("user_type").(string)) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-08-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_quick_bi_user", action, AlibabaCloudSdkGoERROR) + } + responseResult := response["Result"].(map[string]interface{}) + d.SetId(fmt.Sprint(responseResult["UserId"])) + + return resourceAlicloudQuickBiUserRead(d, meta) +} +func resourceAlicloudQuickBiUserRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + quickbiPublicService := QuickbiPublicService{client} + object, err := quickbiPublicService.DescribeQuickBiUser(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_quick_bi_user quickbiPublicService.DescribeQuickBiUser Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + + d.Set("account_id", object["AccountId"]) + d.Set("account_name", object["AccountName"]) + d.Set("admin_user", object["AdminUser"]) + d.Set("auth_admin_user", object["AuthAdminUser"]) + d.Set("nick_name", object["NickName"]) + d.Set("user_type", convertQuickBiUserUserTypeResponse(formatInt(object["UserType"]))) + return nil +} +func resourceAlicloudQuickBiUserUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "UserId": d.Id(), + } + if d.HasChange("admin_user") || d.IsNewResource() { + update = true + } + request["AdminUser"] = d.Get("admin_user") + if d.HasChange("auth_admin_user") || d.IsNewResource() { + update = true + } + request["AuthAdminUser"] = d.Get("auth_admin_user") + + request["NickName"] = d.Get("nick_name") + if d.HasChange("user_type") { + update = true + } + request["UserType"] = convertQuickBiUserUserTypeRequest(d.Get("user_type").(string)) + if update { + action := "UpdateUser" + conn, err := client.NewQuickbiClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-08-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudQuickBiUserRead(d, meta) +} +func resourceAlicloudQuickBiUserDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteUser" + var response map[string]interface{} + conn, err := client.NewQuickbiClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "UserId": d.Id(), + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-08-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"User.Not.In.Organization"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} +func convertQuickBiUserUserTypeRequest(source interface{}) interface{} { + switch source { + case "Analyst": + return 3 + case "Developer": + return 1 + case "Visitor": + return 2 + } + return 0 +} +func convertQuickBiUserUserTypeResponse(source interface{}) interface{} { + switch source { + case 3: + return "Analyst" + case 1: + return "Developer" + case 2: + return "Visitor" + } + return "" +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ram_role.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ram_role.go index fb4246e2a95..120d1d3fc99 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ram_role.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ram_role.go @@ -3,6 +3,8 @@ package alicloud import ( "time" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" @@ -71,7 +73,6 @@ func resourceAlicloudRamRole() *schema.Resource { "description": { Type: schema.TypeString, Optional: true, - ForceNew: true, }, "version": { Type: schema.TypeString, @@ -122,40 +123,54 @@ func resourceAlicloudRamRoleCreate(d *schema.ResourceData, meta interface{}) err func resourceAlicloudRamRoleUpdate(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) ramService := RamService{client} - - request := ram.CreateUpdateRoleRequest() - request.RegionId = client.RegionId - request.RoleName = d.Id() - - attributeUpdate := false - + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "RoleName": d.Id(), + } if d.HasChange("document") { - attributeUpdate = true - request.NewAssumeRolePolicyDocument = d.Get("document").(string) - + update = true + request["NewAssumeRolePolicyDocument"] = d.Get("document").(string) } else if d.HasChange("ram_users") || d.HasChange("services") || d.HasChange("version") { - attributeUpdate = true - + update = true document, err := ramService.AssembleRolePolicyDocument(d.Get("ram_users").(*schema.Set).List(), d.Get("services").(*schema.Set).List(), d.Get("version").(string)) if err != nil { return WrapError(err) } - request.NewAssumeRolePolicyDocument = document + request["NewAssumeRolePolicyDocument"] = document } if d.HasChange("max_session_duration") { - attributeUpdate = true - request.NewMaxSessionDuration = requests.NewInteger(d.Get("max_session_duration").(int)) + update = true + request["NewMaxSessionDuration"] = d.Get("max_session_duration") } - - if attributeUpdate { - raw, err := client.WithRamClient(func(ramClient *ram.Client) (interface{}, error) { - return ramClient.UpdateRole(request) + if d.HasChange("description") { + update = true + request["NewDescription"] = d.Get("description") + } + if update { + action := "UpdateRole" + conn, err := client.NewRamClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-05-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + addDebug(action, response, request) + return nil }) if err != nil { - return WrapErrorf(err, DefaultErrorMsg, d.Id(), request.GetActionName(), AlibabaCloudSdkGoERROR) + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) } - addDebug(request.GetActionName(), raw, request.RpcRequest, request) } + return resourceAlicloudRamRoleRead(d, meta) } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ram_security_preference.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ram_security_preference.go new file mode 100644 index 00000000000..cc5a970afdf --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ram_security_preference.go @@ -0,0 +1,209 @@ +package alicloud + +import ( + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudRamSecurityPreference() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudRamSecurityPreferenceCreate, + Read: resourceAlicloudRamSecurityPreferenceRead, + Update: resourceAlicloudRamSecurityPreferenceUpdate, + Delete: resourceAlicloudRamSecurityPreferenceDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "enable_save_mfa_ticket": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "allow_user_to_change_password": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "allow_user_to_manage_access_keys": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "allow_user_to_manage_mfa_devices": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "login_session_duration": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + }, + "login_network_masks": { + Type: schema.TypeString, + Optional: true, + }, + "enforce_mfa_for_login": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + }, + } +} + +func resourceAlicloudRamSecurityPreferenceCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "SetSecurityPreference" + request := make(map[string]interface{}) + conn, err := client.NewImsClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOkExists("allow_user_to_change_password"); ok { + request["AllowUserToChangePassword"] = v + } + if v, ok := d.GetOkExists("allow_user_to_manage_access_keys"); ok { + request["AllowUserToManageAccessKeys"] = v + } + if v, ok := d.GetOkExists("allow_user_to_manage_mfa_devices"); ok { + request["AllowUserToManageMFADevices"] = v + } + if v, ok := d.GetOkExists("enable_save_mfa_ticket"); ok { + request["EnableSaveMFATicket"] = v + } + if v, ok := d.GetOk("login_network_masks"); ok { + request["LoginNetworkMasks"] = v + } + if v, ok := d.GetOk("login_session_duration"); ok { + request["LoginSessionDuration"] = v + } + if v, ok := d.GetOk("enforce_mfa_for_login"); ok { + request["EnforceMFAForLogin"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-08-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_ram_security_preference", action, AlibabaCloudSdkGoERROR) + } + + d.SetId("RamSecurityPreference") + + return resourceAlicloudRamSecurityPreferenceRead(d, meta) +} +func resourceAlicloudRamSecurityPreferenceRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + ramService := RamService{client} + object, err := ramService.DescribeRamSecurityPreference(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_ram_security_preference ramService.DescribeRamSecurityPreference Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + if v, exist := object["AccessKeyPreference"].(map[string]interface{}); exist { + d.Set("allow_user_to_manage_access_keys", v["AllowUserToManageAccessKeys"]) + } + if v, exist := object["LoginProfilePreference"].(map[string]interface{}); exist { + d.Set("allow_user_to_change_password", v["AllowUserToChangePassword"]) + d.Set("enable_save_mfa_ticket", v["EnableSaveMFATicket"]) + d.Set("login_network_masks", v["LoginNetworkMasks"]) + d.Set("login_session_duration", v["LoginSessionDuration"]) + d.Set("enforce_mfa_for_login", v["EnforceMFAForLogin"]) + } + + if v, exist := object["MFAPreference"].(map[string]interface{}); exist { + d.Set("allow_user_to_manage_mfa_devices", v["AllowUserToManageMFADevices"]) + } + + return nil +} +func resourceAlicloudRamSecurityPreferenceUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + conn, err := client.NewImsClient() + if err != nil { + return WrapError(err) + } + var response map[string]interface{} + update := false + request := map[string]interface{}{} + + if d.HasChange("allow_user_to_change_password") { + update = true + } + request["AllowUserToChangePassword"] = d.Get("allow_user_to_change_password") + + if d.HasChange("allow_user_to_manage_access_keys") { + update = true + } + request["AllowUserToManageAccessKeys"] = d.Get("allow_user_to_manage_access_keys") + + if d.HasChange("allow_user_to_manage_mfa_devices") { + update = true + } + request["AllowUserToManageMFADevices"] = d.Get("allow_user_to_manage_mfa_devices") + + if d.HasChange("enable_save_mfa_ticket") { + update = true + } + request["EnableSaveMFATicket"] = d.Get("enable_save_mfa_ticket") + + if d.HasChange("login_network_masks") { + update = true + } + request["LoginNetworkMasks"] = d.Get("login_network_masks") + if d.HasChange("login_session_duration") { + update = true + } + request["LoginSessionDuration"] = d.Get("login_session_duration") + + if d.HasChange("enforce_mfa_for_login") { + update = true + } + request["EnforceMFAForLogin"] = d.Get("enforce_mfa_for_login") + + if update { + action := "SetSecurityPreference" + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-08-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudRamSecurityPreferenceRead(d, meta) +} +func resourceAlicloudRamSecurityPreferenceDelete(d *schema.ResourceData, meta interface{}) error { + log.Printf("[WARN] Cannot destroy resourceAlicloudRamSecurityPreference. Terraform will remove this resource from the state file, however resources may remain.") + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ram_user.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ram_user.go index 18151ed8944..4dea03b5d28 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ram_user.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ram_user.go @@ -289,7 +289,7 @@ func resourceAlicloudRamUserDelete(d *schema.ResourceData, meta interface{}) err }) if err != nil { if IsExpectedErrors(err, []string{"DeleteConflict.User.AccessKey", "DeleteConflict.User.Group", "DeleteConflict.User.Policy", "DeleteConflict.User.LoginProfile", "DeleteConflict.User.MFADevice"}) { - return WrapError(Error("The user can not has any access keys or login profile or attached group or attached policies or attached mfa device while deleting the user.- you can set force with true to force delete the user.")) + return WrapError(Error("The user can not be deleted if he has any access keys, login profile, groups, policies, or MFA device attached. You can force the deletion of the user by setting force equals true.")) } return WrapErrorf(err, DefaultErrorMsg, d.Id(), request.GetActionName(), AlibabaCloudSdkGoERROR) } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_rdc_organization.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_rdc_organization.go new file mode 100644 index 00000000000..bbf88eb9ab2 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_rdc_organization.go @@ -0,0 +1,134 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudRdcOrganization() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudRdcOrganizationCreate, + Read: resourceAlicloudRdcOrganizationRead, + Update: resourceAlicloudRdcOrganizationUpdate, + Delete: resourceAlicloudRdcOrganizationDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "desired_member_count": { + Type: schema.TypeInt, + Optional: true, + }, + "organization_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "real_pk": { + Type: schema.TypeString, + Optional: true, + }, + "source": { + Type: schema.TypeString, + Required: true, + }, + }, + } +} + +func resourceAlicloudRdcOrganizationCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateDevopsOrganization" + request := make(map[string]interface{}) + conn, err := client.NewDevopsrdcClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("desired_member_count"); ok { + request["DesiredMemberCount"] = v + } + request["OrgName"] = d.Get("organization_name") + if v, ok := d.GetOk("real_pk"); ok { + request["RealPk"] = v + } + request["Source"] = d.Get("source") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-03-03"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_rdc_organization", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["Object"])) + + return resourceAlicloudRdcOrganizationRead(d, meta) +} +func resourceAlicloudRdcOrganizationRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + devopsRdcService := DevopsRdcService{client} + object, err := devopsRdcService.DescribeRdcOrganization(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_rdc_organization devopsRdcService.DescribeRdcOrganization Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("organization_name", object["Name"]) + return nil +} +func resourceAlicloudRdcOrganizationUpdate(d *schema.ResourceData, meta interface{}) error { + log.Println(fmt.Sprintf("[WARNING] The resouce has not update operation.")) + return resourceAlicloudRdcOrganizationRead(d, meta) +} +func resourceAlicloudRdcOrganizationDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteDevopsOrganization" + var response map[string]interface{} + conn, err := client.NewDevopsrdcClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "OrgId": d.Id(), + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-03-03"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidOrganization.NotFound"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_rds_account.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_rds_account.go index 9854898e883..96d9f74cf70 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_rds_account.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_rds_account.go @@ -23,7 +23,7 @@ func resourceAlicloudRdsAccount() *schema.Resource { State: schema.ImportStatePassthrough, }, Timeouts: &schema.ResourceTimeout{ - Create: schema.DefaultTimeout(5 * time.Minute), + Create: schema.DefaultTimeout(10 * time.Minute), Delete: schema.DefaultTimeout(5 * time.Minute), Update: schema.DefaultTimeout(6 * time.Minute), }, @@ -366,13 +366,41 @@ func resourceAlicloudRdsAccountDelete(d *schema.ResourceData, meta interface{}) err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) if err != nil { - if NeedRetry(err) { + if NeedRetry(err) && IsExpectedErrors(err, []string{"InternalError", "OperationDenied.DBClusterStatus", "OperationDenied.DBInstanceStatus", "OperationDenied.DBStatus"}) { wait() return resource.RetryableError(err) } return resource.NonRetryableError(err) } addDebug(action, response, request) + object, err := rdsService.DescribeRdsAccount(d.Id()) + if err != nil { + if NotFoundError(err) { + return nil + } + return resource.NonRetryableError(err) + } + if fmt.Sprint(object["AccountStatus"]) == "Lock" { + action = "UnlockAccount" + wait = incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + addDebug(action, response, request) + return nil + }) + if err != nil { + return resource.NonRetryableError(err) + } + action = "DeleteAccount" + return resource.RetryableError(fmt.Errorf("there need to delete account %s again after unlock it", d.Id())) + } return nil }) if err != nil { diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_rds_backup.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_rds_backup.go new file mode 100644 index 00000000000..f153cac0bb4 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_rds_backup.go @@ -0,0 +1,179 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudRdsBackup() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudRdsBackupCreate, + Read: resourceAlicloudRdsBackupRead, + Update: resourceAlicloudRdsBackupUpdate, + Delete: resourceAlicloudRdsBackupDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(20 * time.Minute), + Delete: schema.DefaultTimeout(20 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "backup_method": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "backup_strategy": { + Type: schema.TypeString, + Optional: true, + }, + "backup_type": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "db_instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "db_name": { + Type: schema.TypeString, + Optional: true, + }, + "backup_id": { + Type: schema.TypeString, + Computed: true, + }, + "remove_from_state": { + Type: schema.TypeBool, + Optional: true, + }, + "store_status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudRdsBackupCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + rdsService := RdsService{client} + var response map[string]interface{} + action := "CreateBackup" + request := make(map[string]interface{}) + request["SourceIp"] = client.SourceIp + conn, err := client.NewRdsClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("backup_method"); ok { + request["BackupMethod"] = v + } + if v, ok := d.GetOk("backup_strategy"); ok { + request["BackupStrategy"] = v + } + if v, ok := d.GetOk("backup_type"); ok { + request["BackupType"] = v + } + request["DBInstanceId"] = d.Get("db_instance_id") + if v, ok := d.GetOk("db_name"); ok { + request["DBName"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_rds_backup", action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Finished"}, d.Timeout(schema.TimeoutCreate), 20*time.Second, rdsService.RdsBackupStateRefreshFunc(d.Get("db_instance_id").(string), response["BackupJobId"].(string), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + // Wait one minute because the query API(DescribeBackups) has not been synchronized when the backup status is Finished + time.Sleep(1 * time.Minute) + object, err := rdsService.DescribeBackupTasks(d.Get("db_instance_id").(string), response["BackupJobId"].(string)) + d.SetId(fmt.Sprint(request["DBInstanceId"], ":", object["BackupId"].(string))) + return resourceAlicloudRdsBackupRead(d, meta) +} + +func resourceAlicloudRdsBackupRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + rdsService := RdsService{client} + object, err := rdsService.DescribeRdsBackup(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_rds_backup rdsService.DescribeRdsBackup Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + + d.Set("backup_method", object["BackupMethod"]) + d.Set("backup_type", object["BackupType"]) + d.Set("db_instance_id", object["DBInstanceId"]) + d.Set("backup_id", object["BackupId"]) + d.Set("store_status", object["StoreStatus"]) + return nil +} +func resourceAlicloudRdsBackupUpdate(d *schema.ResourceData, meta interface{}) error { + log.Println(fmt.Sprintf("[WARNING] The resouce has not update operation.")) + return resourceAlicloudRdsBackupRead(d, meta) +} +func resourceAlicloudRdsBackupDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteBackup" + parts, err := ParseResourceId(d.Id(), 2) + if d.Get("store_status").(string) == "Disabled" { + if !d.Get("remove_from_state").(bool) { + return WrapError(Error("the resource can not be deleted at this time and you can set remove_from_state to true to remove it.")) + } else { + return nil + } + } + var response map[string]interface{} + conn, err := client.NewRdsClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "BackupId": parts[1], + "DBInstanceId": parts[0], + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_rds_clone_db_instance.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_rds_clone_db_instance.go new file mode 100644 index 00000000000..bffb0a2c9f2 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_rds_clone_db_instance.go @@ -0,0 +1,1105 @@ +package alicloud + +import ( + "fmt" + "log" + "strings" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudRdsCloneDbInstance() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudRdsCloneDbInstanceCreate, + Read: resourceAlicloudRdsCloneDbInstanceRead, + Update: resourceAlicloudRdsCloneDbInstanceUpdate, + Delete: resourceAlicloudRdsCloneDbInstanceDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(300 * time.Minute), + Update: schema.DefaultTimeout(30 * time.Minute), + Delete: schema.DefaultTimeout(20 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "acl": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"cert", "perfer", "verify-ca", "verify-full"}, false), + Computed: true, + }, + "auto_upgrade_minor_version": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"Auto", "Manual"}, false), + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + return d.Get("engine").(string) != "MySQL" + }, + }, + "backup_id": { + Type: schema.TypeString, + Optional: true, + }, + "backup_type": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"FullBackup", "IncrementalBackup"}, false), + }, + "ca_type": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"aliyun", "custom"}, false), + Computed: true, + }, + "category": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"AlwaysOn", "Basic", "Finance", "HighAvailability"}, false), + }, + "certificate": { + Type: schema.TypeString, + Optional: true, + }, + "client_ca_enabled": { + Type: schema.TypeInt, + Optional: true, + }, + "client_ca_cert": { + Type: schema.TypeString, + Optional: true, + }, + "client_cert_revocation_list": { + Type: schema.TypeString, + Optional: true, + }, + "client_crl_enabled": { + Type: schema.TypeInt, + Optional: true, + }, + "connection_string": { + Type: schema.TypeString, + Computed: true, + }, + "connection_string_prefix": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(8, 64), + }, + "db_instance_class": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "db_instance_description": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(2, 256), + }, + "db_instance_storage": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + }, + "db_instance_storage_type": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"cloud_essd", "cloud_essd2", "cloud_essd3", "cloud_ssd", "local_ssd"}, false), + }, + "db_name": { + Type: schema.TypeString, + Optional: true, + }, + "db_names": { + Type: schema.TypeString, + Optional: true, + }, + "dedicated_host_group_id": { + Type: schema.TypeString, + Optional: true, + }, + "direction": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"Auto", "Down", "TempUpgrade", "Up"}, false), + }, + "effective_time": { + Type: schema.TypeString, + Optional: true, + }, + "encryption_key": { + Type: schema.TypeString, + Optional: true, + }, + "engine": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + }, + "engine_version": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + }, + "force_restart": { + Type: schema.TypeBool, + Optional: true, + }, + "ha_mode": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"RPO", "RTO"}, false), + }, + "instance_network_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Classic", "VPC"}, false), + Computed: true, + }, + "maintain_time": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "password": { + Type: schema.TypeString, + Optional: true, + }, + "payment_type": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"PayAsYouGo", "Subscription"}, false), + }, + "period": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"Month", "Year"}, false), + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + return d.Get("payment_type").(string) != "Subscription" + }, + }, + "port": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "private_ip_address": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "private_key": { + Type: schema.TypeString, + Optional: true, + }, + "released_keep_policy": { + Type: schema.TypeString, + Optional: true, + }, + "replication_acl": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"cert", "perfer", "verify-ca", "verify-full"}, false), + Computed: true, + }, + "resource_group_id": { + Type: schema.TypeString, + Optional: true, + }, + "restore_table": { + Type: schema.TypeString, + Optional: true, + }, + "restore_time": { + Type: schema.TypeString, + Optional: true, + }, + "role_arn": { + Type: schema.TypeString, + Optional: true, + }, + "security_ips": { + Type: schema.TypeSet, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + Optional: true, + }, + "server_cert": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "server_key": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "source_biz": { + Type: schema.TypeString, + Optional: true, + }, + "source_db_instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "ssl_enabled": { + Type: schema.TypeInt, + ValidateFunc: validation.IntInSlice([]int{0, 1}), + Optional: true, + Computed: true, + }, + "switch_time": { + Type: schema.TypeString, + Optional: true, + }, + "sync_mode": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"Async", "Semi-sync", "Sync"}, false), + }, + "tde_status": { + Type: schema.TypeString, + Optional: true, + }, + "table_meta": { + Type: schema.TypeString, + Optional: true, + }, + "used_time": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validation.IntInSlice([]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24, 36}), + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + return d.Get("payment_type").(string) != "Subscription" + }, + }, + "vpc_id": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "vswitch_id": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "zone_id": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + }, + "parameters": { + Type: schema.TypeSet, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "value": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + Set: parameterToHash, + Optional: true, + Computed: true, + }, + }, + } +} + +func resourceAlicloudRdsCloneDbInstanceCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + rdsService := RdsService{client} + var response map[string]interface{} + action := "CloneDBInstance" + request := make(map[string]interface{}) + request["SourceIp"] = client.SourceIp + conn, err := client.NewRdsClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("backup_id"); ok { + request["BackupId"] = v + } + if v, ok := d.GetOk("backup_type"); ok { + request["BackupType"] = v + } + if v, ok := d.GetOk("category"); ok { + request["Category"] = v + } + if v, ok := d.GetOk("db_instance_class"); ok { + request["DBInstanceClass"] = v + } + if v, ok := d.GetOk("db_instance_storage"); ok { + request["DBInstanceStorage"] = v + } + request["DBInstanceStorageType"] = d.Get("db_instance_storage_type") + if v, ok := d.GetOk("db_names"); ok { + request["DbNames"] = v + } + if v, ok := d.GetOk("dedicated_host_group_id"); ok { + request["DedicatedHostGroupId"] = v + } + if v, ok := d.GetOk("instance_network_type"); ok { + request["InstanceNetworkType"] = v + } + request["PayType"] = convertRdsInstancePaymentTypeRequest(d.Get("payment_type")) + if v, ok := d.GetOk("period"); ok { + request["Period"] = v + } + if v, ok := d.GetOk("private_ip_address"); ok { + request["PrivateIpAddress"] = v + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("restore_table"); ok { + request["RestoreTable"] = v + } + if v, ok := d.GetOk("restore_time"); ok { + request["RestoreTime"] = v + } + request["DBInstanceId"] = d.Get("source_db_instance_id") + if v, ok := d.GetOk("table_meta"); ok { + request["TableMeta"] = v + } + if v, ok := d.GetOk("used_time"); ok { + request["UsedTime"] = v + } + if v, ok := d.GetOk("zone_id"); ok { + request["ZoneId"] = v + } + if v, ok := d.GetOk("vpc_id"); ok { + request["VPCId"] = v + } + if v, ok := d.GetOk("vswitch_id"); ok { + request["VSwitchId"] = v + } + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"undefined"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_rds_clone_db_instance", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["DBInstanceId"])) + // wait instance status change from Creating to running + stateConf := BuildStateConf([]string{"Creating"}, []string{"Running"}, d.Timeout(schema.TimeoutCreate), 3*time.Minute, rdsService.RdsDBInstanceStateRefreshFunc(d.Id(), []string{"Deleting"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudRdsCloneDbInstanceUpdate(d, meta) +} +func resourceAlicloudRdsCloneDbInstanceRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + rdsService := RdsService{client} + object, err := rdsService.DescribeRdsCloneDbInstance(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_rds_clone_db_instance rdsService.DescribeRdsCloneDbInstance Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("auto_upgrade_minor_version", object["AutoUpgradeMinorVersion"]) + d.Set("category", object["Category"]) + d.Set("db_instance_class", object["DBInstanceClass"]) + d.Set("db_instance_description", object["DBInstanceDescription"]) + if v, ok := object["DBInstanceStorage"]; ok && fmt.Sprint(v) != "0" { + d.Set("db_instance_storage", formatInt(v)) + } + d.Set("db_instance_storage_type", object["DBInstanceStorageType"]) + d.Set("dedicated_host_group_id", object["DedicatedHostGroupId"]) + d.Set("engine", object["Engine"]) + d.Set("engine_version", object["EngineVersion"]) + d.Set("instance_network_type", object["InstanceNetworkType"]) + d.Set("maintain_time", object["MaintainTime"]) + d.Set("vswitch_id", object["VSwitchId"]) + d.Set("zone_id", object["ZoneId"]) + d.Set("payment_type", convertRdsInstancePaymentTypeResponse(object["PayType"])) + d.Set("port", object["Port"]) + d.Set("connection_string", object["ConnectionString"]) + + if err = rdsService.RefreshParameters(d, "parameters"); err != nil { + return WrapError(err) + } + describeDBInstanceHAConfigObject, err := rdsService.DescribeDBInstanceHAConfig(d.Id()) + if err != nil { + return WrapError(err) + } + d.Set("sync_mode", describeDBInstanceHAConfigObject["SyncMode"]) + d.Set("ha_mode", describeDBInstanceHAConfigObject["HAMode"]) + dbInstanceIpArrayName := "default" + describeDBInstanceIPArrayListObject, err := rdsService.GetSecurityIps(d.Id(), dbInstanceIpArrayName) + if err != nil { + return WrapError(err) + } + + d.Set("security_ips", describeDBInstanceIPArrayListObject) + describeDBInstanceNetInfoObject, err := rdsService.DescribeDBInstanceNetInfo(d.Id()) + if err != nil { + return WrapError(err) + } + + d.Set("private_ip_address", describeDBInstanceNetInfoObject[0].(map[string]interface{})["IPAddress"]) + + describeDBInstanceSSLObject, err := rdsService.DescribeDBInstanceSSL(d.Id()) + if err != nil { + return WrapError(err) + } + d.Set("acl", describeDBInstanceSSLObject["ACL"]) + d.Set("ca_type", describeDBInstanceSSLObject["CAType"]) + d.Set("client_ca_cert", describeDBInstanceSSLObject["ClientCACert"]) + d.Set("client_cert_revocation_list", describeDBInstanceSSLObject["ClientCertRevocationList"]) + d.Set("replication_acl", describeDBInstanceSSLObject["ReplicationACL"]) + d.Set("server_cert", describeDBInstanceSSLObject["ServerCert"]) + d.Set("server_key", describeDBInstanceSSLObject["ServerKey"]) + if v, ok := describeDBInstanceSSLObject["SSLEnabled"]; ok && v.(string) != "" { + sslEnabled := 0 + if v == "on" { + sslEnabled = 1 + } + d.Set("ssl_enabled'", sslEnabled) + } + return nil +} +func resourceAlicloudRdsCloneDbInstanceUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + rdsService := RdsService{client} + var response map[string]interface{} + d.Partial(true) + + if d.HasChange("parameters") { + if err := rdsService.ModifyParameters(d, "parameters"); err != nil { + return WrapError(err) + } + } + update := false + request := map[string]interface{}{ + "DBInstanceId": d.Id(), + } + if d.HasChange("auto_upgrade_minor_version") { + update = true + } + if v, ok := d.GetOk("auto_upgrade_minor_version"); ok { + request["AutoUpgradeMinorVersion"] = v + } + if update { + action := "ModifyDBInstanceAutoUpgradeMinorVersion" + conn, err := client.NewRdsClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("ModifyDBInstanceAutoUpgradeMinorVersion") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("auto_upgrade_minor_version") + } + update = false + modifyDBInstanceDescriptionReq := map[string]interface{}{ + "DBInstanceId": d.Id(), + } + if d.HasChange("db_instance_description") { + update = true + } + if v, ok := d.GetOk("db_instance_description"); ok { + modifyDBInstanceDescriptionReq["DBInstanceDescription"] = v + } + if update { + action := "ModifyDBInstanceDescription" + conn, err := client.NewRdsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, modifyDBInstanceDescriptionReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, modifyDBInstanceDescriptionReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("db_instance_description") + } + update = false + modifyDBInstanceMaintainTimeReq := map[string]interface{}{ + "DBInstanceId": d.Id(), + } + if d.HasChange("maintain_time") { + update = true + } + if v, ok := d.GetOk("maintain_time"); ok { + modifyDBInstanceMaintainTimeReq["MaintainTime"] = v + } + if update { + action := "ModifyDBInstanceMaintainTime" + conn, err := client.NewRdsClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("ModifyDBInstanceMaintainTime") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, modifyDBInstanceMaintainTimeReq, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, modifyDBInstanceMaintainTimeReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("maintain_time") + } + update = false + modifyDBInstanceHAConfigReq := map[string]interface{}{ + "DbInstanceId": d.Id(), + } + if d.HasChange("sync_mode") { + update = true + } + if d.HasChange("ha_mode") { + update = true + } + if update { + if v, ok := d.GetOk("sync_mode"); ok { + modifyDBInstanceHAConfigReq["SyncMode"] = v + } + if v, ok := d.GetOk("ha_mode"); ok { + modifyDBInstanceHAConfigReq["HAMode"] = v + } + action := "ModifyDBInstanceHAConfig" + conn, err := client.NewRdsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, modifyDBInstanceHAConfigReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, modifyDBInstanceHAConfigReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("sync_mode") + } + update = false + switchDBInstanceVpcReq := map[string]interface{}{ + "DBInstanceId": d.Id(), + } + if !d.IsNewResource() && d.HasChange("private_ip_address") { + update = true + if v, ok := d.GetOk("private_ip_address"); ok { + switchDBInstanceVpcReq["PrivateIpAddress"] = v + } + } + if !d.IsNewResource() && d.HasChange("vpc_id") { + update = true + if v, ok := d.GetOk("vpc_id"); ok { + switchDBInstanceVpcReq["VPCId"] = v + } + } + if !d.IsNewResource() && d.HasChange("vswitch_id") { + update = true + if v, ok := d.GetOk("vswitch_id"); ok { + switchDBInstanceVpcReq["VSwitchId"] = v + } + } + if update { + action := "SwitchDBInstanceVpc" + conn, err := client.NewRdsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, switchDBInstanceVpcReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, switchDBInstanceVpcReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + // wait instance status change from Creating to running + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutUpdate), 3*time.Minute, rdsService.RdsDBInstanceStateRefreshFunc(d.Id(), []string{"Deleting"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + d.SetPartial("private_ip_address") + d.SetPartial("vpc_id") + d.SetPartial("vswitch_id") + } + update = false + modifyDBInstanceConnectionStringReq := map[string]interface{}{ + "DBInstanceId": d.Id(), + } + if d.HasChange("port") { + update = true + } + if d.HasChange("connection_string_prefix") { + update = true + } + if v, ok := d.GetOk("connection_string"); ok { + modifyDBInstanceConnectionStringReq["CurrentConnectionString"] = v + } + if update { + if v, ok := d.GetOk("connection_string_prefix"); ok { + modifyDBInstanceConnectionStringReq["ConnectionStringPrefix"] = v + } + if v, ok := d.GetOk("port"); ok { + modifyDBInstanceConnectionStringReq["Port"] = v + } + action := "ModifyDBInstanceConnectionString" + conn, err := client.NewRdsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, modifyDBInstanceConnectionStringReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, modifyDBInstanceConnectionStringReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + // wait instance status change from Creating to running + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutUpdate), 3*time.Minute, rdsService.RdsDBInstanceStateRefreshFunc(d.Id(), []string{"Deleting"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + d.SetPartial("connection_string") + } + update = false + modifyDBInstanceTDEReq := map[string]interface{}{ + "DBInstanceId": d.Id(), + } + if d.HasChange("encryption_key") { + update = true + if v, ok := d.GetOk("encryption_key"); ok { + modifyDBInstanceTDEReq["EncryptionKey"] = v + } + } + if update { + if v, ok := d.GetOk("tde_status"); ok { + modifyDBInstanceTDEReq["TDEStatus"] = v + } + if v, ok := d.GetOk("certificate"); ok { + modifyDBInstanceTDEReq["Certificate"] = v + } + if v, ok := d.GetOk("db_name"); ok { + modifyDBInstanceTDEReq["DBName"] = v + } + if v, ok := d.GetOk("password"); ok { + modifyDBInstanceTDEReq["PassWord"] = v + } + if v, ok := d.GetOk("private_key"); ok { + modifyDBInstanceTDEReq["PrivateKey"] = v + } + if v, ok := d.GetOk("role_arn"); ok { + modifyDBInstanceTDEReq["RoleArn"] = v + } + action := "ModifyDBInstanceTDE" + conn, err := client.NewRdsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, modifyDBInstanceTDEReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, modifyDBInstanceTDEReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + // wait instance status change from Creating to running + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutUpdate), 3*time.Minute, rdsService.RdsDBInstanceStateRefreshFunc(d.Id(), []string{"Deleting"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + d.SetPartial("encryption_key") + } + update = false + modifySecurityIpsReq := map[string]interface{}{ + "DBInstanceId": d.Id(), + } + if d.HasChange("security_ips") { + update = true + ipList := expandStringList(d.Get("security_ips").(*schema.Set).List()) + ipstr := strings.Join(ipList[:], COMMA_SEPARATED) + // default disable connect from outside + if ipstr == "" { + ipstr = LOCAL_HOST_IP + } + modifySecurityIpsReq["SecurityIps"] = ipstr + } + if update { + action := "ModifySecurityIps" + conn, err := client.NewRdsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, modifySecurityIpsReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, modifySecurityIpsReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("security_ips") + } + update = false + modifyDBInstanceSSLReq := map[string]interface{}{ + "DBInstanceId": d.Id(), + } + + if v, ok := d.GetOk("connection_string"); ok { + modifyDBInstanceSSLReq["ConnectionString"] = v + } + if d.HasChange("acl") { + update = true + if v, ok := d.GetOk("acl"); ok { + modifyDBInstanceSSLReq["ACL"] = v + } + } + if d.HasChange("ca_type") { + update = true + if v, ok := d.GetOk("ca_type"); ok { + modifyDBInstanceSSLReq["CAType"] = v + } + } + if d.HasChange("client_ca_cert") { + update = true + if v, ok := d.GetOk("client_ca_cert"); ok { + modifyDBInstanceSSLReq["ClientCACert"] = v + } + } + if d.HasChange("client_cert_revocation_list") { + update = true + if v, ok := d.GetOk("client_cert_revocation_list"); ok { + modifyDBInstanceSSLReq["ClientCertRevocationList"] = v + } + } + if d.HasChange("replication_acl") { + update = true + if v, ok := d.GetOk("replication_acl"); ok { + modifyDBInstanceSSLReq["ReplicationACL"] = v + } + } + if d.HasChange("server_cert") { + update = true + if v, ok := d.GetOk("server_cert"); ok { + modifyDBInstanceSSLReq["ServerCert"] = v + } + } + if d.HasChange("server_key") { + update = true + if v, ok := d.GetOk("server_key"); ok { + modifyDBInstanceSSLReq["ServerKey"] = v + } + } + if d.HasChange("client_ca_enabled") { + update = true + if v, ok := d.GetOk("client_ca_enabled"); ok { + modifyDBInstanceSSLReq["ClientCAEnabled"] = v + } + } + if d.HasChange("client_crl_enabled") { + update = true + if v, ok := d.GetOk("client_crl_enabled"); ok { + modifyDBInstanceSSLReq["ClientCrlEnabled"] = v + } + } + if d.HasChange("ssl_enabled") { + update = true + if v, ok := d.GetOk("ssl_enabled"); ok { + modifyDBInstanceSSLReq["SSLEnabled"] = v + } + } + if update { + action := "ModifyDBInstanceSSL" + conn, err := client.NewRdsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, modifyDBInstanceSSLReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, modifyDBInstanceSSLReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + // wait instance status change from Creating to running + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutUpdate), 3*time.Minute, rdsService.RdsDBInstanceStateRefreshFunc(d.Id(), []string{"Deleting"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + d.SetPartial("connection_string") + d.SetPartial("acl") + d.SetPartial("ca_type") + d.SetPartial("client_ca_cert") + d.SetPartial("client_cert_revocation_list") + d.SetPartial("replication_acl") + d.SetPartial("server_cert") + d.SetPartial("server_key") + d.SetPartial("ssl_enabled") + } + update = false + modifyDBInstanceSpecReq := map[string]interface{}{ + "DBInstanceId": d.Id(), + } + if !d.IsNewResource() && d.HasChange("payment_type") { + update = true + } + if v, ok := d.GetOk("payment_type"); ok { + modifyDBInstanceSpecReq["PayType"] = convertRdsInstancePaymentTypeRequest(v) + } + if !d.IsNewResource() && d.HasChange("db_instance_class") { + update = true + if v, ok := d.GetOk("db_instance_class"); ok { + modifyDBInstanceSpecReq["DBInstanceClass"] = v + } + } + if !d.IsNewResource() && d.HasChange("db_instance_storage") { + update = true + if v, ok := d.GetOk("db_instance_storage"); ok { + modifyDBInstanceSpecReq["DBInstanceStorage"] = v + } + } + if !d.IsNewResource() && d.HasChange("db_instance_storage_type") { + update = true + modifyDBInstanceSpecReq["DBInstanceStorageType"] = d.Get("db_instance_storage_type") + } + if !d.IsNewResource() && d.HasChange("dedicated_host_group_id") { + update = true + if v, ok := d.GetOk("dedicated_host_group_id"); ok { + modifyDBInstanceSpecReq["DedicatedHostGroupId"] = v + } + } + if d.HasChange("engine_version") { + update = true + if v, ok := d.GetOk("engine_version"); ok { + modifyDBInstanceSpecReq["EngineVersion"] = v + } + } + if !d.IsNewResource() && d.HasChange("zone_id") { + update = true + if v, ok := d.GetOk("zone_id"); ok { + modifyDBInstanceSpecReq["ZoneId"] = v + } + } + if update { + if v, ok := d.GetOk("direction"); ok { + modifyDBInstanceSpecReq["Direction"] = v + } + if v, ok := d.GetOk("effective_time"); ok { + modifyDBInstanceSpecReq["EffectiveTime"] = v + } + if v, ok := d.GetOk("resource_group_id"); ok { + modifyDBInstanceSpecReq["ResourceGroupId"] = v + } + if v, ok := d.GetOk("source_biz"); ok { + modifyDBInstanceSpecReq["SourceBiz"] = v + } + if v, ok := d.GetOk("switch_time"); ok { + modifyDBInstanceSpecReq["SwitchTime"] = v + } + if v, ok := d.GetOk("used_time"); ok { + modifyDBInstanceSpecReq["UsedTime"] = v + } + action := "ModifyDBInstanceSpec" + conn, err := client.NewRdsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, modifyDBInstanceSpecReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, modifyDBInstanceSpecReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + // wait instance status change from Creating to running + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutUpdate), 3*time.Minute, rdsService.RdsDBInstanceStateRefreshFunc(d.Id(), []string{"Deleting"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + d.SetPartial("db_instance_class") + d.SetPartial("db_instance_storage") + d.SetPartial("db_instance_storage_type") + d.SetPartial("dedicated_host_group_id") + d.SetPartial("engine_version") + d.SetPartial("zone_id") + } + d.Partial(false) + return resourceAlicloudRdsCloneDbInstanceRead(d, meta) +} +func resourceAlicloudRdsCloneDbInstanceDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteDBInstance" + var response map[string]interface{} + conn, err := client.NewRdsClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "DBInstanceId": d.Id(), + } + + request[""] = client.RegionId + if v, ok := d.GetOk("released_keep_policy"); ok { + request["ReleasedKeepPolicy"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} + +func convertRdsInstancePaymentTypeRequest(source interface{}) interface{} { + switch source { + case "PayAsYouGo": + return "Postpaid" + case "Subscription": + return "Prepaid" + } + return source +} +func convertRdsInstancePaymentTypeResponse(source interface{}) interface{} { + switch source { + case "Postpaid": + return "PayAsYouGo" + case "Prepaid": + return "Subscription" + } + return source +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_rds_upgrade_db_instance.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_rds_upgrade_db_instance.go new file mode 100644 index 00000000000..49e8198dd76 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_rds_upgrade_db_instance.go @@ -0,0 +1,1076 @@ +package alicloud + +import ( + "fmt" + "log" + "strings" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudRdsUpgradeDbInstance() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudRdsUpgradeDbInstanceCreate, + Read: resourceAlicloudRdsUpgradeDbInstanceRead, + Update: resourceAlicloudRdsUpgradeDbInstanceUpdate, + Delete: resourceAlicloudRdsUpgradeDbInstanceDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(300 * time.Minute), + Update: schema.DefaultTimeout(30 * time.Minute), + Delete: schema.DefaultTimeout(20 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "acl": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"cert", "perfer", "verify-ca", "verify-full"}, false), + Computed: true, + }, + "auto_upgrade_minor_version": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"Auto", "Manual"}, false), + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + return d.Get("engine").(string) != "MySQL" + }, + }, + "ca_type": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"aliyun", "custom"}, false), + Computed: true, + }, + "certificate": { + Type: schema.TypeString, + Optional: true, + }, + "client_ca_enabled": { + Type: schema.TypeInt, + Optional: true, + }, + "client_ca_cert": { + Type: schema.TypeString, + Optional: true, + }, + "client_cert_revocation_list": { + Type: schema.TypeString, + Optional: true, + }, + "client_crl_enabled": { + Type: schema.TypeInt, + Optional: true, + }, + "connection_string": { + Type: schema.TypeString, + Computed: true, + }, + "connection_string_prefix": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(8, 64), + }, + "db_instance_class": { + Type: schema.TypeString, + Required: true, + }, + "db_instance_description": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringLenBetween(2, 256), + }, + "db_instance_storage": { + Type: schema.TypeInt, + Required: true, + }, + "db_instance_storage_type": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"cloud_essd", "cloud_essd2", "cloud_essd3", "cloud_ssd", "local_ssd"}, false), + }, + "db_name": { + Type: schema.TypeString, + Optional: true, + }, + "dedicated_host_group_id": { + Type: schema.TypeString, + Optional: true, + }, + "direction": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"Auto", "Down", "TempUpgrade", "Up"}, false), + }, + "effective_time": { + Type: schema.TypeString, + Optional: true, + }, + "encryption_key": { + Type: schema.TypeString, + Optional: true, + }, + "engine": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + }, + "engine_version": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + }, + "force_restart": { + Type: schema.TypeBool, + Optional: true, + }, + "ha_mode": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"RPO", "RTO"}, false), + }, + "instance_network_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Classic", "VPC"}, false), + }, + "maintain_time": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "password": { + Type: schema.TypeString, + Optional: true, + }, + "payment_type": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"PayAsYouGo", "Subscription"}, false), + }, + "port": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "private_ip_address": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "private_key": { + Type: schema.TypeString, + Optional: true, + }, + "released_keep_policy": { + Type: schema.TypeString, + Optional: true, + }, + "replication_acl": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"cert", "perfer", "verify-ca", "verify-full"}, false), + Computed: true, + }, + "resource_group_id": { + Type: schema.TypeString, + Optional: true, + }, + "role_arn": { + Type: schema.TypeString, + Optional: true, + }, + "security_ips": { + Type: schema.TypeSet, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + Optional: true, + }, + "server_cert": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "server_key": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "source_biz": { + Type: schema.TypeString, + Optional: true, + }, + "source_db_instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "ssl_enabled": { + Type: schema.TypeInt, + ValidateFunc: validation.IntInSlice([]int{0, 1}), + Optional: true, + Computed: true, + }, + "switch_time": { + Type: schema.TypeString, + Optional: true, + }, + "sync_mode": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"Async", "Semi-sync", "Sync"}, false), + }, + "tde_status": { + Type: schema.TypeString, + Optional: true, + }, + "vpc_id": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "vswitch_id": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "zone_id": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + }, + "zone_id_slave_1": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + }, + "switch_time_mode": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"Immediate", "MaintainTime"}, false), + }, + "switch_over": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"true", "false"}, false), + }, + "collect_stat_mode": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"Before", "After"}, false), + }, + "target_major_version": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "parameters": { + Type: schema.TypeSet, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "value": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + Set: parameterToHash, + Optional: true, + Computed: true, + }, + }, + } +} + +func resourceAlicloudRdsUpgradeDbInstanceCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + rdsService := RdsService{client} + conn, err := client.NewRdsClient() + action := "UpgradeDBInstanceMajorVersionPrecheck" + request := map[string]interface{}{ + "RegionId": client.RegionId, + "DBInstanceId": d.Get("source_db_instance_id"), + "SourceIp": client.SourceIp, + } + if v, ok := d.GetOk("target_major_version"); ok && v.(string) != "" { + request["TargetMajorVersion"] = v + } + var response map[string]interface{} + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + addDebug(action, response, request) + stateConf := BuildStateConf([]string{}, []string{"Success"}, d.Timeout(schema.TimeoutCreate), 3*time.Second, rdsService.RdsUpgradeMajorVersionRefreshFunc(d.Get("source_db_instance_id").(string), formatInt(response["TaskId"]), []string{"Deleting"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + action = "UpgradeDBInstanceMajorVersion" + request = make(map[string]interface{}) + request["SourceIp"] = client.SourceIp + + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("db_instance_class"); ok { + request["DBInstanceClass"] = v + } + if v, ok := d.GetOk("db_instance_storage"); ok { + request["DBInstanceStorage"] = v + } + request["PayType"] = convertRdsInstancePaymentTypeRequest(d.Get("payment_type")) + if v, ok := d.GetOk("instance_network_type"); ok { + request["InstanceNetworkType"] = v + } + if v, ok := d.GetOk("switch_time_mode"); ok { + request["SwitchTimeMode"] = v + } + if v, ok := d.GetOk("switch_over"); ok { + request["SwitchOver"] = v + } + if v, ok := d.GetOk("collect_stat_mode"); ok { + request["CollectStatMode"] = v + } + if v, ok := d.GetOk("target_major_version"); ok { + request["TargetMajorVersion"] = v + } + request["DBInstanceId"] = d.Get("source_db_instance_id") + if v, ok := d.GetOk("vpc_id"); ok { + request["VPCId"] = v + } + if v, ok := d.GetOk("vswitch_id"); ok { + request["VSwitchId"] = v + } + if v, ok := d.GetOk("private_ip_address"); ok { + request["PrivateIpAddress"] = v + } + request["DBInstanceStorageType"] = d.Get("db_instance_storage_type") + if v, ok := d.GetOk("zone_id"); ok { + request["ZoneId"] = v + } + if v, ok := d.GetOk("zone_id_slave_1"); ok { + request["ZoneIdSlave1"] = v + } + wait = incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_rds_upgrade_db_instance", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["DBInstanceId"])) + // wait instance status change from Creating to running + stateConf = BuildStateConf([]string{"Creating"}, []string{"Running"}, d.Timeout(schema.TimeoutCreate), 3*time.Minute, rdsService.RdsDBInstanceStateRefreshFunc(d.Id(), []string{"Deleting"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudRdsUpgradeDbInstanceUpdate(d, meta) +} +func resourceAlicloudRdsUpgradeDbInstanceRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + rdsService := RdsService{client} + object, err := rdsService.DescribeRdsCloneDbInstance(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_rds_upgrade_db_instance rdsService.DescribeRdsCloneDbInstance Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("auto_upgrade_minor_version", object["AutoUpgradeMinorVersion"]) + d.Set("db_instance_class", object["DBInstanceClass"]) + d.Set("db_instance_description", object["DBInstanceDescription"]) + if v, ok := object["DBInstanceStorage"]; ok && fmt.Sprint(v) != "0" { + d.Set("db_instance_storage", formatInt(v)) + } + d.Set("db_instance_storage_type", object["DBInstanceStorageType"]) + d.Set("dedicated_host_group_id", object["DedicatedHostGroupId"]) + d.Set("engine", object["Engine"]) + d.Set("engine_version", object["EngineVersion"]) + d.Set("instance_network_type", object["InstanceNetworkType"]) + d.Set("maintain_time", object["MaintainTime"]) + d.Set("vpc_id", object["VpcId"]) + d.Set("vswitch_id", object["VSwitchId"]) + d.Set("zone_id", object["ZoneId"]) + if len(object["SlaveZones"].(map[string]interface{})["SlaveZone"].([]interface{})) > 0 { + d.Set("zone_id_slave_1", object["SlaveZones"].(map[string]interface{})["SlaveZone"].([]interface{})[0].(map[string]interface{})["ZoneId"]) + } + d.Set("payment_type", convertRdsInstancePaymentTypeResponse(object["PayType"])) + d.Set("port", object["Port"]) + d.Set("connection_string", object["ConnectionString"]) + + if err = rdsService.RefreshParameters(d, "parameters"); err != nil { + return WrapError(err) + } + describeDBInstanceHAConfigObject, err := rdsService.DescribeDBInstanceHAConfig(d.Id()) + if err != nil { + return WrapError(err) + } + d.Set("sync_mode", describeDBInstanceHAConfigObject["SyncMode"]) + d.Set("ha_mode", describeDBInstanceHAConfigObject["HAMode"]) + dbInstanceIpArrayName := "default" + describeDBInstanceIPArrayListObject, err := rdsService.GetSecurityIps(d.Id(), dbInstanceIpArrayName) + if err != nil { + return WrapError(err) + } + + d.Set("security_ips", describeDBInstanceIPArrayListObject) + describeDBInstanceNetInfoObject, err := rdsService.DescribeDBInstanceNetInfo(d.Id()) + if err != nil { + return WrapError(err) + } + + d.Set("private_ip_address", describeDBInstanceNetInfoObject[0].(map[string]interface{})["IPAddress"]) + + describeDBInstanceSSLObject, err := rdsService.DescribeDBInstanceSSL(d.Id()) + if err != nil { + return WrapError(err) + } + d.Set("acl", describeDBInstanceSSLObject["ACL"]) + d.Set("ca_type", describeDBInstanceSSLObject["CAType"]) + d.Set("client_ca_cert", describeDBInstanceSSLObject["ClientCACert"]) + d.Set("client_cert_revocation_list", describeDBInstanceSSLObject["ClientCertRevocationList"]) + d.Set("replication_acl", describeDBInstanceSSLObject["ReplicationACL"]) + d.Set("server_cert", describeDBInstanceSSLObject["ServerCert"]) + d.Set("server_key", describeDBInstanceSSLObject["ServerKey"]) + if v, ok := describeDBInstanceSSLObject["SSLEnabled"]; ok && v.(string) != "" { + sslEnabled := 0 + if v == "on" { + sslEnabled = 1 + } + d.Set("ssl_enabled'", sslEnabled) + } + return nil +} +func resourceAlicloudRdsUpgradeDbInstanceUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + rdsService := RdsService{client} + var response map[string]interface{} + d.Partial(true) + + if d.HasChange("parameters") { + if err := rdsService.ModifyParameters(d, "parameters"); err != nil { + return WrapError(err) + } + } + update := false + request := map[string]interface{}{ + "DBInstanceId": d.Id(), + } + if d.HasChange("auto_upgrade_minor_version") { + update = true + } + if v, ok := d.GetOk("auto_upgrade_minor_version"); ok { + request["AutoUpgradeMinorVersion"] = v + } + if update { + action := "ModifyDBInstanceAutoUpgradeMinorVersion" + conn, err := client.NewRdsClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("ModifyDBInstanceAutoUpgradeMinorVersion") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("auto_upgrade_minor_version") + } + update = false + modifyDBInstanceDescriptionReq := map[string]interface{}{ + "DBInstanceId": d.Id(), + } + if d.HasChange("db_instance_description") { + update = true + } + if v, ok := d.GetOk("db_instance_description"); ok { + modifyDBInstanceDescriptionReq["DBInstanceDescription"] = v + } + if update { + action := "ModifyDBInstanceDescription" + conn, err := client.NewRdsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, modifyDBInstanceDescriptionReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, modifyDBInstanceDescriptionReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("db_instance_description") + } + update = false + modifyDBInstanceMaintainTimeReq := map[string]interface{}{ + "DBInstanceId": d.Id(), + } + if d.HasChange("maintain_time") { + update = true + } + if v, ok := d.GetOk("maintain_time"); ok { + modifyDBInstanceMaintainTimeReq["MaintainTime"] = v + } + if update { + action := "ModifyDBInstanceMaintainTime" + conn, err := client.NewRdsClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("ModifyDBInstanceMaintainTime") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, modifyDBInstanceMaintainTimeReq, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, modifyDBInstanceMaintainTimeReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("maintain_time") + } + update = false + modifyDBInstanceHAConfigReq := map[string]interface{}{ + "DbInstanceId": d.Id(), + } + if d.HasChange("sync_mode") { + update = true + } + if d.HasChange("ha_mode") { + update = true + } + if update { + if v, ok := d.GetOk("sync_mode"); ok { + modifyDBInstanceHAConfigReq["SyncMode"] = v + } + if v, ok := d.GetOk("ha_mode"); ok { + modifyDBInstanceHAConfigReq["HAMode"] = v + } + action := "ModifyDBInstanceHAConfig" + conn, err := client.NewRdsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, modifyDBInstanceHAConfigReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, modifyDBInstanceHAConfigReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("sync_mode") + } + update = false + switchDBInstanceVpcReq := map[string]interface{}{ + "DBInstanceId": d.Id(), + } + if !d.IsNewResource() && d.HasChange("private_ip_address") { + update = true + if v, ok := d.GetOk("private_ip_address"); ok { + switchDBInstanceVpcReq["PrivateIpAddress"] = v + } + } + if !d.IsNewResource() && d.HasChange("vpc_id") { + update = true + if v, ok := d.GetOk("vpc_id"); ok { + switchDBInstanceVpcReq["VPCId"] = v + } + } + if !d.IsNewResource() && d.HasChange("vswitch_id") { + update = true + if v, ok := d.GetOk("vswitch_id"); ok { + switchDBInstanceVpcReq["VSwitchId"] = v + } + } + if update { + action := "SwitchDBInstanceVpc" + conn, err := client.NewRdsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, switchDBInstanceVpcReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, switchDBInstanceVpcReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + // wait instance status change from Creating to running + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutUpdate), 3*time.Minute, rdsService.RdsDBInstanceStateRefreshFunc(d.Id(), []string{"Deleting"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + d.SetPartial("private_ip_address") + d.SetPartial("vpc_id") + d.SetPartial("vswitch_id") + } + update = false + modifyDBInstanceConnectionStringReq := map[string]interface{}{ + "DBInstanceId": d.Id(), + } + if d.HasChange("port") { + update = true + } + if d.HasChange("connection_string_prefix") { + update = true + } + if v, ok := d.GetOk("connection_string"); ok { + modifyDBInstanceConnectionStringReq["CurrentConnectionString"] = v + } + if update { + if v, ok := d.GetOk("connection_string_prefix"); ok { + modifyDBInstanceConnectionStringReq["ConnectionStringPrefix"] = v + } + if v, ok := d.GetOk("port"); ok { + modifyDBInstanceConnectionStringReq["Port"] = v + } + action := "ModifyDBInstanceConnectionString" + conn, err := client.NewRdsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, modifyDBInstanceConnectionStringReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, modifyDBInstanceConnectionStringReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + // wait instance status change from Creating to running + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutUpdate), 3*time.Minute, rdsService.RdsDBInstanceStateRefreshFunc(d.Id(), []string{"Deleting"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + d.SetPartial("connection_string") + } + update = false + modifyDBInstanceTDEReq := map[string]interface{}{ + "DBInstanceId": d.Id(), + } + if d.HasChange("encryption_key") { + update = true + if v, ok := d.GetOk("encryption_key"); ok { + modifyDBInstanceTDEReq["EncryptionKey"] = v + } + } + if update { + if v, ok := d.GetOk("tde_status"); ok { + modifyDBInstanceTDEReq["TDEStatus"] = v + } + if v, ok := d.GetOk("certificate"); ok { + modifyDBInstanceTDEReq["Certificate"] = v + } + if v, ok := d.GetOk("db_name"); ok { + modifyDBInstanceTDEReq["DBName"] = v + } + if v, ok := d.GetOk("password"); ok { + modifyDBInstanceTDEReq["PassWord"] = v + } + if v, ok := d.GetOk("private_key"); ok { + modifyDBInstanceTDEReq["PrivateKey"] = v + } + if v, ok := d.GetOk("role_arn"); ok { + modifyDBInstanceTDEReq["RoleArn"] = v + } + action := "ModifyDBInstanceTDE" + conn, err := client.NewRdsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, modifyDBInstanceTDEReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, modifyDBInstanceTDEReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + // wait instance status change from Creating to running + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutUpdate), 3*time.Minute, rdsService.RdsDBInstanceStateRefreshFunc(d.Id(), []string{"Deleting"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + d.SetPartial("encryption_key") + } + update = false + modifySecurityIpsReq := map[string]interface{}{ + "DBInstanceId": d.Id(), + } + if d.HasChange("security_ips") { + update = true + ipList := expandStringList(d.Get("security_ips").(*schema.Set).List()) + ipstr := strings.Join(ipList[:], COMMA_SEPARATED) + if ipstr == "" { + ipstr = LOCAL_HOST_IP + } + modifySecurityIpsReq["SecurityIps"] = ipstr + } + if update { + action := "ModifySecurityIps" + conn, err := client.NewRdsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, modifySecurityIpsReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, modifySecurityIpsReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("security_ips") + } + update = false + modifyDBInstanceSSLReq := map[string]interface{}{ + "DBInstanceId": d.Id(), + } + + if v, ok := d.GetOk("connection_string"); ok { + modifyDBInstanceSSLReq["ConnectionString"] = v + } + if d.HasChange("acl") { + update = true + if v, ok := d.GetOk("acl"); ok { + modifyDBInstanceSSLReq["ACL"] = v + } + } + if d.HasChange("ca_type") { + update = true + if v, ok := d.GetOk("ca_type"); ok { + modifyDBInstanceSSLReq["CAType"] = v + } + } + if d.HasChange("client_ca_cert") { + update = true + if v, ok := d.GetOk("client_ca_cert"); ok { + modifyDBInstanceSSLReq["ClientCACert"] = v + } + } + if d.HasChange("client_cert_revocation_list") { + update = true + if v, ok := d.GetOk("client_cert_revocation_list"); ok { + modifyDBInstanceSSLReq["ClientCertRevocationList"] = v + } + } + if d.HasChange("replication_acl") { + update = true + if v, ok := d.GetOk("replication_acl"); ok { + modifyDBInstanceSSLReq["ReplicationACL"] = v + } + } + if d.HasChange("server_cert") { + update = true + if v, ok := d.GetOk("server_cert"); ok { + modifyDBInstanceSSLReq["ServerCert"] = v + } + } + if d.HasChange("server_key") { + update = true + if v, ok := d.GetOk("server_key"); ok { + modifyDBInstanceSSLReq["ServerKey"] = v + } + } + if d.HasChange("client_ca_enabled") { + update = true + if v, ok := d.GetOk("client_ca_enabled"); ok { + modifyDBInstanceSSLReq["ClientCAEnabled"] = v + } + } + if d.HasChange("client_crl_enabled") { + update = true + if v, ok := d.GetOk("client_crl_enabled"); ok { + modifyDBInstanceSSLReq["ClientCrlEnabled"] = v + } + } + if d.HasChange("ssl_enabled") { + update = true + if v, ok := d.GetOk("ssl_enabled"); ok { + modifyDBInstanceSSLReq["SSLEnabled"] = v + } + } + if update { + action := "ModifyDBInstanceSSL" + conn, err := client.NewRdsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, modifyDBInstanceSSLReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, modifyDBInstanceSSLReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + // wait instance status change from Creating to running + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutUpdate), 3*time.Minute, rdsService.RdsDBInstanceStateRefreshFunc(d.Id(), []string{"Deleting"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + d.SetPartial("connection_string") + d.SetPartial("acl") + d.SetPartial("ca_type") + d.SetPartial("client_ca_cert") + d.SetPartial("client_cert_revocation_list") + d.SetPartial("replication_acl") + d.SetPartial("server_cert") + d.SetPartial("server_key") + d.SetPartial("ssl_enabled") + } + update = false + modifyDBInstanceSpecReq := map[string]interface{}{ + "DBInstanceId": d.Id(), + } + if !d.IsNewResource() && d.HasChange("payment_type") { + update = true + } + if v, ok := d.GetOk("payment_type"); ok { + modifyDBInstanceSpecReq["PayType"] = convertRdsInstancePaymentTypeRequest(v) + } + if !d.IsNewResource() && d.HasChange("db_instance_class") { + update = true + if v, ok := d.GetOk("db_instance_class"); ok { + modifyDBInstanceSpecReq["DBInstanceClass"] = v + } + } + if !d.IsNewResource() && d.HasChange("db_instance_storage") { + update = true + if v, ok := d.GetOk("db_instance_storage"); ok { + modifyDBInstanceSpecReq["DBInstanceStorage"] = v + } + } + if !d.IsNewResource() && d.HasChange("db_instance_storage_type") { + update = true + modifyDBInstanceSpecReq["DBInstanceStorageType"] = d.Get("db_instance_storage_type") + } + if !d.IsNewResource() && d.HasChange("dedicated_host_group_id") { + update = true + if v, ok := d.GetOk("dedicated_host_group_id"); ok { + modifyDBInstanceSpecReq["DedicatedHostGroupId"] = v + } + } + if d.HasChange("engine_version") { + update = true + if v, ok := d.GetOk("engine_version"); ok { + modifyDBInstanceSpecReq["EngineVersion"] = v + } + } + if !d.IsNewResource() && d.HasChange("zone_id") { + update = true + if v, ok := d.GetOk("zone_id"); ok { + modifyDBInstanceSpecReq["ZoneId"] = v + } + } + if update { + if v, ok := d.GetOk("direction"); ok { + modifyDBInstanceSpecReq["Direction"] = v + } + if v, ok := d.GetOk("effective_time"); ok { + modifyDBInstanceSpecReq["EffectiveTime"] = v + } + if v, ok := d.GetOk("resource_group_id"); ok { + modifyDBInstanceSpecReq["ResourceGroupId"] = v + } + if v, ok := d.GetOk("source_biz"); ok { + modifyDBInstanceSpecReq["SourceBiz"] = v + } + if v, ok := d.GetOk("switch_time"); ok { + modifyDBInstanceSpecReq["SwitchTime"] = v + } + action := "ModifyDBInstanceSpec" + conn, err := client.NewRdsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, modifyDBInstanceSpecReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, modifyDBInstanceSpecReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + // wait instance status change from Creating to running + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutUpdate), 3*time.Minute, rdsService.RdsDBInstanceStateRefreshFunc(d.Id(), []string{"Deleting"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + d.SetPartial("db_instance_class") + d.SetPartial("db_instance_storage") + d.SetPartial("db_instance_storage_type") + d.SetPartial("dedicated_host_group_id") + d.SetPartial("engine_version") + d.SetPartial("zone_id") + } + d.Partial(false) + return resourceAlicloudRdsUpgradeDbInstanceRead(d, meta) +} +func resourceAlicloudRdsUpgradeDbInstanceDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteDBInstance" + var response map[string]interface{} + conn, err := client.NewRdsClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "DBInstanceId": d.Id(), + "RegionId": client.RegionId, + "SourceIp": client.SourceIp, + } + if v, ok := d.GetOk("released_keep_policy"); ok { + request["ReleasedKeepPolicy"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ros_stack_instance.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ros_stack_instance.go new file mode 100644 index 00000000000..f8b6dba54d6 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ros_stack_instance.go @@ -0,0 +1,299 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudRosStackInstance() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudRosStackInstanceCreate, + Read: resourceAlicloudRosStackInstanceRead, + Update: resourceAlicloudRosStackInstanceUpdate, + Delete: resourceAlicloudRosStackInstanceDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(10 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "operation_description": { + Type: schema.TypeString, + Optional: true, + }, + "operation_preferences": { + Type: schema.TypeString, + Optional: true, + }, + "parameter_overrides": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "parameter_key": { + Type: schema.TypeString, + Optional: true, + Sensitive: true, + }, + "parameter_value": { + Type: schema.TypeString, + Optional: true, + Sensitive: true, + }, + }, + }, + Sensitive: true, + }, + "stack_group_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-zA-Z][-_a-zA-Z0-9]{1,254}$`), "The name can be up to 255 characters in length and can contain digits, letters, hyphens (-), and underscores (_). It must start with a digit or letter."), + }, + "stack_instance_account_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^\d+$`), "It can only be made of numbers."), + }, + "stack_instance_region_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "timeout_in_minutes": { + Type: schema.TypeString, + Optional: true, + }, + "retain_stacks": { + Type: schema.TypeBool, + Optional: true, + }, + }, + } +} + +func resourceAlicloudRosStackInstanceCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateStackInstances" + request := make(map[string]interface{}) + conn, err := client.NewRosClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("parameter_overrides"); ok { + for parameterOverridesPtr, parameterOverrides := range v.(*schema.Set).List() { + parameterOverridesArg := parameterOverrides.(map[string]interface{}) + request["ParameterOverrides."+fmt.Sprint(parameterOverridesPtr+1)+".ParameterKey"] = parameterOverridesArg["parameter_key"] + request["ParameterOverrides."+fmt.Sprint(parameterOverridesPtr+1)+".ParameterValue"] = parameterOverridesArg["parameter_value"] + } + } + request["RegionId"] = client.RegionId + request["StackGroupName"] = d.Get("stack_group_name") + request["AccountIds"] = convertListToJsonString([]interface{}{d.Get("stack_instance_account_id")}) + request["RegionIds"] = convertListToJsonString([]interface{}{d.Get("stack_instance_region_id")}) + if v, ok := d.GetOk("timeout_in_minutes"); ok { + request["TimeoutInMinutes"] = v + } + if v, ok := d.GetOk("operation_preferences"); ok { + request["OperationPreferences"] = v + } + request["ClientToken"] = buildClientToken("CreateStackInstances") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-10"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_ros_stack_instance", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["StackGroupName"], ":", d.Get("stack_instance_account_id"), ":", d.Get("stack_instance_region_id"))) + rosService := RosService{client} + stateConf := BuildStateConf([]string{}, []string{"CURRENT"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, rosService.RosStackInstanceStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return resourceAlicloudRosStackInstanceRead(d, meta) +} +func resourceAlicloudRosStackInstanceRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + rosService := RosService{client} + object, err := rosService.DescribeRosStackInstance(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_ros_stack_instance rosService.DescribeRosStackInstance Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + d.Set("stack_group_name", parts[0]) + d.Set("stack_instance_account_id", parts[1]) + d.Set("stack_instance_region_id", parts[2]) + if parameterOverridesList, ok := object["ParameterOverrides"]; ok && parameterOverridesList != nil { + parameterOverridesMaps := make([]map[string]interface{}, 0) + for _, parameterOverridesListItem := range parameterOverridesList.([]interface{}) { + if v, ok := parameterOverridesListItem.(map[string]interface{}); ok { + parameterOverridesListItemMap := make(map[string]interface{}) + parameterOverridesListItemMap["parameter_key"] = v["ParameterKey"] + parameterOverridesListItemMap["parameter_value"] = v["ParameterValue"] + parameterOverridesMaps = append(parameterOverridesMaps, parameterOverridesListItemMap) + } + } + d.Set("parameter_overrides", parameterOverridesMaps) + } + + d.Set("status", object["Status"]) + return nil +} +func resourceAlicloudRosStackInstanceUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + update := false + request := map[string]interface{}{ + "StackGroupName": parts[0], + "AccountIds": convertListToJsonString([]interface{}{parts[1]}), + "RegionIds": convertListToJsonString([]interface{}{parts[2]}), + } + request["RegionId"] = client.RegionId + if d.HasChange("parameter_overrides") { + update = true + if v, ok := d.GetOk("parameter_overrides"); ok { + for parameterOverridesPtr, parameterOverrides := range v.(*schema.Set).List() { + parameterOverridesArg := parameterOverrides.(map[string]interface{}) + request["ParameterOverrides."+fmt.Sprint(parameterOverridesPtr+1)+".ParameterKey"] = parameterOverridesArg["parameter_key"] + request["ParameterOverrides."+fmt.Sprint(parameterOverridesPtr+1)+".ParameterValue"] = parameterOverridesArg["parameter_value"] + } + } + } + if d.HasChange("operation_description") { + update = true + if v, ok := d.GetOk("operation_description"); ok { + request["OperationDescription"] = v + } + } + if d.HasChange("operation_preferences") { + update = true + if v, ok := d.GetOk("operation_preferences"); ok { + request["OperationPreferences"] = v + } + } + if d.HasChange("timeout_in_minutes") { + update = true + if v, ok := d.GetOk("timeout_in_minutes"); ok { + request["TimeoutInMinutes"] = v + } + } + + if update { + action := "UpdateStackInstances" + conn, err := client.NewRosClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("UpdateStackInstances") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-10"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) || IsExpectedErrors(err, []string{"StackGroupOperationInProgress"}) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudRosStackInstanceRead(d, meta) +} +func resourceAlicloudRosStackInstanceDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + rosService := RosService{client} + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + action := "DeleteStackInstances" + var response map[string]interface{} + conn, err := client.NewRosClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "StackGroupName": parts[0], + "AccountIds": convertListToJsonString([]interface{}{parts[1]}), + "RegionIds": convertListToJsonString([]interface{}{parts[2]}), + } + + request["RegionId"] = client.RegionId + if v, ok := d.GetOkExists("retain_stacks"); ok { + request["RetainStacks"] = v + } else { + request["RetainStacks"] = false + } + request["ClientToken"] = buildClientToken("DeleteStackInstances") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-10"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) || IsExpectedErrors(err, []string{"StackGroupOperationInProgress"}) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, rosService.RosStackInstanceStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ros_template_scratch.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ros_template_scratch.go new file mode 100644 index 00000000000..e1aa67fbd5c --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ros_template_scratch.go @@ -0,0 +1,497 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudRosTemplateScratch() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudRosTemplateScratchCreate, + Read: resourceAlicloudRosTemplateScratchRead, + Update: resourceAlicloudRosTemplateScratchUpdate, + Delete: resourceAlicloudRosTemplateScratchDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(1 * time.Minute), + Delete: schema.DefaultTimeout(1 * time.Minute), + Update: schema.DefaultTimeout(1 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "description": { + Type: schema.TypeString, + Optional: true, + }, + "execution_mode": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"Async", "Sync"}, false), + }, + "logical_id_strategy": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"LongTypePrefixAndIndexSuffix", "LongTypePrefixAndHashSuffix", "ShortTypePrefixAndHashSuffix"}, false), + }, + "preference_parameters": { + Type: schema.TypeSet, + Optional: true, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "parameter_key": { + Type: schema.TypeString, + Required: true, + }, + "parameter_value": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + "source_tag": { + Type: schema.TypeSet, + Optional: true, + MaxItems: 1, + ExactlyOneOf: []string{"source_resource_group", "source_tag", "source_resources"}, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "resource_tags": { + Type: schema.TypeMap, + Required: true, + }, + "resource_type_filter": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + MaxItems: 20, + }, + }, + }, + }, + "source_resource_group": { + Type: schema.TypeSet, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "resource_group_id": { + Type: schema.TypeString, + Required: true, + }, + "resource_type_filter": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + MaxItems: 20, + }, + }, + }, + }, + "source_resources": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "resource_id": { + Type: schema.TypeString, + Required: true, + }, + "resource_type": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "template_scratch_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"ResourceImport", "ArchitectureReplication"}, false), + }, + }, + } +} + +func resourceAlicloudRosTemplateScratchCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateTemplateScratch" + request := make(map[string]interface{}) + conn, err := client.NewRosClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + if v, ok := d.GetOk("execution_mode"); ok { + request["ExecutionMode"] = v + } + if v, ok := d.GetOk("logical_id_strategy"); ok { + request["LogicalIdStrategy"] = v + } + if v, ok := d.GetOk("preference_parameters"); ok { + preferenceParametersMaps := make([]map[string]interface{}, 0) + for _, preferenceParameters := range v.(*schema.Set).List() { + preferenceParametersArg := preferenceParameters.(map[string]interface{}) + preferenceParametersMap := map[string]interface{}{} + preferenceParametersMap["ParameterKey"] = preferenceParametersArg["parameter_key"] + preferenceParametersMap["ParameterValue"] = preferenceParametersArg["parameter_value"] + preferenceParametersMaps = append(preferenceParametersMaps, preferenceParametersMap) + } + if v, err := convertListMapToJsonString(preferenceParametersMaps); err != nil { + return WrapError(err) + } else { + request["PreferenceParameters"] = v + } + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("source_resource_group"); ok { + sourceResourceGroupMap := map[string]interface{}{} + for _, sourceResourceGroup := range v.(*schema.Set).List() { + sourceResourceGroupArg := sourceResourceGroup.(map[string]interface{}) + sourceResourceGroupMap["ResourceGroupId"] = sourceResourceGroupArg["resource_group_id"] + resourceTypeFilterList := make([]string, 0) + for _, v := range sourceResourceGroupArg["resource_type_filter"].([]interface{}) { + resourceTypeFilterList = append(resourceTypeFilterList, v.(string)) + } + sourceResourceGroupMap["ResourceTypeFilter"] = resourceTypeFilterList + } + if v, err := convertMaptoJsonString(sourceResourceGroupMap); err != nil { + return WrapError(err) + } else { + request["SourceResourceGroup"] = v + } + } + if v, ok := d.GetOk("source_resources"); ok { + sourceResourcesMaps := make([]map[string]interface{}, 0) + for _, sourceResources := range v.(*schema.Set).List() { + sourceResourcesArg := sourceResources.(map[string]interface{}) + sourceResourcesMap := map[string]interface{}{} + sourceResourcesMap["ResourceId"] = sourceResourcesArg["resource_id"] + sourceResourcesMap["ResourceType"] = sourceResourcesArg["resource_type"] + sourceResourcesMaps = append(sourceResourcesMaps, sourceResourcesMap) + } + if v, err := convertListMapToJsonString(sourceResourcesMaps); err != nil { + return WrapError(err) + } else { + request["SourceResources"] = v + } + } + + if v, ok := d.GetOk("source_tag"); ok { + sourceTagMap := map[string]interface{}{} + for _, sourceResources := range v.(*schema.Set).List() { + sourceTagArg := sourceResources.(map[string]interface{}) + sourceTagMap["ResourceTags"] = sourceTagArg["resource_tags"] + resourceTypeFilterList := make([]string, 0) + for _, v := range sourceTagArg["resource_type_filter"].([]interface{}) { + resourceTypeFilterList = append(resourceTypeFilterList, v.(string)) + } + sourceTagMap["ResourceTypeFilter"] = resourceTypeFilterList + } + if v, err := convertMaptoJsonString(sourceTagMap); err != nil { + return WrapError(err) + } else { + request["SourceTag"] = v + } + } + request["TemplateScratchType"] = d.Get("template_scratch_type") + request["ClientToken"] = buildClientToken("CreateTemplateScratch") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-10"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_ros_template_scratch", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["TemplateScratchId"])) + rosService := RosService{client} + stateConf := BuildStateConf([]string{}, []string{"GENERATE_COMPLETE"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, rosService.RosTemplateScratchStateRefreshFunc(d.Id(), []string{"GENERATE_FAILED"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudRosTemplateScratchRead(d, meta) +} +func resourceAlicloudRosTemplateScratchRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + rosService := RosService{client} + object, err := rosService.DescribeRosTemplateScratch(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_ros_template_scratch rosService.DescribeRosTemplateScratch Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("description", object["Description"]) + d.Set("logical_id_strategy", object["LogicalIdStrategy"]) + + if preferenceParametersList, ok := object["PreferenceParameters"]; ok && preferenceParametersList != nil { + preferenceParametersMaps := make([]map[string]interface{}, 0) + for _, preferenceParametersListItem := range preferenceParametersList.([]interface{}) { + if preferenceParametersListItemMap, ok := preferenceParametersListItem.(map[string]interface{}); ok { + if v, ok := preferenceParametersListItemMap["ParameterValue"]; ok && fmt.Sprint(v) != "" { + preferenceParametersListItemArg := make(map[string]interface{}, 0) + preferenceParametersListItemArg["parameter_key"] = preferenceParametersListItemMap["ParameterKey"] + preferenceParametersListItemArg["parameter_value"] = v + preferenceParametersMaps = append(preferenceParametersMaps, preferenceParametersListItemArg) + } + } + } + d.Set("preference_parameters", preferenceParametersMaps) + } + + sourceTagSli := make([]map[string]interface{}, 0) + if v, ok := object["SourceTag"]; ok { + if sourceTag, ok := v.(map[string]interface{}); ok && len(sourceTag) > 0 { + sourceTagMap := make(map[string]interface{}) + sourceTagMap["resource_tags"] = sourceTag["ResourceTags"] + resourceTypeFilter := make([]interface{}, 0) + if v, ok := sourceTag["ResourceTypeFilter"]; ok { + if vv, ok := v.([]interface{}); ok && len(vv) > 0 { + resourceTypeFilter = append(resourceTypeFilter, vv...) + } + } + sourceTagMap["resource_type_filter"] = resourceTypeFilter + sourceTagSli = append(sourceTagSli, sourceTagMap) + } + } + + d.Set("source_tag", sourceTagSli) + + sourceResourceGroupSli := make([]map[string]interface{}, 0) + if v, ok := object["SourceResourceGroup"]; ok { + if sourceResourceGroup, ok := v.(map[string]interface{}); ok && len(sourceResourceGroup) > 0 { + sourceResourceGroupMap := make(map[string]interface{}) + sourceResourceGroupMap["resource_group_id"] = sourceResourceGroup["ResourceGroupId"] + resourceTypeFilter := make([]interface{}, 0) + if v, ok := sourceResourceGroup["ResourceTypeFilter"]; ok { + if vv, ok := v.([]interface{}); ok && len(vv) > 0 { + resourceTypeFilter = append(resourceTypeFilter, vv...) + } + } + sourceResourceGroupMap["resource_type_filter"] = resourceTypeFilter + sourceResourceGroupSli = append(sourceResourceGroupSli, sourceResourceGroupMap) + } + } + + d.Set("source_resource_group", sourceResourceGroupSli) + if sourceResourcesList, ok := object["SourceResources"]; ok && sourceResourcesList != nil { + sourceResourcesMaps := make([]map[string]interface{}, 0) + for _, sourceResourcesListItem := range sourceResourcesList.([]interface{}) { + if sourceResourcesListItemMap, ok := sourceResourcesListItem.(map[string]interface{}); ok { + sourceResourcesListItemArg := make(map[string]interface{}, 0) + sourceResourcesListItemArg["resource_id"] = sourceResourcesListItemMap["ResourceId"] + sourceResourcesListItemArg["resource_type"] = sourceResourcesListItemMap["ResourceType"] + sourceResourcesMaps = append(sourceResourcesMaps, sourceResourcesListItemArg) + } + } + d.Set("source_resources", sourceResourcesMaps) + } + + d.Set("status", object["Status"]) + d.Set("template_scratch_type", object["TemplateScratchType"]) + return nil +} +func resourceAlicloudRosTemplateScratchUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + rosService := RosService{client} + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "TemplateScratchId": d.Id(), + } + request["RegionId"] = client.RegionId + if d.HasChange("description") { + update = true + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + } + if d.HasChange("logical_id_strategy") { + update = true + if v, ok := d.GetOk("logical_id_strategy"); ok { + request["LogicalIdStrategy"] = v + } + } + if d.HasChange("source_tag") { + update = true + if v, ok := d.GetOkExists("source_tag"); ok { + sourceTagMap := map[string]interface{}{} + for _, sourceResources := range v.(*schema.Set).List() { + sourceTagArg := sourceResources.(map[string]interface{}) + if len(sourceTagArg["resource_tags"].(map[string]interface{})) > 0 { + sourceTagMap["ResourceTags"] = sourceTagArg["resource_tags"] + resourceTypeFilterList := make([]string, 0) + for _, v := range sourceTagArg["resource_type_filter"].([]interface{}) { + resourceTypeFilterList = append(resourceTypeFilterList, v.(string)) + } + sourceTagMap["ResourceTypeFilter"] = resourceTypeFilterList + } + } + if v, err := convertMaptoJsonString(sourceTagMap); err != nil { + return WrapError(err) + } else { + request["SourceTag"] = v + } + } + } + + if d.HasChange("preference_parameters") { + update = true + } + if v, ok := d.GetOk("preference_parameters"); ok { + preferenceParametersMaps := make([]map[string]interface{}, 0) + for _, preferenceParameters := range v.(*schema.Set).List() { + preferenceParametersArg := preferenceParameters.(map[string]interface{}) + preferenceParametersMap := map[string]interface{}{} + preferenceParametersMap["ParameterKey"] = preferenceParametersArg["parameter_key"] + preferenceParametersMap["ParameterValue"] = preferenceParametersArg["parameter_value"] + preferenceParametersMaps = append(preferenceParametersMaps, preferenceParametersMap) + } + if v, err := convertListMapToJsonString(preferenceParametersMaps); err != nil { + return WrapError(err) + } else { + request["PreferenceParameters"] = v + } + } + + if d.HasChange("source_resource_group") { + update = true + if v, ok := d.GetOk("source_resource_group"); ok { + sourceResourceGroupMap := map[string]interface{}{} + for _, sourceResourceGroup := range v.(*schema.Set).List() { + sourceResourceGroupArg := sourceResourceGroup.(map[string]interface{}) + sourceResourceGroupMap["ResourceGroupId"] = sourceResourceGroupArg["resource_group_id"] + resourceTypeFilterList := make([]string, 0) + for _, v := range sourceResourceGroupArg["resource_type_filter"].([]interface{}) { + resourceTypeFilterList = append(resourceTypeFilterList, v.(string)) + } + sourceResourceGroupMap["ResourceTypeFilter"] = resourceTypeFilterList + } + if v, err := convertMaptoJsonString(sourceResourceGroupMap); err != nil { + return WrapError(err) + } else { + request["SourceResourceGroup"] = v + } + } + } + if d.HasChange("source_resources") { + update = true + if v, ok := d.GetOk("source_resources"); ok { + sourceResourcesMaps := make([]map[string]interface{}, 0) + for _, sourceResources := range v.(*schema.Set).List() { + sourceResourcesArg := sourceResources.(map[string]interface{}) + sourceResourcesMap := map[string]interface{}{} + sourceResourcesMap["ResourceId"] = sourceResourcesArg["resource_id"] + sourceResourcesMap["ResourceType"] = sourceResourcesArg["resource_type"] + sourceResourcesMaps = append(sourceResourcesMaps, sourceResourcesMap) + } + if v, err := convertListMapToJsonString(sourceResourcesMaps); err != nil { + return WrapError(err) + } else { + request["SourceResources"] = v + } + } + } + if update { + if v, ok := d.GetOk("execution_mode"); ok { + request["ExecutionMode"] = v + } + action := "UpdateTemplateScratch" + conn, err := client.NewRosClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("UpdateTemplateScratch") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-10"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"GENERATE_COMPLETE"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, rosService.RosTemplateScratchStateRefreshFunc(d.Id(), []string{"GENERATE_FAILED"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + return resourceAlicloudRosTemplateScratchRead(d, meta) +} +func resourceAlicloudRosTemplateScratchDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + rosService := RosService{client} + action := "DeleteTemplateScratch" + var response map[string]interface{} + conn, err := client.NewRosClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "TemplateScratchId": d.Id(), + } + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-10"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{}, d.Timeout(schema.TimeoutDelete), 5*time.Second, rosService.RosTemplateScratchStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_route_table.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_route_table.go index a591bd77979..b2aab54dede 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_route_table.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_route_table.go @@ -84,7 +84,19 @@ func resourceAlicloudRouteTableCreate(d *schema.ResourceData, meta interface{}) runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) request["ClientToken"] = buildClientToken("CreateRouteTable") - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) || IsExpectedErrors(err, []string{"OperationConflict"}) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + addDebug(action, response, request) + return nil + }) if err != nil { return WrapErrorf(err, DefaultErrorMsg, "alicloud_route_table", action, AlibabaCloudSdkGoERROR) } @@ -124,6 +136,10 @@ func resourceAlicloudRouteTableUpdate(d *schema.ResourceData, meta interface{}) client := meta.(*connectivity.AliyunClient) vpcService := VpcService{client} var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } d.Partial(true) if d.HasChange("tags") { @@ -151,10 +167,6 @@ func resourceAlicloudRouteTableUpdate(d *schema.ResourceData, meta interface{}) } if update { action := "ModifyRouteTableAttributes" - conn, err := client.NewVpcClient() - if err != nil { - return WrapError(err) - } wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_sae_application.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_sae_application.go new file mode 100644 index 00000000000..fa585efe776 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_sae_application.go @@ -0,0 +1,1235 @@ +package alicloud + +import ( + "encoding/json" + "fmt" + "log" + "strconv" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudSaeApplication() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudSaeApplicationCreate, + Read: resourceAlicloudSaeApplicationRead, + Update: resourceAlicloudSaeApplicationUpdate, + Delete: resourceAlicloudSaeApplicationDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "app_description": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "app_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "auto_config": { + Type: schema.TypeBool, + Optional: true, + }, + "auto_enable_application_scaling_rule": { + Type: schema.TypeBool, + Computed: true, + Optional: true, + }, + "batch_wait_time": { + Type: schema.TypeInt, + Computed: true, + Optional: true, + }, + "change_order_desc": { + Type: schema.TypeString, + Computed: true, + Optional: true, + }, + "command": { + Type: schema.TypeString, + Optional: true, + }, + "command_args": { + Type: schema.TypeString, + Optional: true, + }, + "config_map_mount_desc": { + Type: schema.TypeString, + Computed: true, + Optional: true, + }, + "cpu": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validation.IntInSlice([]int{1000, 16000, 2000, 32000, 4000, 500, 8000}), + }, + "custom_host_alias": { + Type: schema.TypeString, + Computed: true, + Optional: true, + }, + "deploy": { + Type: schema.TypeBool, + Optional: true, + }, + "edas_container_version": { + Type: schema.TypeString, + Optional: true, + }, + "enable_ahas": { + Type: schema.TypeString, + Computed: true, + Optional: true, + }, + "enable_grey_tag_route": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "envs": { + Type: schema.TypeString, + Computed: true, + Optional: true, + }, + "image_url": { + Type: schema.TypeString, + Optional: true, + }, + "jar_start_args": { + Type: schema.TypeString, + Optional: true, + }, + "jar_start_options": { + Type: schema.TypeString, + Optional: true, + }, + "jdk": { + Type: schema.TypeString, + Optional: true, + }, + "liveness": { + Type: schema.TypeString, + Optional: true, + }, + "memory": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validation.IntInSlice([]int{1024, 131072, 16384, 2048, 32768, 4096, 65536, 8192}), + }, + "min_ready_instances": { + Type: schema.TypeInt, + Computed: true, + Optional: true, + }, + "mount_desc": { + Type: schema.TypeString, + Optional: true, + }, + "mount_host": { + Type: schema.TypeString, + Optional: true, + }, + "namespace_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "nas_id": { + Type: schema.TypeString, + Optional: true, + }, + "oss_ak_id": { + Type: schema.TypeString, + Optional: true, + Sensitive: true, + }, + "oss_ak_secret": { + Type: schema.TypeString, + Optional: true, + Sensitive: true, + }, + "oss_mount_descs": { + Type: schema.TypeString, + Optional: true, + }, + "package_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"FatJar", "Image", "War"}, false), + }, + "package_url": { + Type: schema.TypeString, + Optional: true, + }, + "package_version": { + Type: schema.TypeString, + Computed: true, + Optional: true, + }, + "php_arms_config_location": { + Type: schema.TypeString, + Optional: true, + }, + "php_config": { + Type: schema.TypeString, + Optional: true, + }, + "php_config_location": { + Type: schema.TypeString, + Optional: true, + }, + "post_start": { + Type: schema.TypeString, + Optional: true, + }, + "pre_stop": { + Type: schema.TypeString, + Optional: true, + }, + "readiness": { + Type: schema.TypeString, + Optional: true, + }, + "replicas": { + Type: schema.TypeInt, + Required: true, + }, + "security_group_id": { + Type: schema.TypeString, + Optional: true, + }, + "sls_configs": { + Type: schema.TypeString, + Optional: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"RUNNING", "STOPPED", "UNKNOWN"}, false), + }, + "termination_grace_period_seconds": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + ValidateFunc: validation.IntBetween(1, 60), + }, + "timezone": { + Type: schema.TypeString, + Computed: true, + Optional: true, + }, + "tomcat_config": { + Type: schema.TypeString, + Optional: true, + }, + "update_strategy": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "vswitch_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "vpc_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "version_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "war_start_options": { + Type: schema.TypeString, + Optional: true, + }, + "web_container": { + Type: schema.TypeString, + Optional: true, + }, + "intranet": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "https_cert_id": { + Type: schema.TypeString, + Optional: true, + }, + "protocol": { + Type: schema.TypeString, + ValidateFunc: validation.StringInSlice([]string{"TCP", "HTTP", "HTTPS"}, false), + Optional: true, + }, + "target_port": { + Type: schema.TypeInt, + Optional: true, + }, + "port": { + Type: schema.TypeInt, + Optional: true, + }, + }, + }, + }, + "internet": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "https_cert_id": { + Type: schema.TypeString, + Optional: true, + }, + "protocol": { + Type: schema.TypeString, + ValidateFunc: validation.StringInSlice([]string{"TCP", "HTTP", "HTTPS"}, false), + Optional: true, + }, + "target_port": { + Type: schema.TypeInt, + Optional: true, + }, + "port": { + Type: schema.TypeInt, + Optional: true, + }, + }, + }, + }, + "internet_slb_id": { + Type: schema.TypeString, + Optional: true, + }, + "intranet_slb_id": { + Type: schema.TypeString, + Optional: true, + }, + "internet_ip": { + Type: schema.TypeString, + Computed: true, + }, + "intranet_ip": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudSaeApplicationCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "/pop/v1/sam/app/createApplication" + request := make(map[string]*string) + conn, err := client.NewServerlessClient() + if err != nil { + return WrapError(err) + } + request["AppName"] = StringPointer(d.Get("app_name").(string)) + request["PackageType"] = StringPointer(d.Get("package_type").(string)) + request["Replicas"] = StringPointer(strconv.Itoa(d.Get("replicas").(int))) + if v, ok := d.GetOk("app_description"); ok { + request["AppDescription"] = StringPointer(v.(string)) + } + if v, ok := d.GetOkExists("auto_config"); ok { + request["AutoConfig"] = StringPointer(strconv.FormatBool(v.(bool))) + } + if v, ok := d.GetOk("command"); ok { + request["Command"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("command_args"); ok { + request["CommandArgs"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("config_map_mount_desc"); ok { + request["ConfigMapMountDesc"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("cpu"); ok { + request["Cpu"] = StringPointer(strconv.Itoa(v.(int))) + } + if v, ok := d.GetOk("custom_host_alias"); ok { + request["CustomHostAlias"] = StringPointer(v.(string)) + } + if v, ok := d.GetOkExists("deploy"); ok { + request["Deploy"] = StringPointer(strconv.FormatBool(v.(bool))) + } + if v, ok := d.GetOk("edas_container_version"); ok { + request["EdasContainerVersion"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("envs"); ok { + request["Envs"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("image_url"); ok { + request["ImageUrl"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("jar_start_args"); ok { + request["JarStartArgs"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("jar_start_options"); ok { + request["JarStartOptions"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("jdk"); ok { + request["Jdk"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("liveness"); ok { + request["Liveness"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("memory"); ok { + request["Memory"] = StringPointer(strconv.Itoa(v.(int))) + } + if v, ok := d.GetOk("mount_desc"); ok { + request["MountDesc"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("mount_host"); ok { + request["MountHost"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("namespace_id"); ok { + request["NamespaceId"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("nas_id"); ok { + request["NasId"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("oss_ak_id"); ok { + request["OssAkId"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("oss_ak_secret"); ok { + request["OssAkSecret"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("oss_mount_descs"); ok { + request["OssMountDescs"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("package_url"); ok { + request["PackageUrl"] = StringPointer(v.(string)) + } + request["PackageVersion"] = StringPointer(strconv.FormatInt(time.Now().Unix(), 10)) + if v, ok := d.GetOk("php_arms_config_location"); ok { + request["PhpArmsConfigLocation"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("php_config"); ok { + request["PhpConfig"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("php_config_location"); ok { + request["PhpConfigLocation"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("post_start"); ok { + request["PostStart"] = StringPointer(v.(string)) + } + if d.HasChange("pre_stop") { + request["PreStop"] = StringPointer(d.Get("pre_stop").(string)) + } + if v, ok := d.GetOk("pre_stop"); ok { + request["PreStop"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("readiness"); ok { + request["Readiness"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("security_group_id"); ok { + request["SecurityGroupId"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("sls_configs"); ok { + request["SlsConfigs"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("termination_grace_period_seconds"); ok { + request["TerminationGracePeriodSeconds"] = StringPointer(strconv.Itoa(v.(int))) + } + if v, ok := d.GetOk("timezone"); ok { + request["Timezone"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("tomcat_config"); ok { + request["TomcatConfig"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("war_start_options"); ok { + request["WarStartOptions"] = StringPointer(v.(string)) + } + if v, ok := d.GetOk("web_container"); ok { + request["WebContainer"] = StringPointer(v.(string)) + } + if v, exist := d.GetOk("vpc_id"); exist { + request["VpcId"] = StringPointer(v.(string)) + } + if v, exist := d.GetOk("vswitch_id"); exist { + request["VSwitchId"] = StringPointer(v.(string)) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer("2019-05-06"), nil, StringPointer("POST"), StringPointer("AK"), StringPointer(action), request, nil, nil, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_sae_application", "POST "+action, AlibabaCloudSdkGoERROR) + } + if respBody, isExist := response["body"]; isExist { + response = respBody.(map[string]interface{}) + } else { + return WrapError(fmt.Errorf("%s failed, response: %v", "POST "+action, response)) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", "POST "+action, response)) + } + responseData := response["Data"].(map[string]interface{}) + d.SetId(fmt.Sprint(responseData["AppId"])) + + return resourceAlicloudSaeApplicationUpdate(d, meta) +} +func resourceAlicloudSaeApplicationRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + saeService := SaeService{client} + object, err := saeService.DescribeSaeApplication(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_sae_application saeService.DescribeSaeApplication Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("app_description", object["AppDescription"]) + d.Set("app_name", object["AppName"]) + d.Set("command", object["Command"]) + d.Set("command_args", object["CommandArgs"]) + + d.Set("config_map_mount_desc", object["ConfigMapMountDesc"]) + if v, ok := object["Cpu"]; ok && fmt.Sprint(v) != "0" { + d.Set("cpu", formatInt(v)) + } + d.Set("custom_host_alias", object["CustomHostAlias"]) + d.Set("edas_container_version", object["EdasContainerVersion"]) + d.Set("envs", object["Envs"]) + d.Set("image_url", object["ImageUrl"]) + d.Set("jar_start_args", object["JarStartArgs"]) + d.Set("jar_start_options", object["JarStartOptions"]) + d.Set("jdk", object["Jdk"]) + d.Set("liveness", object["Liveness"]) + if v, ok := object["Memory"]; ok && fmt.Sprint(v) != "0" { + d.Set("memory", formatInt(v)) + } + if v, ok := object["MinReadyInstances"]; ok && fmt.Sprint(v) != "0" { + d.Set("min_ready_instances", formatInt(v)) + } + + if v, ok := object["MountDesc"].([]interface{}); ok { + mountDesc, err := convertListObjectToCommaSeparate(v) + if err != nil { + return WrapError(err) + } + d.Set("mount_desc", mountDesc) + } + + d.Set("mount_host", object["MountHost"]) + d.Set("namespace_id", object["NamespaceId"]) + d.Set("nas_id", object["NasId"]) + d.Set("oss_ak_id", object["OssAkId"]) + d.Set("oss_ak_secret", object["OssAkSecret"]) + d.Set("oss_mount_descs", object["OssMountDescs"]) + d.Set("package_type", object["PackageType"]) + d.Set("package_url", object["PackageUrl"]) + d.Set("package_version", object["PackageVersion"]) + d.Set("php_arms_config_location", object["PhpArmsConfigLocation"]) + d.Set("php_config", object["PhpConfig"]) + d.Set("php_config_location", object["PhpConfigLocation"]) + d.Set("post_start", object["PostStart"]) + d.Set("pre_stop", object["PreStop"]) + d.Set("readiness", object["Readiness"]) + if v, ok := object["Replicas"]; ok && fmt.Sprint(v) != "0" { + d.Set("replicas", formatInt(v)) + } + d.Set("security_group_id", object["SecurityGroupId"]) + d.Set("sls_configs", object["SlsConfigs"]) + if v, ok := object["TerminationGracePeriodSeconds"]; ok && fmt.Sprint(v) != "0" { + d.Set("termination_grace_period_seconds", formatInt(v)) + } + d.Set("timezone", object["Timezone"]) + d.Set("tomcat_config", object["TomcatConfig"]) + d.Set("vswitch_id", object["VSwitchId"]) + d.Set("vpc_id", object["VpcId"]) + d.Set("war_start_options", object["WarStartOptions"]) + d.Set("web_container", object["WebContainer"]) + describeApplicationStatusObject, err := saeService.DescribeApplicationStatus(d.Id()) + if err != nil { + return WrapError(err) + } + d.Set("status", describeApplicationStatusObject["CurrentStatus"]) + + describeApplicationSlbObject, err := saeService.DescribeApplicationSlb(d.Id()) + if err != nil { + return WrapError(err) + } + + d.Set("internet_ip", describeApplicationSlbObject["InternetIp"]) + d.Set("intranet_ip", describeApplicationSlbObject["IntranetIp"]) + d.Set("intranet_slb_id", describeApplicationSlbObject["IntranetSlbId"]) + d.Set("internet_slb_id", describeApplicationSlbObject["InternetSlbId"]) + intranetArray := make([]interface{}, 0) + if v, ok := describeApplicationSlbObject["Intranet"]; ok { + for _, intranet := range v.([]interface{}) { + intranetObject := intranet.(map[string]interface{}) + intranetObj := map[string]interface{}{ + "https_cert_id": intranetObject["HttpsCertId"], + "protocol": intranetObject["Protocol"], + "target_port": intranetObject["TargetPort"], + "port": intranetObject["Port"], + } + intranetArray = append(intranetArray, intranetObj) + } + } + d.Set("intranet", intranetArray) + + internetArray := make([]interface{}, 0) + if v, ok := describeApplicationSlbObject["Internet"]; ok { + for _, internet := range v.([]interface{}) { + internetObject := internet.(map[string]interface{}) + internetObj := map[string]interface{}{ + "https_cert_id": internetObject["HttpsCertId"], + "protocol": internetObject["Protocol"], + "target_port": internetObject["TargetPort"], + "port": internetObject["Port"], + } + internetArray = append(internetArray, internetObj) + } + } + d.Set("internet", internetArray) + + return nil +} +func resourceAlicloudSaeApplicationUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + conn, err := client.NewServerlessClient() + if err != nil { + return WrapError(err) + } + saeService := SaeService{client} + var response map[string]interface{} + update := false + d.Partial(true) + request := map[string]*string{ + "AppId": StringPointer(d.Id()), + } + + update = false + if d.HasChange("replicas") && !d.IsNewResource() { + update = true + } + request["Replicas"] = StringPointer(strconv.Itoa(d.Get("replicas").(int))) + if update { + action := "/pop/v1/sam/app/rescaleApplication" + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer("2019-05-06"), nil, StringPointer("PUT"), StringPointer("AK"), StringPointer(action), request, nil, nil, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"Application.InvalidStatus", "Application.ChangerOrderRunning"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), "POST "+action, AlibabaCloudSdkGoERROR) + } + if respBody, isExist := response["body"]; isExist { + response = respBody.(map[string]interface{}) + } else { + return WrapError(fmt.Errorf("%s failed, response: %v", "POST "+action, response)) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", "POST "+action, response)) + } + } + update = false + //DeployApplication + request = map[string]*string{ + "AppId": StringPointer(d.Id()), + } + + if d.HasChange("command") { + update = true + } + if v, ok := d.GetOk("command"); ok { + request["Command"] = StringPointer(v.(string)) + } + + if d.HasChange("command_args") { + update = true + } + if v, ok := d.GetOk("command_args"); ok { + request["CommandArgs"] = StringPointer(v.(string)) + } + + if d.HasChange("config_map_mount_desc") { + update = true + } + if v, ok := d.GetOk("config_map_mount_desc"); ok { + request["ConfigMapMountDesc"] = StringPointer(v.(string)) + } + + if d.HasChange("custom_host_alias") { + update = true + } + if v, ok := d.GetOk("custom_host_alias"); ok { + request["CustomHostAlias"] = StringPointer(v.(string)) + } + + if d.HasChange("edas_container_version") { + update = true + } + if v, ok := d.GetOk("edas_container_version"); ok { + request["EdasContainerVersion"] = StringPointer(v.(string)) + } + + if d.HasChange("envs") { + update = true + } + if v, ok := d.GetOk("envs"); ok { + request["Envs"] = StringPointer(v.(string)) + } + + if d.HasChange("image_url") { + update = true + } + if v, ok := d.GetOk("image_url"); ok { + request["ImageUrl"] = StringPointer(v.(string)) + } + + if d.HasChange("jar_start_args") { + update = true + } + if v, ok := d.GetOk("jar_start_args"); ok { + request["JarStartArgs"] = StringPointer(v.(string)) + } + + if d.HasChange("jar_start_options") { + update = true + } + if v, ok := d.GetOk("jar_start_options"); ok { + request["JarStartOptions"] = StringPointer(v.(string)) + } + + if d.HasChange("jdk") { + update = true + } + if v, ok := d.GetOk("jdk"); ok { + request["Jdk"] = StringPointer(v.(string)) + } + + if d.HasChange("liveness") { + update = true + } + if v, ok := d.GetOk("liveness"); ok { + request["Liveness"] = StringPointer(v.(string)) + } + + if d.HasChange("mount_desc") { + update = true + } + if v, ok := d.GetOk("mount_desc"); ok { + request["MountDesc"] = StringPointer(v.(string)) + } + + if d.HasChange("mount_host") { + update = true + } + if v, ok := d.GetOk("mount_host"); ok { + request["MountHost"] = StringPointer(v.(string)) + } + + if d.HasChange("nas_id") { + update = true + } + if v, ok := d.GetOk("nas_id"); ok { + request["NasId"] = StringPointer(v.(string)) + } + + if d.HasChange("oss_ak_id") { + update = true + } + if v, ok := d.GetOk("oss_ak_id"); ok { + request["OssAkId"] = StringPointer(v.(string)) + } + + if d.HasChange("oss_ak_secret") { + update = true + } + if v, ok := d.GetOk("oss_ak_secret"); ok { + request["OssAkSecret"] = StringPointer(v.(string)) + } + + if d.HasChange("oss_mount_descs") { + update = true + } + if v, ok := d.GetOk("oss_mount_descs"); ok { + request["OssMountDescs"] = StringPointer(v.(string)) + } + + if d.HasChange("package_url") { + update = true + } + if v, ok := d.GetOk("package_url"); ok { + request["PackageUrl"] = StringPointer(v.(string)) + } + + if d.HasChange("php_arms_config_location") { + update = true + } + if v, ok := d.GetOk("php_arms_config_location"); ok { + request["PhpArmsConfigLocation"] = StringPointer(v.(string)) + } + + if d.HasChange("php_config") { + update = true + } + if v, ok := d.GetOk("php_config"); ok { + request["PhpConfig"] = StringPointer(v.(string)) + } + + if d.HasChange("php_config_location") { + update = true + } + if v, ok := d.GetOk("php_config_location"); ok { + request["PhpConfigLocation"] = StringPointer(v.(string)) + } + + if d.HasChange("post_start") { + update = true + } + if v, ok := d.GetOk("post_start"); ok { + request["PostStart"] = StringPointer(v.(string)) + } + + if d.HasChange("pre_stop") { + update = true + } + if v, ok := d.GetOk("pre_stop"); ok { + request["PreStop"] = StringPointer(v.(string)) + } + + if d.HasChange("readiness") { + update = true + } + if v, ok := d.GetOk("readiness"); ok { + request["Readiness"] = StringPointer(v.(string)) + } + + if d.HasChange("sls_configs") { + update = true + } + if v, ok := d.GetOk("sls_configs"); ok { + request["SlsConfigs"] = StringPointer(v.(string)) + } + + if d.HasChange("termination_grace_period_seconds") { + update = true + } + if v, ok := d.GetOk("termination_grace_period_seconds"); ok { + request["TerminationGracePeriodSeconds"] = StringPointer(strconv.Itoa(v.(int))) + } + + if d.HasChange("timezone") { + update = true + } + if v, ok := d.GetOk("timezone"); ok { + request["Timezone"] = StringPointer(v.(string)) + } + + if d.HasChange("tomcat_config") { + update = true + } + if v, ok := d.GetOk("tomcat_config"); ok { + request["TomcatConfig"] = StringPointer(v.(string)) + } + + if d.HasChange("war_start_options") { + update = true + } + if v, ok := d.GetOk("war_start_options"); ok { + request["WarStartOptions"] = StringPointer(v.(string)) + } + + if d.HasChange("web_container") { + update = true + } + if v, ok := d.GetOk("web_container"); ok { + request["WebContainer"] = StringPointer(v.(string)) + } + + if d.HasChange("auto_enable_application_scaling_rule") { + update = true + } + if v, ok := d.GetOk("auto_enable_application_scaling_rule"); ok { + request["AutoEnableApplicationScalingRule"] = StringPointer(strconv.FormatBool(v.(bool))) + } + if d.HasChange("min_ready_instances") { + update = true + } + if v, ok := d.GetOk("min_ready_instances"); ok { + request["MinReadyInstances"] = StringPointer(strconv.Itoa(v.(int))) + } + + if v, ok := d.GetOk("batch_wait_time"); ok { + request["BatchWaitTime"] = StringPointer(strconv.Itoa(v.(int))) + } + + if d.HasChange("change_order_desc") { + update = true + } + if v, ok := d.GetOk("change_order_desc"); ok { + request["ChangeOrderDesc"] = StringPointer(v.(string)) + } + + if d.HasChange("enable_ahas") { + update = true + } + if v, ok := d.GetOk("enable_ahas"); ok { + request["EnableAhas"] = StringPointer(v.(string)) + } + + if d.HasChange("enable_grey_tag_route") { + update = true + } + if v, ok := d.GetOkExists("enable_grey_tag_route"); ok { + request["EnableGreyTagRoute"] = StringPointer(v.(string)) + } + + if d.HasChange("update_strategy") { + update = true + } + if v, ok := d.GetOk("update_strategy"); ok { + request["UpdateStrategy"] = StringPointer(v.(string)) + } + + if update { + action := "/pop/v1/sam/app/deployApplication" + wait := incrementalWait(3*time.Second, 3*time.Second) + request["PackageVersion"] = StringPointer(strconv.FormatInt(time.Now().Unix(), 10)) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer("2019-05-06"), nil, StringPointer("POST"), StringPointer("AK"), StringPointer(action), request, nil, nil, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"Application.ChangerOrderRunning"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), "POST "+action, AlibabaCloudSdkGoERROR) + } + if respBody, isExist := response["body"]; isExist { + response = respBody.(map[string]interface{}) + } else { + return WrapError(fmt.Errorf("%s failed, response: %v", "POST "+action, response)) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", "POST "+action, response)) + } + d.SetPartial("command") + d.SetPartial("command_args") + d.SetPartial("config_map_mount_desc") + d.SetPartial("custom_host_alias") + d.SetPartial("edas_container_version") + d.SetPartial("envs") + d.SetPartial("image_url") + d.SetPartial("jar_start_args") + d.SetPartial("jar_start_options") + d.SetPartial("jdk") + d.SetPartial("liveness") + d.SetPartial("mount_desc") + d.SetPartial("mount_host") + d.SetPartial("nas_id") + d.SetPartial("oss_ak_id") + d.SetPartial("oss_ak_secret") + d.SetPartial("oss_mount_descs") + d.SetPartial("package_url") + d.SetPartial("package_version") + d.SetPartial("php_arms_config_location") + d.SetPartial("php_config") + d.SetPartial("php_config_location") + d.SetPartial("post_start") + d.SetPartial("pre_stop") + d.SetPartial("readiness") + d.SetPartial("sls_configs") + d.SetPartial("min_ready_instances") + d.SetPartial("auto_enable_application_scaling_rule") + d.SetPartial("termination_grace_period_seconds") + d.SetPartial("timezone") + d.SetPartial("tomcat_config") + d.SetPartial("war_start_options") + d.SetPartial("web_container") + } + + // update SLB + update = false + if err := saeService.UpdateSlb(d); err != nil { + return WrapError(err) + } + + // 【Exists】update security_group_id + if d.HasChange("security_group_id") { + d.Partial(true) + request := map[string]*string{ + "AppId": StringPointer(d.Id()), + } + if v, ok := d.GetOk("security_group_id"); ok { + request["SecurityGroupId"] = StringPointer(v.(string)) + } + action := "/pop/v1/sam/app/updateAppSecurityGroup" + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer("2019-05-06"), nil, StringPointer("PUT"), StringPointer("AK"), StringPointer(action), request, nil, nil, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"Application.ChangerOrderRunning"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), "PUT "+action, AlibabaCloudSdkGoERROR) + } + if respBody, isExist := response["body"]; isExist { + response = respBody.(map[string]interface{}) + } else { + return WrapError(fmt.Errorf("%s failed, response: %v", "PUT "+action, response)) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", "PUT "+action, response)) + } + d.SetPartial("security_group_id") + } + + // 【Exists】update rescaleApplicationVertically(CPU+Memory) + if (d.HasChange("cpu") || d.HasChange("memory")) && !d.IsNewResource() { + d.Partial(true) + request := map[string]*string{ + "AppId": StringPointer(d.Id()), + } + if v, ok := d.GetOk("cpu"); ok { + request["Cpu"] = StringPointer(strconv.Itoa(v.(int))) + } + if v, ok := d.GetOk("memory"); ok { + request["Memory"] = StringPointer(strconv.Itoa(v.(int))) + } + action := "/pop/v1/sam/app/rescaleApplicationVertically" + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer("2019-05-06"), nil, StringPointer("POST"), StringPointer("AK"), StringPointer(action), request, nil, nil, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"Application.ChangerOrderRunning"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), "POST "+action, AlibabaCloudSdkGoERROR) + } + if respBody, isExist := response["body"]; isExist { + response = respBody.(map[string]interface{}) + } else { + return WrapError(fmt.Errorf("%s failed, response: %v", "POST "+action, response)) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", "POST "+action, response)) + } + d.SetPartial("cpu") + d.SetPartial("memory") + } + // 【Exists】update status + if d.HasChange("status") { + d.Partial(true) + object, err := saeService.DescribeApplicationStatus(d.Id()) + if err != nil { + return WrapError(err) + } + target := d.Get("status").(string) + if object["CurrentStatus"].(string) != target { + if target == "RUNNING" { + request := map[string]*string{ + "AppId": StringPointer(d.Id()), + } + action := "/pop/v1/sam/app/startApplication" + conn, err := client.NewServerlessClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer("2019-05-06"), nil, StringPointer("PUT"), StringPointer("AK"), StringPointer(action), request, nil, nil, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"Application.ChangerOrderRunning"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if respBody, isExist := response["body"]; isExist { + response = respBody.(map[string]interface{}) + } else { + return WrapError(fmt.Errorf("%s failed, response: %v", "Put "+action, response)) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", "Put "+action, response)) + } + } + if target == "STOPPED" { + request := map[string]*string{ + "AppId": StringPointer(d.Id()), + } + action := "/pop/v1/sam/app/stopApplication" + conn, err := client.NewServerlessClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer("2019-05-06"), nil, StringPointer("PUT"), StringPointer("AK"), StringPointer(action), request, nil, nil, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"Application.InvalidStatus"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), "PUT "+action, AlibabaCloudSdkGoERROR) + } + if respBody, isExist := response["body"]; isExist { + response = respBody.(map[string]interface{}) + } else { + return WrapError(fmt.Errorf("%s failed, response: %v", "Put "+action, response)) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", "Put "+action, response)) + } + } + d.SetPartial("status") + } + } + d.Partial(false) + stateConf := BuildStateConf([]string{}, []string{"SUCCESS"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, saeService.SaeApplicationStateRefreshFunc(d.Id(), []string{"FAIL", "ABORT", "SYSTEM_FAIL"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return resourceAlicloudSaeApplicationRead(d, meta) +} +func resourceAlicloudSaeApplicationDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "/pop/v1/sam/app/deleteApplication" + var response map[string]interface{} + conn, err := client.NewServerlessClient() + if err != nil { + return WrapError(err) + } + request := map[string]*string{ + "AppId": StringPointer(d.Id()), + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer("2019-05-06"), nil, StringPointer("DELETE"), StringPointer("AK"), StringPointer(action), request, nil, nil, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"Application.ChangerOrderRunning"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), "DELETE "+action, AlibabaCloudSdkGoERROR) + } + if respBody, isExist := response["body"]; isExist { + response = respBody.(map[string]interface{}) + } else { + return WrapError(fmt.Errorf("%s failed, response: %v", "DELETE "+action, response)) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", "DELETE "+action, response)) + } + + action = "/pop/v1/sam/app/describeApplicationConfig" + request = map[string]*string{ + "AppId": StringPointer(d.Id()), + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait = incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer("2019-05-06"), nil, StringPointer("GET"), StringPointer("AK"), StringPointer(action), request, nil, nil, &util.RuntimeOptions{}) + if response != nil { + err = fmt.Errorf("application have not been destroyed yet") + return resource.RetryableError(err) + } + return nil + }) + if err != nil { + return WrapError(err) + } + return nil +} + +func convertListObjectToCommaSeparate(configured []interface{}) (string, error) { + if len(configured) < 1 { + return "", nil + } + result := "[" + for i, v := range configured { + rail := "," + if i == len(configured)-1 { + rail = "" + } + vv, err := json.Marshal(v) + if err != nil { + return "", err + } + result += string(vv) + rail + } + return result + "]", nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_sae_ingress.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_sae_ingress.go new file mode 100644 index 00000000000..1729bf5bb57 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_sae_ingress.go @@ -0,0 +1,349 @@ +package alicloud + +import ( + "fmt" + "log" + "strconv" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudSaeIngress() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudSaeIngressCreate, + Read: resourceAlicloudSaeIngressRead, + Update: resourceAlicloudSaeIngressUpdate, + Delete: resourceAlicloudSaeIngressDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "cert_id": { + Type: schema.TypeString, + Optional: true, + }, + "default_rule": { + Type: schema.TypeSet, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "app_id": { + Type: schema.TypeString, + Optional: true, + }, + "app_name": { + Type: schema.TypeString, + Optional: true, + }, + "container_port": { + Type: schema.TypeInt, + Optional: true, + }, + }, + }, + }, + "description": { + Type: schema.TypeString, + Optional: true, + }, + "listener_port": { + Type: schema.TypeInt, + Required: true, + }, + "namespace_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "rules": { + Type: schema.TypeSet, + Required: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "app_id": { + Type: schema.TypeString, + Required: true, + }, + "app_name": { + Type: schema.TypeString, + Required: true, + }, + "container_port": { + Type: schema.TypeInt, + Required: true, + }, + "domain": { + Type: schema.TypeString, + Required: true, + }, + "path": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + "slb_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudSaeIngressCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "/pop/v1/sam/ingress/Ingress" + request := make(map[string]*string) + + conn, err := client.NewServerlessClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("cert_id"); ok { + request["CertId"] = StringPointer(v.(string)) + } + + if v, ok := d.GetOk("description"); ok { + request["Description"] = StringPointer(v.(string)) + } + + request["ListenerPort"] = StringPointer(strconv.Itoa(d.Get("listener_port").(int))) + request["NamespaceId"] = StringPointer(d.Get("namespace_id").(string)) + + defaultrulesMap := map[string]interface{}{} + + for _, rules := range d.Get("default_rule").(*schema.Set).List() { + rulesArg := rules.(map[string]interface{}) + defaultrulesMap["appId"] = rulesArg["app_id"] + defaultrulesMap["containerPort"] = rulesArg["container_port"] + } + if v, err := convertArrayObjectToJsonString(defaultrulesMap); err != nil { + return WrapError(err) + } else { + request["DefaultRule"] = StringPointer(v) + } + + rulesMaps := make([]map[string]interface{}, 0) + for _, rules := range d.Get("rules").(*schema.Set).List() { + rulesArg := rules.(map[string]interface{}) + rulesMap := map[string]interface{}{} + rulesMap["appId"] = rulesArg["app_id"] + rulesMap["appName"] = rulesArg["app_name"] + rulesMap["containerPort"] = rulesArg["container_port"] + rulesMap["domain"] = rulesArg["domain"] + rulesMap["path"] = rulesArg["path"] + rulesMaps = append(rulesMaps, rulesMap) + } + if v, err := convertArrayObjectToJsonString(rulesMaps); err != nil { + return WrapError(err) + } else { + request["Rules"] = StringPointer(v) + } + request["SlbId"] = StringPointer(d.Get("slb_id").(string)) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer("2019-05-06"), nil, StringPointer("POST"), StringPointer("AK"), StringPointer(action), request, nil, nil, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_sae_ingress", action, AlibabaCloudSdkGoERROR) + } + + if respBody, isExist := response["body"]; isExist { + response = respBody.(map[string]interface{}) + } else { + return WrapError(fmt.Errorf("%s failed, response: %v", "POST "+action, response)) + } + addDebug(action, response, request) + + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + responseData := response["Data"].(map[string]interface{}) + d.SetId(fmt.Sprint(responseData["IngressId"])) + + return resourceAlicloudSaeIngressRead(d, meta) +} +func resourceAlicloudSaeIngressRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + saeService := SaeService{client} + object, err := saeService.DescribeSaeIngress(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_sae_ingress saeService.DescribeSaeIngress Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + if v, ok := object["CertId"]; ok && v.(string) != "" { + d.Set("cert_id", v) + } + + d.Set("description", object["Description"]) + + defaultRuleConfig := make([]map[string]interface{}, 0) + if defaultRule, ok := object["DefaultRule"]; ok { + defaultRule_convert := defaultRule.(map[string]interface{}) + defaultRuleData := make(map[string]interface{}, 0) + defaultRuleData["app_id"] = defaultRule_convert["AppId"] + defaultRuleData["container_port"] = defaultRule_convert["ContainerPort"] + defaultRuleConfig = append(defaultRuleConfig, defaultRuleData) + d.Set("default_rule", defaultRuleConfig) + } + + config := make([]map[string]interface{}, 0) + if quotaDimension, ok := object["Rules"]; ok { + quotaDimension_convert := quotaDimension.([]interface{}) + for _, obj := range quotaDimension_convert { + obj_convert := obj.(map[string]interface{}) + data := make(map[string]interface{}, 0) + data["app_id"] = obj_convert["AppId"] + data["app_name"] = obj_convert["AppName"] + data["container_port"] = obj_convert["ContainerPort"] + data["domain"] = obj_convert["Domain"] + data["path"] = obj_convert["Path"] + config = append(config, data) + } + d.Set("rules", config) + } + + if v, ok := object["ListenerPort"]; ok && fmt.Sprint(v) != "0" { + d.Set("listener_port", formatInt(v)) + } + d.Set("namespace_id", object["NamespaceId"]) + d.Set("slb_id", object["SlbId"]) + return nil +} +func resourceAlicloudSaeIngressUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]*string{ + "IngressId": StringPointer(d.Id()), + } + if d.HasChange("cert_id") { + update = true + if v, ok := d.GetOk("cert_id"); ok { + request["CertId"] = StringPointer(v.(string)) + } + } + if d.HasChange("default_rule") { + update = true + defaultrulesMap := map[string]interface{}{} + for _, rules := range d.Get("default_rule").(*schema.Set).List() { + rulesArg := rules.(map[string]interface{}) + defaultrulesMap["appId"] = rulesArg["app_id"] + defaultrulesMap["containerPort"] = rulesArg["container_port"] + } + if v, err := convertArrayObjectToJsonString(defaultrulesMap); err == nil { + request["DefaultRule"] = StringPointer(v) + } else { + return WrapError(err) + } + } + if d.HasChange("description") { + update = true + if v, ok := d.GetOk("description"); ok { + request["Description"] = StringPointer(v.(string)) + } + } + if d.HasChange("listener_port") { + update = true + request["ListenerPort"] = StringPointer(strconv.Itoa(d.Get("listener_port").(int))) + } + if d.HasChange("rules") { + update = true + rulesMaps := make([]map[string]interface{}, 0) + for _, rules := range d.Get("rules").(*schema.Set).List() { + rulesArg := rules.(map[string]interface{}) + rulesMap := map[string]interface{}{} + rulesMap["appId"] = rulesArg["app_id"] + rulesMap["appName"] = rulesArg["app_name"] + rulesMap["containerPort"] = rulesArg["container_port"] + rulesMap["domain"] = rulesArg["domain"] + rulesMap["path"] = rulesArg["path"] + rulesMaps = append(rulesMaps, rulesMap) + } + if v, err := convertArrayObjectToJsonString(rulesMaps); err == nil { + request["Rules"] = StringPointer(v) + } else { + return WrapError(err) + } + } + if update { + action := "/pop/v1/sam/ingress/Ingress" + conn, err := client.NewServerlessClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer("2019-05-06"), nil, StringPointer("PUT"), StringPointer("AK"), StringPointer(action), request, nil, nil, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", "PUT "+action, response)) + } + } + return resourceAlicloudSaeIngressRead(d, meta) +} +func resourceAlicloudSaeIngressDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "/pop/v1/sam/ingress/Ingress" + var response map[string]interface{} + conn, err := client.NewServerlessClient() + if err != nil { + return WrapError(err) + } + request := map[string]*string{ + "IngressId": StringPointer(d.Id()), + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer("2019-05-06"), nil, StringPointer("DELETE"), StringPointer("AK"), StringPointer(action), request, nil, nil, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", "DELETE "+action, response)) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_sddp_config.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_sddp_config.go new file mode 100644 index 00000000000..545989c5966 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_sddp_config.go @@ -0,0 +1,160 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudSddpConfig() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudSddpConfigCreate, + Read: resourceAlicloudSddpConfigRead, + Update: resourceAlicloudSddpConfigUpdate, + Delete: resourceAlicloudSddpConfigDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "code": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"access_failed_cnt", "access_permission_exprie_max_days", "log_datasize_avg_days"}, false), + }, + "description": { + Type: schema.TypeString, + Computed: true, + Optional: true, + }, + "value": { + Type: schema.TypeString, + Optional: true, + }, + "lang": { + Type: schema.TypeString, + ValidateFunc: validation.StringInSlice([]string{"zh", "en"}, false), + Default: "zh", + Optional: true, + }, + }, + } +} + +func resourceAlicloudSddpConfigCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateConfig" + request := make(map[string]interface{}) + conn, err := client.NewSddpClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("code"); ok { + request["Code"] = v + } + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + if v, ok := d.GetOk("lang"); ok { + request["Lang"] = v + } + if v, ok := d.GetOk("value"); ok { + request["Value"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-01-03"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_sddp_config", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["Code"])) + + return resourceAlicloudSddpConfigRead(d, meta) +} +func resourceAlicloudSddpConfigRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + sddpService := SddpService{client} + object, err := sddpService.DescribeSddpConfig(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_sddp_config sddpService.DescribeSddpConfig Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + + d.Set("code", d.Id()) + d.Set("description", object["Description"]) + d.Set("value", fmt.Sprint(formatInt(object["Value"]))) + return nil +} +func resourceAlicloudSddpConfigUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "Code": d.Id(), + } + if d.HasChange("description") { + update = true + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + } + if v, ok := d.GetOk("lang"); ok { + request["Lang"] = v + } + if d.HasChange("value") { + update = true + if v, ok := d.GetOk("value"); ok { + request["Value"] = v + } + } + if update { + action := "CreateConfig" + conn, err := client.NewSddpClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-01-03"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudSddpConfigRead(d, meta) +} +func resourceAlicloudSddpConfigDelete(d *schema.ResourceData, meta interface{}) error { + log.Printf("[WARN] Cannot destroy resourceAlicloudSddpConfig. Terraform will remove this resource from the state file, however resources may remain.") + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_sddp_instance.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_sddp_instance.go new file mode 100644 index 00000000000..19f924a5255 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_sddp_instance.go @@ -0,0 +1,412 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudSddpInstance() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudSddpInstanceCreate, + Read: resourceAlicloudSddpInstanceRead, + Update: resourceAlicloudSddpInstanceUpdate, + Delete: resourceAlicloudSddpInstanceDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "payment_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Subscription"}, false), + }, + "period": { + Type: schema.TypeInt, + Required: true, + ValidateFunc: validation.IntInSlice([]int{1, 12, 2, 24, 3, 6}), + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("payment_type"); ok && v.(string) == "Subscription" { + return false + } + return true + }, + }, + "renew_period": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validation.IntBetween(1, 12), + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("payment_type"); ok && v.(string) == "Subscription" { + if v, ok := d.GetOk("renewal_status"); ok && v.(string) == "AutoRenewal" { + return false + } + } + return true + }, + }, + "renewal_status": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"AutoRenewal", "ManualRenewal"}, false), + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("payment_type"); ok && v.(string) == "Subscription" { + return false + } + return true + }, + }, + "logistics": { + Type: schema.TypeString, + Optional: true, + }, + "dataphin_count": { + Type: schema.TypeString, + Optional: true, + }, + "dataphin": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"no", "yes"}, false), + }, + "sddp_version": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"version_audit", "version_company", "version_dlp"}, false), + }, + "sdc": { + Type: schema.TypeString, + Required: true, + }, + "ud_cbool": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"no", "yes"}, false), + }, + "sd_cbool": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"no", "yes"}, false), + }, + "udc": { + Type: schema.TypeString, + Required: true, + }, + "modify_type": { + Type: schema.TypeString, + ValidateFunc: validation.StringInSlice([]string{"Upgrade", "Downgrade"}, false), + Optional: true, + }, + "authed": { + Type: schema.TypeBool, + Computed: true, + }, + "instance_num": { + Type: schema.TypeString, + Computed: true, + }, + "odps_set": { + Type: schema.TypeBool, + Computed: true, + }, + "oss_bucket_set": { + Type: schema.TypeBool, + Computed: true, + }, + "oss_size": { + Type: schema.TypeString, + Computed: true, + }, + "rds_set": { + Type: schema.TypeBool, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "remain_days": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudSddpInstanceCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateInstance" + request := make(map[string]interface{}) + conn, err := client.NewBssopenapiClient() + if err != nil { + return WrapError(err) + } + + request["ClientToken"] = buildClientToken("CreateInstance") + request["ProductCode"] = "sddp" + request["ProductType"] = "sddp_pre" + request["SubscriptionType"] = d.Get("payment_type") + + if v, ok := d.GetOk("renewal_status"); ok { + request["RenewalStatus"] = v + } + if v, ok := d.GetOk("renewal_duration"); ok { + request["RenewPeriod"] = v + } else if v, ok := d.GetOk("renewal_status"); ok && v.(string) == "AutoRenewal" { + return WrapError(fmt.Errorf("attribute '%s' is required when '%s' is %v ", "renewal_duration", "renewal_status", d.Get("renewal_status"))) + } + if v, ok := d.GetOk("period"); ok { + request["Period"] = v + } else if d.Get("payment_type").(string) == "Subscription" { + return WrapError(fmt.Errorf("attribute '%s' is required when '%s' is %v", "period", "payment_type", "Subscription")) + } + + if v, ok := d.GetOk("logistics"); ok { + request["Logistics"] = v + } + + parameterMapList := make([]map[string]interface{}, 0) + parameterMapList = append(parameterMapList, map[string]interface{}{ + "Code": "sddp_version", + "Value": d.Get("sddp_version"), + }) + parameterMapList = append(parameterMapList, map[string]interface{}{ + "Code": "SDCbool", + "Value": d.Get("sd_cbool"), + }) + parameterMapList = append(parameterMapList, map[string]interface{}{ + "Code": "SDC", + "Value": d.Get("sdc"), + }) + parameterMapList = append(parameterMapList, map[string]interface{}{ + "Code": "UDCbool", + "Value": d.Get("ud_cbool"), + }) + parameterMapList = append(parameterMapList, map[string]interface{}{ + "Code": "UDC", + "Value": d.Get("udc"), + }) + if v, ok := d.GetOk("dataphin"); ok { + parameterMapList = append(parameterMapList, map[string]interface{}{ + "Code": "dataphin", + "Value": v, + }) + } else if d.Get("sddp_version").(string) == "version_audit" || d.Get("sddp_version").(string) == "version_company" { + return WrapError(fmt.Errorf("attribute '%s' is required when '%s' is %v or %v", "dataphin", "sddp_version", "version_audit", "version_company")) + } + if v, ok := d.GetOk("dataphin_count"); ok { + parameterMapList = append(parameterMapList, map[string]interface{}{ + "Code": "dataphin_count", + "Value": v, + }) + } + parameterMapList = append(parameterMapList, map[string]interface{}{ + "Code": "region", + "Value": client.RegionId, + }) + request["Parameter"] = parameterMapList + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-12-14"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + if IsExpectedErrors(err, []string{"NotApplicable"}) { + conn.Endpoint = String(connectivity.BssOpenAPIEndpointInternational) + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_sddp_instance", action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Code"]) != "Success" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + responseData := response["Data"].(map[string]interface{}) + d.SetId(fmt.Sprint(responseData["InstanceId"])) + return resourceAlicloudSddpInstanceRead(d, meta) +} +func resourceAlicloudSddpInstanceRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + sddpService := SddpService{client} + object, err := sddpService.DescribeSddpInstance(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_sddp_instance sddpService.DescribeSddpInstance Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("payment_type", convertSddpInstancePaymentTypeToStandard(object["ChargeType"])) + d.Set("sddp_version", object["Version"]) + d.Set("sdc", fmt.Sprint(formatInt(object["InstanceNum"]))) + + d.Set("authed", object["Authed"]) + d.Set("renewal_status", object["RenewStatus"]) + d.Set("instance_num", fmt.Sprint(formatInt(object["InstanceNum"]))) + d.Set("odps_set", object["OdpsSet"]) + d.Set("oss_bucket_set", object["OssBucketSet"]) + d.Set("oss_size", fmt.Sprint(formatInt(object["OssSize"]))) + d.Set("rds_set", object["RdsSet"]) + d.Set("status", fmt.Sprint(formatInt(object["InstanceStatus"]))) + d.Set("remain_days", object["RemainDays"]) + return nil +} +func resourceAlicloudSddpInstanceUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "InstanceId": d.Id(), + } + request["SubscriptionType"] = d.Get("payment_type") + request["ClientToken"] = buildClientToken("ModifyInstance") + request["ProductCode"] = "sddp" + request["ProductType"] = "sddp_pre" + parameterMapList := make([]map[string]interface{}, 0) + if d.HasChange("sdc") { + update = true + } + if v, ok := d.GetOk("sdc"); ok { + parameterMapList = append(parameterMapList, map[string]interface{}{ + "Code": "SDC", + "Value": v, + }) + } + if d.HasChange("oss_size") { + update = true + } + if v, ok := d.GetOk("oss_size"); ok { + parameterMapList = append(parameterMapList, map[string]interface{}{ + "Code": "UDC", + "Value": v, + }) + } + + if d.HasChange("sd_cbool") { + update = true + } + parameterMapList = append(parameterMapList, map[string]interface{}{ + "Code": "SDCbool", + "Value": d.Get("sd_cbool"), + }) + if d.HasChange("ud_cbool") { + update = true + } + parameterMapList = append(parameterMapList, map[string]interface{}{ + "Code": "UDCbool", + "Value": d.Get("ud_cbool"), + }) + if d.HasChange("sddp_version") { + update = true + } + parameterMapList = append(parameterMapList, map[string]interface{}{ + "Code": "sddp_version", + "Value": d.Get("sddp_version"), + }) + + if d.HasChange("sdc") { + update = true + } + if v, ok := d.GetOk("sdc"); ok { + parameterMapList = append(parameterMapList, map[string]interface{}{ + "Code": "SDC", + "Value": v, + }) + } + if d.HasChange("udc") { + update = true + } + if v, ok := d.GetOk("udc"); ok { + parameterMapList = append(parameterMapList, map[string]interface{}{ + "Code": "UDC", + "Value": v, + }) + } + if d.HasChange("dataphin") { + update = true + } + if v, ok := d.GetOk("dataphin"); ok { + parameterMapList = append(parameterMapList, map[string]interface{}{ + "Code": "dataphin", + "Value": v, + }) + } + if d.HasChange("dataphin_count") { + update = true + } + if v, ok := d.GetOk("dataphin_count"); ok { + parameterMapList = append(parameterMapList, map[string]interface{}{ + "Code": "dataphin_count", + "Value": v, + }) + } + request["Parameter"] = parameterMapList + if update { + if v, ok := d.GetOk("modify_type"); ok { + request["ModifyType"] = v + } + action := "ModifyInstance" + conn, err := client.NewBssopenapiClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-12-14"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + if IsExpectedErrors(err, []string{"NotApplicable"}) { + conn.Endpoint = String(connectivity.BssOpenAPIEndpointInternational) + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + + if fmt.Sprint(response["Code"]) != "Success" { + return WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + } + return resourceAlicloudSddpInstanceRead(d, meta) +} +func resourceAlicloudSddpInstanceDelete(d *schema.ResourceData, meta interface{}) error { + log.Printf("[WARN] Cannot destroy resourceAlicloudSddpInstance. Terraform will remove this resource from the state file, however resources may remain.") + return nil +} + +func convertSddpInstancePaymentTypeToStandard(source interface{}) interface{} { + switch source { + case "PREPAY": + return "Subscription" + } + return source +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_security_center_group.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_security_center_group.go new file mode 100644 index 00000000000..69e239ee720 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_security_center_group.go @@ -0,0 +1,145 @@ +package alicloud + +import ( + "fmt" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudSecurityCenterGroup() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudSecurityCenterGroupCreate, + Read: resourceAlicloudSecurityCenterGroupRead, + Update: resourceAlicloudSecurityCenterGroupUpdate, + Delete: resourceAlicloudSecurityCenterGroupDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "group_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Computed: true, + }, + "group_name": { + Type: schema.TypeString, + Optional: true, + }, + }, + } +} +func resourceAlicloudSecurityCenterGroupCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateOrUpdateAssetGroup" + request := make(map[string]interface{}) + conn, err := client.NewSasClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("group_id"); ok { + request["GroupId"] = v + } + if v, ok := d.GetOk("group_name"); ok { + request["GroupName"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-12-03"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_security_center_group", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["GroupId"])) + return resourceAlicloudSecurityCenterGroupRead(d, meta) +} +func resourceAlicloudSecurityCenterGroupRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + sasService := SasService{client} + describeAllGroupsObject, err := sasService.DescribeAllGroups(d.Id()) + if err != nil { + return WrapError(err) + } + d.Set("group_name", describeAllGroupsObject["GroupName"]) + d.Set("group_id", describeAllGroupsObject["GroupId"]) + return nil +} +func resourceAlicloudSecurityCenterGroupUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + + var response map[string]interface{} + request := map[string]interface{}{ + "GroupId": d.Id(), + } + if v, ok := d.GetOk("group_name"); ok { + request["GroupName"] = v + } + + action := "CreateOrUpdateAssetGroup" + conn, err := client.NewSasClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-12-03"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return resourceAlicloudSecurityCenterGroupRead(d, meta) +} +func resourceAlicloudSecurityCenterGroupDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteGroup" + var response map[string]interface{} + conn, err := client.NewSasClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "GroupId": d.Id(), + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-12-03"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_security_center_service_linked_role.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_security_center_service_linked_role.go new file mode 100644 index 00000000000..9432fa6bbc1 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_security_center_service_linked_role.go @@ -0,0 +1,115 @@ +package alicloud + +import ( + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudSecurityCenterServiceLinkedRole() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudSecurityCenterServiceLinkedRoleCreate, + Read: resourceAlicloudSecurityCenterServiceLinkedRoleRead, + Delete: resourceAlicloudSecurityCenterServiceLinkedRoleDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(1 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "status": { + Type: schema.TypeBool, + Computed: true, + }, + }, + } +} + +func resourceAlicloudSecurityCenterServiceLinkedRoleCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateServiceLinkedRole" + request := make(map[string]interface{}) + conn, err := client.NewSasClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-12-03"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_security_center_service_linked_role", action, AlibabaCloudSdkGoERROR) + } + + d.SetId("AliyunServiceRolePolicyForSas") + sasService := SasService{client} + stateConf := BuildStateConf([]string{}, []string{"true"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, sasService.SecurityCenterServiceLinkedRoleStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudSecurityCenterServiceLinkedRoleRead(d, meta) +} +func resourceAlicloudSecurityCenterServiceLinkedRoleRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + sasService := SasService{client} + object, err := sasService.DescribeSecurityCenterServiceLinkedRole(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_security_center_service_linked_role sasService.DescribeSecurityCenterServiceLinkedRole Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("product_name", d.Id()) + d.Set("status", object["Status"]) + return nil +} +func resourceAlicloudSecurityCenterServiceLinkedRoleDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteServiceLinkedRole" + var response map[string]interface{} + conn, err := client.NewResourcemanagerClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "RoleName": d.Id(), + } + wait := incrementalWait(3*time.Second, 0*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-03-31"), StringPointer("AK"), request, nil, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"EntityNotExist.Role"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_security_group_rule.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_security_group_rule.go index b4ab2bf0e97..cb351fa8277 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_security_group_rule.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_security_group_rule.go @@ -103,6 +103,12 @@ func resourceAliyunSecurityGroupRule() *schema.Resource { Type: schema.TypeString, Optional: true, }, + "prefix_list_id": { + Type: schema.TypeString, + Optional: true, + Computed: true, + DiffSuppressFunc: ecsSecurityGroupRulePreFixListIdDiffSuppressFunc, + }, }, } } @@ -121,10 +127,11 @@ func resourceAliyunSecurityGroupRuleCreate(d *schema.ResourceData, meta interfac policy := d.Get("policy").(string) priority := d.Get("priority").(int) - if _, ok := d.GetOk("cidr_ip"); !ok { - if _, ok := d.GetOk("source_security_group_id"); !ok { - return WrapError(fmt.Errorf("Either 'cidr_ip' or 'source_security_group_id' must be specified.")) - } + _, cidrExist := d.GetOk("cidr_ip") + _, sourceSecurityGroupIdExist := d.GetOk("source_security_group_id") + _, prefixListIdExist := d.GetOk("prefix_list_id") + if !cidrExist && !sourceSecurityGroupIdExist && !prefixListIdExist { + return WrapError(fmt.Errorf("you must specify one of the following field: cidr_ip, source_security_group_id, prefix_list_id")) } request, err := buildAliyunSGRuleRequest(d, meta) @@ -218,10 +225,12 @@ func resourceAliyunSecurityGroupRuleRead(d *schema.ResourceData, meta interface{ d.Set("cidr_ip", object.SourceCidrIp) d.Set("source_security_group_id", object.SourceGroupId) d.Set("source_group_owner_account", object.SourceGroupOwnerAccount) + d.Set("prefix_list_id", object.SourcePrefixListId) } else { d.Set("cidr_ip", object.DestCidrIp) d.Set("source_security_group_id", object.DestGroupId) d.Set("source_group_owner_account", object.DestGroupOwnerAccount) + d.Set("prefix_list_id", object.DestPrefixListId) } return nil } @@ -374,6 +383,13 @@ func buildAliyunSGRuleRequest(d *schema.ResourceData, meta interface{}) (*reques request.QueryParams["DestCidrIp"] = v.(string) } } + if v, ok := d.GetOk("prefix_list_id"); ok { + if direction == string(DirectionIngress) { + request.QueryParams["SourcePrefixListId"] = v.(string) + } else { + request.QueryParams["DestPrefixListId"] = v.(string) + } + } var targetGroupId string if v, ok := d.GetOk("source_security_group_id"); ok { @@ -422,7 +438,7 @@ func parseSecurityRuleId(d *schema.ResourceData, meta interface{}, index int) (r parts := strings.Split(d.Id(), ":") defer func() { if e := recover(); e != nil { - fmt.Printf("Panicing %s\r\n", e) + log.Printf("Panicing %s\r\n", e) result = "" } }() diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_service_mesh_service_mesh.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_service_mesh_service_mesh.go new file mode 100644 index 00000000000..75b7ea17450 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_service_mesh_service_mesh.go @@ -0,0 +1,860 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudServiceMeshServiceMesh() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudServiceMeshServiceMeshCreate, + Read: resourceAlicloudServiceMeshServiceMeshRead, + Update: resourceAlicloudServiceMeshServiceMeshUpdate, + Delete: resourceAlicloudServiceMeshServiceMeshDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(5 * time.Minute), + Delete: schema.DefaultTimeout(5 * time.Minute), + Update: schema.DefaultTimeout(5 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "force": { + Type: schema.TypeBool, + Optional: true, + }, + "load_balancer": { + Type: schema.TypeSet, + Optional: true, + MaxItems: 1, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "api_server_public_eip": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "pilot_public_eip": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "api_server_loadbalancer_id": { + Type: schema.TypeString, + Computed: true, + }, + "pilot_public_loadbalancer_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + ForceNew: true, + }, + "mesh_config": { + Type: schema.TypeSet, + Optional: true, + MaxItems: 1, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "access_log": { + Type: schema.TypeSet, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "enabled": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + }, + }, + }, + "audit": { + Type: schema.TypeSet, + Optional: true, + MaxItems: 1, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "enabled": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "project": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + }, + }, + }, + "customized_zipkin": { + Type: schema.TypeBool, + Optional: true, + }, + "kiali": { + Type: schema.TypeSet, + Optional: true, + MaxItems: 1, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "enabled": { + Type: schema.TypeBool, + Optional: true, + }, + }, + }, + }, + "opa": { + Type: schema.TypeSet, + Optional: true, + MaxItems: 1, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "enabled": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "limit_cpu": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "limit_memory": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "log_level": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "request_cpu": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "request_memory": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + }, + }, + }, + "outbound_traffic_policy": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"ALLOW_ANY", "REGISTRY_ONLY"}, false), + }, + "pilot": { + Type: schema.TypeSet, + Optional: true, + MaxItems: 1, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "http10_enabled": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "trace_sampling": { + Type: schema.TypeFloat, + Optional: true, + }, + }, + }, + }, + "proxy": { + Type: schema.TypeSet, + Optional: true, + MaxItems: 1, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "limit_cpu": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "limit_memory": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "request_cpu": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "request_memory": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + }, + }, + }, + "sidecar_injector": { + Type: schema.TypeSet, + Optional: true, + MaxItems: 1, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "auto_injection_policy_enabled": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "enable_namespaces_by_default": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "limit_cpu": { + Type: schema.TypeString, + Optional: true, + }, + "limit_memory": { + Type: schema.TypeString, + Optional: true, + }, + "request_cpu": { + Type: schema.TypeString, + Optional: true, + }, + "request_memory": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "telemetry": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "tracing": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "enable_locality_lb": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + }, + }, + }, + "network": { + Type: schema.TypeSet, + Required: true, + MaxItems: 1, + ForceNew: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "vpc_id": { + Type: schema.TypeString, + Required: true, + }, + "vswitche_list": { + Type: schema.TypeList, + Required: true, + MaxItems: 1, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + }, + "service_mesh_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "edition": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Default", "Pro"}, false), + }, + "version": { + Type: schema.TypeString, + Computed: true, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"v1.9.7.31-g24cdcb43-aliyun", "v1.8.6.52-g60741c97-aliyun"}, false), + }, + }, + } +} + +func resourceAlicloudServiceMeshServiceMeshCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateServiceMesh" + request := make(map[string]interface{}) + conn, err := client.NewServicemeshClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("version"); ok { + request["IstioVersion"] = v + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("service_mesh_name"); ok { + request["Name"] = v + } + if v, ok := d.GetOk("edition"); ok { + request["Edition"] = v + } + + if v, ok := d.GetOk("network"); ok { + for _, networkMap := range v.(*schema.Set).List() { + if networkArg, ok := networkMap.(map[string]interface{}); ok { + if v, ok := networkArg["vpc_id"]; ok { + request["VpcId"] = v + } + if v, ok := networkArg["vswitche_list"]; ok { + request["VSwitches"] = convertListToJsonString(v.([]interface{})) + } + } + } + } + + if v, ok := d.GetOk("load_balancer"); ok { + for _, loadBalancerMap := range v.(*schema.Set).List() { + if loadBalancerArg, ok := loadBalancerMap.(map[string]interface{}); ok { + if v, ok := loadBalancerArg["api_server_public_eip"]; ok { + request["ApiServerPublicEip"] = v + } + if v, ok := loadBalancerArg["pilot_public_eip"]; ok { + request["PilotPublicEip"] = v + } + } + } + } + if v, ok := d.GetOk("mesh_config"); ok { + for _, meshConfigMap := range v.(*schema.Set).List() { + if meshConfigArg, ok := meshConfigMap.(map[string]interface{}); ok { + + if v, ok := meshConfigArg["customized_zipkin"]; ok { + request["CustomizedZipkin"] = v + } + if v, ok := meshConfigArg["tracing"]; ok { + request["Tracing"] = v + } + if v, ok := meshConfigArg["telemetry"]; ok { + request["Telemetry"] = v + } + if v, ok := meshConfigArg["enable_locality_lb"]; ok { + request["EnableLocalityLB"] = v + } + if pilot, ok := meshConfigArg["pilot"]; ok { + for _, pilotMap := range pilot.(*schema.Set).List() { + if pilotArg, ok := pilotMap.(map[string]interface{}); ok { + if v, ok := pilotArg["trace_sampling"]; ok { + request["TraceSampling"] = v + } + } + } + } + if AccessLog, ok := meshConfigArg["access_log"]; ok { + for _, AccessLogMap := range AccessLog.(*schema.Set).List() { + if AccessLogArg, ok := AccessLogMap.(map[string]interface{}); ok { + if v, ok := AccessLogArg["enabled"]; ok { + request["AccessLogEnabled"] = v + } + } + } + } + if proxy, ok := meshConfigArg["proxy"]; ok { + for _, proxyMap := range proxy.(*schema.Set).List() { + if proxyArg, ok := proxyMap.(map[string]interface{}); ok { + if v, ok := proxyArg["request_memory"]; ok { + request["ProxyRequestMemory"] = v + } + if v, ok := proxyArg["request_cpu"]; ok { + request["ProxyRequestCPU"] = v + } + if v, ok := proxyArg["limit_memory"]; ok { + request["ProxyLimitMemory"] = v + } + if v, ok := proxyArg["limit_cpu"]; ok { + request["ProxyLimitCPU"] = v + } + } + } + } + if opa, ok := meshConfigArg["opa"]; ok { + for _, opaMap := range opa.(*schema.Set).List() { + if opaArg, ok := opaMap.(map[string]interface{}); ok { + if v, ok := opaArg["enabled"]; ok { + request["OpaEnabled"] = v + } + if v, ok := opaArg["log_level"]; ok { + request["OPALogLevel"] = v + } + if v, ok := opaArg["request_cpu"]; ok { + request["OPARequestCPU"] = v + } + if v, ok := opaArg["request_memory"]; ok { + request["OPARequestMemory"] = v + } + if v, ok := opaArg["limit_cpu"]; ok { + request["OPALimitCPU"] = v + } + if v, ok := opaArg["limit_memory"]; ok { + request["OPALimitMemory"] = v + } + } + + } + } + if audit, ok := meshConfigArg["audit"]; ok { + for _, auditMap := range audit.(*schema.Set).List() { + if auditArg, ok := auditMap.(map[string]interface{}); ok { + if v, ok := auditArg["enabled"]; ok { + request["EnableAudit"] = v + } + if v, ok := auditArg["project"]; ok { + request["AuditProject"] = v + } + if v, ok := auditArg["enabled"]; ok { + request["OpaEnabled"] = v + } + } + } + } + if kiali, ok := meshConfigArg["kiali"]; ok { + for _, kialiMap := range kiali.(*schema.Set).List() { + if kialiArg, ok := kialiMap.(map[string]interface{}); ok { + if v, ok := kialiArg["enabled"]; ok { + request["KialiEnabled"] = v + } + } + } + } + } + } + } + + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-11"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"ERR404", "InvalidActiveState.ACK"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_service_mesh_service_mesh", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["ServiceMeshId"])) + servicemeshService := ServicemeshService{client} + stateConf := BuildStateConf([]string{}, []string{"running"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, servicemeshService.ServiceMeshServiceMeshStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudServiceMeshServiceMeshUpdate(d, meta) +} +func resourceAlicloudServiceMeshServiceMeshRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + servicemeshService := ServicemeshService{client} + object, err := servicemeshService.DescribeServiceMeshServiceMesh(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_service_mesh_service_mesh servicemeshService.DescribeServiceMeshServiceMesh Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("service_mesh_name", object["ServiceMeshInfo"].(map[string]interface{})["Name"]) + d.Set("edition", object["ServiceMeshInfo"].(map[string]interface{})["Profile"]) + + if spec, ok := object["Spec"]; ok { + if specArg, ok := spec.(map[string]interface{}); ok && len(specArg) > 0 { + loadBalancerSli := make([]map[string]interface{}, 0) + if loadBalancer, ok := specArg["LoadBalancer"]; ok { + if loadBalancerArg, ok := loadBalancer.(map[string]interface{}); ok && len(loadBalancerArg) > 0 { + loadBalancerMap := make(map[string]interface{}) + loadBalancerMap["pilot_public_eip"] = loadBalancerArg["PilotPublicEip"] + loadBalancerMap["pilot_public_loadbalancer_id"] = loadBalancerArg["PilotPublicLoadbalancerId"] + loadBalancerMap["api_server_loadbalancer_id"] = loadBalancerArg["ApiServerLoadbalancerId"] + loadBalancerMap["api_server_public_eip"] = loadBalancerArg["ApiServerPublicEip"] + loadBalancerSli = append(loadBalancerSli, loadBalancerMap) + } + } + d.Set("load_balancer", loadBalancerSli) + + meshConfigSli := make([]map[string]interface{}, 0) + if meshConfig, ok := specArg["MeshConfig"]; ok { + meshConfigMap := make(map[string]interface{}) + if meshConfigArg, ok := meshConfig.(map[string]interface{}); ok && len(meshConfigArg) > 0 { + accessLogSli := make([]map[string]interface{}, 0) + if accessLog, ok := meshConfigArg["AccessLog"]; ok { + if accessLogArg, ok := accessLog.(map[string]interface{}); ok && len(accessLogArg) > 0 { + accessLogMap := make(map[string]interface{}) + accessLogMap["enabled"] = accessLogArg["Enabled"] + accessLogSli = append(accessLogSli, accessLogMap) + } + } + meshConfigMap["access_log"] = accessLogSli + auditSli := make([]map[string]interface{}, 0) + if audit, ok := meshConfigArg["Audit"]; ok { + if auditArg, ok := audit.(map[string]interface{}); ok && len(auditArg) > 0 { + auditMap := make(map[string]interface{}) + auditMap["enabled"] = auditArg["Enabled"] + auditMap["project"] = auditArg["Project"] + auditSli = append(auditSli, auditMap) + meshConfigMap["audit"] = auditSli + } + } + + meshConfigMap["customized_zipkin"] = meshConfigArg["CustomizedZipkin"] + meshConfigMap["enable_locality_lb"] = meshConfigArg["EnableLocalityLB"] + + kialiSli := make([]map[string]interface{}, 0) + if kiali, ok := meshConfigArg["Kiali"]; ok { + if kialiArg, ok := kiali.(map[string]interface{}); ok && len(kialiArg) > 0 { + kialiMap := make(map[string]interface{}) + kialiMap["enabled"] = kialiArg["Enabled"] + kialiSli = append(kialiSli, kialiMap) + } + } + meshConfigMap["kiali"] = kialiSli + + opaSli := make([]map[string]interface{}, 0) + if opa, ok := meshConfigArg["OPA"]; ok { + opaMap := make(map[string]interface{}) + if opaArg, ok := opa.(map[string]interface{}); ok && len(opaArg) > 0 { + opaMap["enabled"] = opaArg["Enabled"] + opaMap["limit_cpu"] = opaArg["LimitCPU"] + opaMap["limit_memory"] = opaArg["LimitMemory"] + opaMap["log_level"] = opaArg["LogLevel"] + opaMap["request_cpu"] = opaArg["RequestCPU"] + opaMap["request_memory"] = opaArg["RequestMemory"] + } + opaSli = append(opaSli, opaMap) + } + meshConfigMap["opa"] = opaSli + meshConfigMap["outbound_traffic_policy"] = meshConfigArg["OutboundTrafficPolicy"] + + pilotSli := make([]map[string]interface{}, 0) + if pilot := meshConfigArg["Pilot"]; ok { + if pilotArg, ok := pilot.(map[string]interface{}); ok && len(pilotArg) > 0 { + pilotMap := make(map[string]interface{}) + pilotMap["http10_enabled"] = pilotArg["Http10Enabled"] + pilotMap["trace_sampling"] = pilotArg["TraceSampling"] + pilotSli = append(pilotSli, pilotMap) + } + } + meshConfigMap["pilot"] = pilotSli + + proxySli := make([]map[string]interface{}, 0) + if proxy, ok := meshConfigArg["Proxy"]; ok { + if proxyArg, ok := proxy.(map[string]interface{}); ok && len(proxyArg) > 0 { + proxyMap := make(map[string]interface{}) + proxyMap["limit_cpu"] = proxyArg["LimitCPU"] + proxyMap["limit_memory"] = proxyArg["LimitMemory"] + proxyMap["request_cpu"] = proxyArg["RequestCPU"] + proxyMap["request_memory"] = proxyArg["RequestMemory"] + proxySli = append(proxySli, proxyMap) + } + } + meshConfigMap["proxy"] = proxySli + + sidecarInjectorSli := make([]map[string]interface{}, 0) + if sidecarInjector, ok := meshConfigArg["SidecarInjector"]; ok { + if sidecarInjectorArg, ok := sidecarInjector.(map[string]interface{}); ok && len(sidecarInjectorArg) > 0 { + sidecarInjectorMap := make(map[string]interface{}) + sidecarInjectorMap["auto_injection_policy_enabled"] = sidecarInjectorArg["AutoInjectionPolicyEnabled"] + sidecarInjectorMap["enable_namespaces_by_default"] = sidecarInjectorArg["EnableNamespacesByDefault"] + sidecarInjectorMap["limit_cpu"] = sidecarInjectorArg["LimitCPU"] + sidecarInjectorMap["limit_memory"] = sidecarInjectorArg["LimitMemory"] + sidecarInjectorMap["request_cpu"] = sidecarInjectorArg["RequestCPU"] + sidecarInjectorMap["request_memory"] = sidecarInjectorArg["RequestMemory"] + sidecarInjectorSli = append(sidecarInjectorSli, sidecarInjectorMap) + } + } + meshConfigMap["sidecar_injector"] = sidecarInjectorSli + meshConfigMap["telemetry"] = meshConfigArg["Telemetry"] + meshConfigMap["tracing"] = meshConfigArg["Tracing"] + meshConfigSli = append(meshConfigSli, meshConfigMap) + } + } + d.Set("mesh_config", meshConfigSli) + + networkSli := make([]map[string]interface{}, 0) + if network, ok := specArg["Network"]; ok { + if networkArg, ok := network.(map[string]interface{}); ok && len(networkArg) > 0 { + networkMap := make(map[string]interface{}) + networkMap["vswitche_list"] = networkArg["VSwitches"] + networkMap["vpc_id"] = networkArg["VpcId"] + networkSli = append(networkSli, networkMap) + } + } + d.Set("network", networkSli) + } + } + d.Set("status", object["ServiceMeshInfo"].(map[string]interface{})["State"]) + d.Set("version", object["ServiceMeshInfo"].(map[string]interface{})["Version"]) + return nil +} +func resourceAlicloudServiceMeshServiceMeshUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + servicemeshService := ServicemeshService{client} + var response map[string]interface{} + d.Partial(true) + + update := false + updateMeshFeatureReq := map[string]interface{}{ + "ServiceMeshId": d.Id(), + } + if d.HasChange("mesh_config") { + update = true + } + + if v, ok := d.GetOk("mesh_config"); ok { + for _, meshConfigMap := range v.(*schema.Set).List() { + if meshConfigArg, ok := meshConfigMap.(map[string]interface{}); ok { + + if v, ok := meshConfigArg["customized_zipkin"]; ok { + updateMeshFeatureReq["CustomizedZipkin"] = v + } + if v, ok := meshConfigArg["outbound_traffic_policy"]; ok { + updateMeshFeatureReq["OutboundTrafficPolicy"] = v + } + if proxy, ok := meshConfigArg["proxy"]; ok { + for _, proxyMap := range proxy.(*schema.Set).List() { + if proxyArg, ok := proxyMap.(map[string]interface{}); ok { + if v, ok := proxyArg["request_memory"]; ok { + updateMeshFeatureReq["ProxyRequestMemory"] = v + } + if v, ok := proxyArg["request_cpu"]; ok { + updateMeshFeatureReq["ProxyRequestCPU"] = v + } + if v, ok := proxyArg["limit_memory"]; ok { + updateMeshFeatureReq["ProxyLimitMemory"] = v + } + if v, ok := proxyArg["limit_cpu"]; ok { + updateMeshFeatureReq["ProxyLimitCPU"] = v + } + } + } + } + if AccessLog, ok := meshConfigArg["access_log"]; ok { + for _, AccessLogMap := range AccessLog.(*schema.Set).List() { + if AccessLogArg, ok := AccessLogMap.(map[string]interface{}); ok { + if v, ok := AccessLogArg["enabled"]; ok { + updateMeshFeatureReq["AccessLogEnabled"] = v + } + } + } + } + if sidecarInjector, ok := meshConfigArg["sidecar_injector"]; ok && !d.IsNewResource() { + for _, sidecarInjectorMap := range sidecarInjector.(*schema.Set).List() { + if sidecarInjectorArg, ok := sidecarInjectorMap.(map[string]interface{}); ok { + if v, ok := sidecarInjectorArg["auto_injection_policy_enabled"]; ok { + updateMeshFeatureReq["AutoInjectionPolicyEnabled"] = v + } + if v, ok := sidecarInjectorArg["enable_namespaces_by_default"]; ok { + updateMeshFeatureReq["EnableNamespacesByDefault"] = v + } + if v, ok := sidecarInjectorArg["limit_cpu"]; ok { + updateMeshFeatureReq["SidecarInjectorLimitCPU"] = v + } + if v, ok := sidecarInjectorArg["limit_memory"]; ok { + updateMeshFeatureReq["SidecarInjectorLimitMemory"] = v + } + if v, ok := sidecarInjectorArg["request_cpu"]; ok { + updateMeshFeatureReq["SidecarInjectorRequestCPU"] = v + } + if v, ok := sidecarInjectorArg["request_memory"]; ok { + updateMeshFeatureReq["SidecarInjectorRequestMemory"] = v + } + } + } + } + + if AccessLog, ok := meshConfigArg["mesh_config"]; ok { + for _, AccessLogMap := range AccessLog.(*schema.Set).List() { + if AccessLogArg, ok := AccessLogMap.(map[string]interface{}); ok { + if v, ok := AccessLogArg["enabled"]; ok { + updateMeshFeatureReq["AccessLogEnabled"] = v + } + } + } + } + if v, ok := meshConfigArg["tracing"]; ok { + updateMeshFeatureReq["Tracing"] = v + } + if v, ok := meshConfigArg["telemetry"]; ok { + updateMeshFeatureReq["Telemetry"] = v + } + if pilot, ok := meshConfigArg["pilot"]; ok { + for _, pilotMap := range pilot.(*schema.Set).List() { + if pilotArg, ok := pilotMap.(map[string]interface{}); ok { + if v, ok := pilotArg["trace_sampling"]; ok { + updateMeshFeatureReq["TraceSampling"] = v + } + if v, ok := pilotArg["http10_enabled"]; ok { + updateMeshFeatureReq["Http10Enabled"] = v + } + } + } + } + if opa, ok := meshConfigArg["opa"]; ok { + for _, opaMap := range opa.(*schema.Set).List() { + if opaArg, ok := opaMap.(map[string]interface{}); ok { + if v, ok := opaArg["enabled"]; ok { + updateMeshFeatureReq["OpaEnabled"] = v + } + if v, ok := opaArg["log_level"]; ok { + updateMeshFeatureReq["OPALogLevel"] = v + } + if v, ok := opaArg["request_cpu"]; ok { + updateMeshFeatureReq["OPARequestCPU"] = v + } + if v, ok := opaArg["request_memory"]; ok { + updateMeshFeatureReq["OPARequestMemory"] = v + } + if v, ok := opaArg["limit_cpu"]; ok { + updateMeshFeatureReq["OPALimitCPU"] = v + } + if v, ok := opaArg["limit_memory"]; ok { + updateMeshFeatureReq["OPALimitMemory"] = v + } + } + } + } + if audit, ok := meshConfigArg["audit"]; ok { + for _, auditMap := range audit.(*schema.Set).List() { + if auditArg, ok := auditMap.(map[string]interface{}); ok { + if v, ok := auditArg["enabled"]; ok { + updateMeshFeatureReq["EnableAudit"] = v + } + if v, ok := auditArg["project"]; ok { + updateMeshFeatureReq["AuditProject"] = v + } + } + } + } + if kiali, ok := meshConfigArg["kiali"]; ok { + for _, kialiMap := range kiali.(*schema.Set).List() { + if kialiArg, ok := kialiMap.(map[string]interface{}); ok { + if v, ok := kialiArg["enabled"]; ok { + updateMeshFeatureReq["KialiEnabled"] = v + } + } + } + } + } + } + } + if update { + action := "UpdateMeshFeature" + conn, err := client.NewServicemeshClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-11"), StringPointer("AK"), nil, updateMeshFeatureReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, updateMeshFeatureReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"running"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, servicemeshService.ServiceMeshServiceMeshStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + d.Partial(false) + return resourceAlicloudServiceMeshServiceMeshRead(d, meta) +} +func resourceAlicloudServiceMeshServiceMeshDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + servicemeshService := ServicemeshService{client} + action := "DeleteServiceMesh" + var response map[string]interface{} + conn, err := client.NewServicemeshClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "ServiceMeshId": d.Id(), + } + + if v, ok := d.GetOkExists("force"); ok { + request["Force"] = v + } + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-11"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"ErrorPermitted.ClustersNotEmpty", "RelatedResourceReused"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"ServiceMesh.NotFound"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{}, d.Timeout(schema.TimeoutDelete), 5*time.Second, servicemeshService.ServiceMeshServiceMeshStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_simple_application_server_custom_image.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_simple_application_server_custom_image.go new file mode 100644 index 00000000000..0159eda9890 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_simple_application_server_custom_image.go @@ -0,0 +1,215 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudSimpleApplicationServerCustomImage() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudSimpleApplicationServerCustomImageCreate, + Read: resourceAlicloudSimpleApplicationServerCustomImageRead, + Update: resourceAlicloudSimpleApplicationServerCustomImageUpdate, + Delete: resourceAlicloudSimpleApplicationServerCustomImageDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "custom_image_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile("^[0-9a-zA-Z\u4E00-\u9FA5][\u4E00-\u9FA5A-Za-z0-9:_-]{2,128}$"), "The name must be `2` to `128` characters in length. It must start with a letter or a number. It can contain letters, digits, colons (:), underscores (_) and hyphens (-)."), + }, + "description": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "instance_id": { + Type: schema.TypeString, + Required: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"Share", "UnShare"}, false), + }, + "system_snapshot_id": { + Type: schema.TypeString, + Required: true, + }, + }, + } +} + +func resourceAlicloudSimpleApplicationServerCustomImageCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateCustomImage" + request := make(map[string]interface{}) + conn, err := client.NewSwasClient() + if err != nil { + return WrapError(err) + } + request["ImageName"] = d.Get("custom_image_name") + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + request["InstanceId"] = d.Get("instance_id") + request["RegionId"] = client.RegionId + request["SystemSnapshotId"] = d.Get("system_snapshot_id") + request["ClientToken"] = buildClientToken("CreateCustomImage") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_simple_application_server_custom_image", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["ImageId"])) + + return resourceAlicloudSimpleApplicationServerCustomImageUpdate(d, meta) +} +func resourceAlicloudSimpleApplicationServerCustomImageRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + swasOpenService := SwasOpenService{client} + object, err := swasOpenService.DescribeSimpleApplicationServerCustomImage(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_simple_application_server_custom_image swasOpenService.DescribeSimpleApplicationServerCustomImage Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("custom_image_name", object["ImageName"]) + d.Set("description", object["Description"]) + return nil +} +func resourceAlicloudSimpleApplicationServerCustomImageUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "ImageId": d.Id(), + } + if d.HasChange("status") { + update = true + if v, ok := d.GetOk("status"); ok { + request["Operation"] = v + } + } + if update { + action := "ModifyImageShareStatus" + conn, err := client.NewSwasClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("ModifyImageShareStatus") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudSimpleApplicationServerCustomImageRead(d, meta) +} +func resourceAlicloudSimpleApplicationServerCustomImageDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + if v := d.Get("status"); v.(string) == "Share" { + var response map[string]interface{} + request := map[string]interface{}{ + "ImageId": d.Id(), + "Operation": "UnShare", + } + action := "ModifyImageShareStatus" + conn, err := client.NewSwasClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("ModifyImageShareStatus") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + action := "DeleteCustomImage" + var response map[string]interface{} + conn, err := client.NewSwasClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "ImageId": d.Id(), + } + + request["RegionId"] = client.RegionId + request["ClientToken"] = buildClientToken("DeleteCustomImage") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_simple_application_server_firewall_rule.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_simple_application_server_firewall_rule.go new file mode 100644 index 00000000000..a5146499347 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_simple_application_server_firewall_rule.go @@ -0,0 +1,166 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudSimpleApplicationServerFirewallRule() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudSimpleApplicationServerFirewallRuleCreate, + Read: resourceAlicloudSimpleApplicationServerFirewallRuleRead, + Delete: resourceAlicloudSimpleApplicationServerFirewallRuleDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "firewall_rule_id": { + Type: schema.TypeString, + Computed: true, + }, + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "port": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "remark": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "rule_protocol": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Tcp", "TcpAndUdp", "Udp"}, false), + }, + }, + } +} + +func resourceAlicloudSimpleApplicationServerFirewallRuleCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateFirewallRule" + request := make(map[string]interface{}) + conn, err := client.NewSwasClient() + if err != nil { + return WrapError(err) + } + request["InstanceId"] = d.Get("instance_id") + request["Port"] = d.Get("port") + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("remark"); ok { + request["Remark"] = v + } + request["RuleProtocol"] = d.Get("rule_protocol") + request["ClientToken"] = buildClientToken("CreateFirewallRule") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_simple_application_server_firewall_rule", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["InstanceId"], ":", response["FirewallId"])) + + return resourceAlicloudSimpleApplicationServerFirewallRuleRead(d, meta) +} +func resourceAlicloudSimpleApplicationServerFirewallRuleRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + swasOpenService := SwasOpenService{client} + object, err := swasOpenService.DescribeSimpleApplicationServerFirewallRule(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_simple_application_server_firewall_rule swasOpenService.DescribeSimpleApplicationServerFirewallRule Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Set("firewall_rule_id", parts[1]) + d.Set("instance_id", parts[0]) + d.Set("port", object["Port"]) + d.Set("remark", object["Remark"]) + d.Set("rule_protocol", convertSimpleApplicationServerFirewallRuleRuleProtocolResponse(object["RuleProtocol"].(string))) + return nil +} +func resourceAlicloudSimpleApplicationServerFirewallRuleDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + action := "DeleteFirewallRule" + var response map[string]interface{} + conn, err := client.NewSwasClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "RuleId": parts[1], + "InstanceId": parts[0], + } + + request["RegionId"] = client.RegionId + request["ClientToken"] = buildClientToken("DeleteFirewallRule") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} + +func convertSimpleApplicationServerFirewallRuleRuleProtocolResponse(source string) string { + switch source { + case "TCP": + return "Tcp" + case "UDP": + return "Udp" + case "TCP+UDP": + return "TcpAndUdp" + } + return source +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_simple_application_server_instance.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_simple_application_server_instance.go new file mode 100644 index 00000000000..15b66368a53 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_simple_application_server_instance.go @@ -0,0 +1,423 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudSimpleApplicationServerInstance() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudSimpleApplicationServerInstanceCreate, + Read: resourceAlicloudSimpleApplicationServerInstanceRead, + Update: resourceAlicloudSimpleApplicationServerInstanceUpdate, + Delete: resourceAlicloudSimpleApplicationServerInstanceDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(5 * time.Minute), + Update: schema.DefaultTimeout(5 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "auto_renew": { + Type: schema.TypeBool, + Optional: true, + }, + "auto_renew_period": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validation.IntInSlice([]int{1, 12, 24, 3, 36, 6}), + }, + "data_disk_size": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validation.IntBetween(0, 16380), + }, + "image_id": { + Type: schema.TypeString, + Required: true, + }, + "instance_name": { + Type: schema.TypeString, + Optional: true, + }, + "password": { + Type: schema.TypeString, + Optional: true, + }, + "payment_type": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Subscription"}, false), + }, + "period": { + Type: schema.TypeInt, + Required: true, + ValidateFunc: validation.IntInSlice([]int{1, 12, 24, 3, 36, 6}), + }, + "plan_id": { + Type: schema.TypeString, + Required: true, + }, + "status": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"Resetting", "Running", "Stopped", "Upgrading"}, false), + }, + }, + } +} + +func resourceAlicloudSimpleApplicationServerInstanceCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateInstances" + request := make(map[string]interface{}) + conn, err := client.NewSwasClient() + if err != nil { + return WrapError(err) + } + request["Amount"] = 1 + if v, ok := d.GetOkExists("auto_renew"); ok { + request["AutoRenew"] = v + } + if v, ok := d.GetOk("auto_renew_period"); ok { + request["AutoRenewPeriod"] = v + } + if v, ok := d.GetOk("data_disk_size"); ok { + request["DataDiskSize"] = v + } + request["ImageId"] = d.Get("image_id") + if v, ok := d.GetOk("payment_type"); ok { + request["ChargeType"] = convertSimpleApplicationServerInstancePaymentTypeRequest(v.(string)) + } + request["Period"] = d.Get("period") + request["PlanId"] = d.Get("plan_id") + request["RegionId"] = client.RegionId + request["ClientToken"] = buildClientToken("CreateInstances") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_simple_application_server_instance", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["InstanceIds"].([]interface{})[0])) + + swasOpenService := SwasOpenService{client} + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, swasOpenService.SimpleApplicationServerInstanceStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudSimpleApplicationServerInstanceUpdate(d, meta) +} +func resourceAlicloudSimpleApplicationServerInstanceRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + swasOpenService := SwasOpenService{client} + object, err := swasOpenService.DescribeSimpleApplicationServerInstance(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_simple_application_server_instance swasOpenService.DescribeSimpleApplicationServerInstance Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("image_id", object["ImageId"]) + d.Set("instance_name", object["InstanceName"]) + d.Set("payment_type", convertSimpleApplicationServerInstancePaymentTypeResponse(object["ChargeType"])) + d.Set("plan_id", object["PlanId"]) + d.Set("status", object["Status"]) + return nil +} +func resourceAlicloudSimpleApplicationServerInstanceUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + swasOpenService := SwasOpenService{client} + var response map[string]interface{} + d.Partial(true) + + update := false + request := map[string]interface{}{ + "InstanceId": d.Id(), + } + if !d.IsNewResource() && d.HasChange("image_id") { + update = true + } + request["ImageId"] = d.Get("image_id") + request["RegionId"] = client.RegionId + if update { + action := "ResetSystem" + conn, err := client.NewSwasClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("ResetSystem") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 10*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if IsExpectedErrors(err, []string{"IncorrectInstanceStatus"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, swasOpenService.SimpleApplicationServerInstanceStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + d.SetPartial("image_id") + } + update = false + upgradeInstanceReq := map[string]interface{}{ + "InstanceId": d.Id(), + } + if !d.IsNewResource() && d.HasChange("plan_id") { + update = true + } + upgradeInstanceReq["PlanId"] = d.Get("plan_id") + upgradeInstanceReq["RegionId"] = client.RegionId + if update { + action := "UpgradeInstance" + conn, err := client.NewSwasClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("UpgradeInstance") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 10*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-01"), StringPointer("AK"), nil, upgradeInstanceReq, &runtime) + if err != nil { + if IsExpectedErrors(err, []string{"IncorrectInstanceStatus"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, upgradeInstanceReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, swasOpenService.SimpleApplicationServerInstanceStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + d.SetPartial("plan_id") + } + update = false + updateInstanceAttributeReq := map[string]interface{}{ + "InstanceId": d.Id(), + } + updateInstanceAttributeReq["RegionId"] = client.RegionId + if d.HasChange("instance_name") { + update = true + if v, ok := d.GetOk("instance_name"); ok { + updateInstanceAttributeReq["InstanceName"] = v + } + } + if d.HasChange("password") { + update = true + if v, ok := d.GetOk("password"); ok { + updateInstanceAttributeReq["Password"] = v + } + } + if update { + action := "UpdateInstanceAttribute" + conn, err := client.NewSwasClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("UpdateInstanceAttribute") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 10*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-01"), StringPointer("AK"), nil, updateInstanceAttributeReq, &runtime) + if err != nil { + if IsExpectedErrors(err, []string{"IncorrectInstanceStatus"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, updateInstanceAttributeReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, swasOpenService.SimpleApplicationServerInstanceStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + d.SetPartial("instance_name") + d.SetPartial("password") + } + if d.HasChange("status") { + object, err := swasOpenService.DescribeSimpleApplicationServerInstance(d.Id()) + if err != nil { + return WrapError(err) + } + target := d.Get("status").(string) + if object["Status"].(string) != target { + if target == "Resetting" { + request := map[string]interface{}{ + "InstanceId": d.Id(), + } + request["RegionId"] = client.RegionId + action := "RebootInstance" + conn, err := client.NewSwasClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("RebootInstance") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 10*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if IsExpectedErrors(err, []string{"IncorrectInstanceStatus"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, swasOpenService.SimpleApplicationServerInstanceStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + if target == "Running" { + request := map[string]interface{}{ + "InstanceId": d.Id(), + } + request["RegionId"] = client.RegionId + action := "StartInstance" + conn, err := client.NewSwasClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("StartInstance") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 10*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if IsExpectedErrors(err, []string{"IncorrectInstanceStatus"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Running"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, swasOpenService.SimpleApplicationServerInstanceStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + if target == "Stopped" { + request := map[string]interface{}{ + "InstanceId": d.Id(), + } + request["RegionId"] = client.RegionId + action := "StopInstance" + conn, err := client.NewSwasClient() + if err != nil { + return WrapError(err) + } + request["ClientToken"] = buildClientToken("StopInstance") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 10*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if IsExpectedErrors(err, []string{"IncorrectInstanceStatus", "Throttling.User"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Stopped"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, swasOpenService.SimpleApplicationServerInstanceStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + d.SetPartial("status") + } + } + d.Partial(false) + return resourceAlicloudSimpleApplicationServerInstanceRead(d, meta) +} +func resourceAlicloudSimpleApplicationServerInstanceDelete(d *schema.ResourceData, meta interface{}) error { + log.Printf("[WARN] Cannot destroy resourceAlicloudSimpleApplicationServerInstance. Terraform will remove this resource from the state file, however resources may remain.") + return nil +} +func convertSimpleApplicationServerInstancePaymentTypeRequest(source interface{}) interface{} { + switch source { + case "Subscription": + return "PrePaid" + } + return source +} +func convertSimpleApplicationServerInstancePaymentTypeResponse(source interface{}) interface{} { + switch source { + case "PrePaid": + return "Subscription" + } + return source +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_simple_application_server_snapshot.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_simple_application_server_snapshot.go new file mode 100644 index 00000000000..8424ebf779f --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_simple_application_server_snapshot.go @@ -0,0 +1,139 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudSimpleApplicationServerSnapshot() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudSimpleApplicationServerSnapshotCreate, + Read: resourceAlicloudSimpleApplicationServerSnapshotRead, + Delete: resourceAlicloudSimpleApplicationServerSnapshotDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(20 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "disk_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "snapshot_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile("^[a-zA-Z\u4E00-\u9FA5][\u4E00-\u9FA5A-Za-z0-9:._-]{2,50}$"), "The name must be 2 to 50 characters in length. It must start with a letter and cannot start with `http://` or `https://`. It can contain letters, digits, colons (:), underscores (_), periods (.),and hyphens (-)."), + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudSimpleApplicationServerSnapshotCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateSnapshot" + request := make(map[string]interface{}) + conn, err := client.NewSwasClient() + if err != nil { + return WrapError(err) + } + request["DiskId"] = d.Get("disk_id") + request["RegionId"] = client.RegionId + request["SnapshotName"] = d.Get("snapshot_name") + request["ClientToken"] = buildClientToken("CreateSnapshot") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_simple_application_server_snapshot", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["SnapshotId"])) + swasOpenService := SwasOpenService{client} + stateConf := BuildStateConf([]string{}, []string{"Accomplished"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, swasOpenService.SimpleApplicationServerSnapshotStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudSimpleApplicationServerSnapshotRead(d, meta) +} +func resourceAlicloudSimpleApplicationServerSnapshotRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + swasOpenService := SwasOpenService{client} + object, err := swasOpenService.DescribeSimpleApplicationServerSnapshot(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_simple_application_server_snapshot swasOpenService.DescribeSimpleApplicationServerSnapshot Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("disk_id", object["SourceDiskId"]) + d.Set("snapshot_name", object["SnapshotName"]) + d.Set("status", object["Status"]) + return nil +} +func resourceAlicloudSimpleApplicationServerSnapshotDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteSnapshot" + var response map[string]interface{} + conn, err := client.NewSwasClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "SnapshotId": d.Id(), + } + + request["RegionId"] = client.RegionId + request["ClientToken"] = buildClientToken("DeleteSnapshot") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_slb_acl.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_slb_acl.go index 88190b6e650..4ba6ab558e4 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_slb_acl.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_slb_acl.go @@ -1,13 +1,15 @@ package alicloud import ( + "fmt" "strings" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "time" - "github.com/aliyun/alibaba-cloud-sdk-go/services/slb" "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" @@ -66,25 +68,41 @@ func resourceAlicloudSlbAcl() *schema.Resource { func resourceAlicloudSlbAclCreate(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) - - request := slb.CreateCreateAccessControlListRequest() - request.RegionId = client.RegionId + var response map[string]interface{} + action := "CreateAccessControlList" + request := make(map[string]interface{}) + conn, err := client.NewSlbClient() + if err != nil { + return WrapError(err) + } + request["RegionId"] = client.RegionId if v := d.Get("resource_group_id").(string); v != "" { - request.ResourceGroupId = v + request["ResourceGroupId"] = v + } + request["AclName"] = strings.TrimSpace(d.Get("name").(string)) + if v, ok := d.GetOk("address_ip_version"); ok { + request["AddressIPVersion"] = v } - request.AclName = strings.TrimSpace(d.Get("name").(string)) - request.AddressIPVersion = d.Get("ip_version").(string) - raw, err := client.WithSlbClient(func(slbClient *slb.Client) (interface{}, error) { - return slbClient.CreateAccessControlList(request) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil }) + addDebug(action, response, request) + if err != nil { - return WrapErrorf(err, DefaultErrorMsg, "alicloud_slb_acl", request.GetActionName(), AlibabaCloudSdkGoERROR) + return WrapErrorf(err, DefaultErrorMsg, "alicloud_slb_acl", action, AlibabaCloudSdkGoERROR) } - addDebug(request.GetActionName(), raw, request.RpcRequest, request) - response, _ := raw.(*slb.CreateAccessControlListResponse) - d.SetId(response.AclId) + d.SetId(fmt.Sprint(response["AclId"])) return resourceAlicloudSlbAclUpdate(d, meta) } @@ -106,12 +124,26 @@ func resourceAlicloudSlbAclRead(d *schema.ResourceData, meta interface{}) error } return WrapError(err) } - d.Set("name", object.AclName) - d.Set("resource_group_id", object.ResourceGroupId) - d.Set("ip_version", object.AddressIPVersion) + d.Set("name", object["AclName"]) + d.Set("resource_group_id", object["ResourceGroupId"]) + d.Set("ip_version", object["AddressIPVersion"]) - if err := d.Set("entry_list", slbService.FlattenSlbAclEntryMappings(object.AclEntrys.AclEntry)); err != nil { - return WrapError(err) + if aclEntrys, ok := object["AclEntrys"]; ok { + if v, ok := aclEntrys.(map[string]interface{})["AclEntry"].([]interface{}); ok { + aclEntry := make([]map[string]interface{}, 0) + for _, val := range v { + item := val.(map[string]interface{}) + temp := map[string]interface{}{ + "comment": item["AclEntryComment"], + "entry": item["AclEntryIP"], + } + + aclEntry = append(aclEntry, temp) + } + if err := d.Set("entry_list", aclEntry); err != nil { + return WrapError(err) + } + } } return nil } @@ -119,25 +151,45 @@ func resourceAlicloudSlbAclRead(d *schema.ResourceData, meta interface{}) error func resourceAlicloudSlbAclUpdate(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) slbService := SlbService{client} - + var response map[string]interface{} d.Partial(true) - if err := slbService.setInstanceTags(d, TagResourceAcl); err != nil { - return WrapError(err) + if d.HasChange("tags") { + if err := slbService.setInstanceTags(d, TagResourceAcl); err != nil { + return WrapError(err) + } + d.SetPartial("tags") } if !d.IsNewResource() && d.HasChange("name") { - request := slb.CreateSetAccessControlListAttributeRequest() - request.RegionId = client.RegionId - request.AclId = d.Id() - request.AclName = d.Get("name").(string) - raw, err := client.WithSlbClient(func(slbClient *slb.Client) (interface{}, error) { - return slbClient.SetAccessControlListAttribute(request) + request := map[string]interface{}{ + "AclId": d.Id(), + } + if v, ok := d.GetOk("name"); ok { + request["AclName"] = v + } + request["RegionId"] = client.RegionId + action := "SetAccessControlListAttribute" + conn, err := client.NewSlbClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil }) + addDebug(action, response, request) if err != nil { - return WrapErrorf(err, DefaultErrorMsg, d.Id(), request.GetActionName(), AlibabaCloudSdkGoERROR) + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) } - addDebug(request.GetActionName(), raw, request.RpcRequest, request) d.SetPartial("name") } @@ -149,19 +201,78 @@ func resourceAlicloudSlbAclUpdate(d *schema.ResourceData, meta interface{}) erro add := ne.Difference(oe).List() if len(remove) > 0 { - if err := slbService.SlbRemoveAccessControlListEntry(remove, d.Id()); err != nil { - return WrapError(err) + removeList := SplitSlice(remove, 50) + for _, item := range removeList { + removedRequest := map[string]interface{}{ + "AclId": d.Id(), + "RegionId": client.RegionId, + } + aclEntries, err := slbService.convertAclEntriesToString(item) + if err != nil { + return WrapError(err) + } + removedRequest["AclEntrys"] = aclEntries + action := "RemoveAccessControlListEntry" + conn, err := client.NewSlbClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-15"), StringPointer("AK"), nil, removedRequest, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, removedRequest) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } } } if len(add) > 0 { - if err := slbService.SlbAddAccessControlListEntry(add, d.Id()); err != nil { - return WrapError(err) + addList := SplitSlice(add, 50) + for _, item := range addList { + addedRequest := map[string]interface{}{ + "AclId": d.Id(), + "RegionId": client.RegionId, + } + aclEntries, err := slbService.convertAclEntriesToString(item) + if err != nil { + return WrapError(err) + } + addedRequest["AclEntrys"] = aclEntries + action := "AddAccessControlListEntry" + conn, err := client.NewSlbClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-15"), StringPointer("AK"), nil, addedRequest, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, addedRequest) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } } } d.SetPartial("entry_list") } - d.Partial(false) return resourceAlicloudSlbAclRead(d, meta) @@ -169,29 +280,35 @@ func resourceAlicloudSlbAclUpdate(d *schema.ResourceData, meta interface{}) erro func resourceAlicloudSlbAclDelete(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) - slbService := SlbService{client} - request := slb.CreateDeleteAccessControlListRequest() - request.RegionId = client.RegionId - request.AclId = d.Id() - err := resource.Retry(3*time.Minute, func() *resource.RetryError { - raw, err := client.WithSlbClient(func(slbClient *slb.Client) (interface{}, error) { - return slbClient.DeleteAccessControlList(request) - }) + action := "DeleteAccessControlList" + var response map[string]interface{} + conn, err := client.NewSlbClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "AclId": d.Id(), + "RegionId": client.RegionId, + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) if err != nil { - if IsExpectedErrors(err, []string{"AclInUsed"}) { + if NeedRetry(err) { + wait() return resource.RetryableError(err) } return resource.NonRetryableError(err) - } - addDebug(request.GetActionName(), raw, request.RpcRequest, request) return nil }) - + addDebug(action, response, request) if err != nil { - if !IsExpectedErrors(err, []string{"AclNotExist"}) { - return WrapErrorf(err, DefaultErrorMsg, d.Id(), request.GetActionName(), AlibabaCloudSdkGoERROR) + if IsExpectedErrors(err, []string{"AclNotExist"}) { + return nil } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) } - return WrapError(slbService.WaitForSlbAcl(d.Id(), Deleted, DefaultTimeoutMedium)) + return nil } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_slb_listener.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_slb_listener.go index 4fe1ba876d0..667b1227544 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_slb_listener.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_slb_listener.go @@ -83,7 +83,7 @@ func resourceAliyunSlbListener() *schema.Resource { }, "scheduler": { Type: schema.TypeString, - ValidateFunc: validation.StringInSlice([]string{"wrr", "wlc", "rr", "sch"}, false), + ValidateFunc: validation.StringInSlice([]string{"wrr", "wlc", "rr", "sch", "tch", "qch"}, false), Optional: true, Default: WRRScheduler, }, @@ -235,7 +235,7 @@ func resourceAliyunSlbListener() *schema.Resource { ValidateFunc: validateAllowedSplitStringValue([]string{ string(HTTP_2XX), string(HTTP_3XX), string(HTTP_4XX), string(HTTP_5XX)}, ","), Optional: true, - Default: HTTP_2XX, + Computed: true, DiffSuppressFunc: httpHttpsTcpDiffSuppressFunc, }, //https @@ -357,7 +357,6 @@ func resourceAliyunSlbListener() *schema.Resource { "delete_protection_validation": { Type: schema.TypeBool, Optional: true, - Default: false, }, }, } @@ -369,7 +368,7 @@ func resourceAliyunSlbListenerCreate(d *schema.ResourceData, meta interface{}) e slbService := SlbService{client} httpForward := false protocol := d.Get("protocol").(string) - lb_id := d.Get("load_balancer_id").(string) + lbId := d.Get("load_balancer_id").(string) frontend := d.Get("frontend_port").(int) if listenerForward, ok := d.GetOk("listener_forward"); ok && listenerForward.(string) == string(OnFlag) { httpForward = true @@ -417,7 +416,7 @@ func resourceAliyunSlbListenerCreate(d *schema.ResourceData, meta interface{}) e return WrapErrorf(err, DefaultErrorMsg, "alicloud_slb_listener", request.GetActionName(), AlibabaCloudSdkGoERROR) } addDebug(request.GetActionName(), raw, request, request.QueryParams) - d.SetId(lb_id + ":" + protocol + ":" + strconv.Itoa(frontend)) + d.SetId(lbId + ":" + protocol + ":" + strconv.Itoa(frontend)) if err := slbService.WaitForSlbListener(d.Id(), Stopped, DefaultTimeout); err != nil { return WrapError(err) @@ -425,7 +424,7 @@ func resourceAliyunSlbListenerCreate(d *schema.ResourceData, meta interface{}) e startLoadBalancerListenerRequest := slb.CreateStartLoadBalancerListenerRequest() startLoadBalancerListenerRequest.RegionId = client.RegionId - startLoadBalancerListenerRequest.LoadBalancerId = lb_id + startLoadBalancerListenerRequest.LoadBalancerId = lbId startLoadBalancerListenerRequest.ListenerPort = requests.NewInteger(frontend) startLoadBalancerListenerRequest.ListenerProtocol = protocol @@ -675,7 +674,7 @@ func resourceAliyunSlbListenerUpdate(d *schema.ResourceData, meta interface{}) e update = true } if d.HasChange("health_check_http_code") { - tcpArgs.QueryParams["HealthCheckHttpCode"] = d.Get("health_check_http_code").(string) + tcpArgs.QueryParams["HealthCheckHttpCode"] = getHealthCheckHttpCodeValue(d) update = true } @@ -774,7 +773,7 @@ func resourceAliyunSlbListenerDelete(d *schema.ResourceData, meta interface{}) e } return WrapError(err) } - if d.Get("delete_protection_validation").(bool) { + if v, ok := d.GetOkExists("delete_protection_validation"); ok && v.(bool) { lbInstance, err := slbService.DescribeSlb(lbId) if err != nil { if NotFoundError(err) { @@ -852,6 +851,10 @@ func buildListenerCommonArgs(d *schema.ResourceData, meta interface{}) (*request if description, ok := d.GetOk("description"); ok && description.(string) != "" { request.QueryParams["Description"] = description.(string) } + // scheduler + if scheduler, ok := d.GetOk("scheduler"); ok && scheduler.(string) != "" { + request.QueryParams["Scheduler"] = scheduler.(string) + } return request, nil @@ -896,10 +899,10 @@ func buildHttpListenerArgs(d *schema.ResourceData, req *requests.CommonRequest) req.QueryParams["UnhealthyThreshold"] = string(requests.NewInteger(d.Get("unhealthy_threshold").(int))) req.QueryParams["HealthCheckTimeout"] = string(requests.NewInteger(d.Get("health_check_timeout").(int))) req.QueryParams["HealthCheckInterval"] = string(requests.NewInteger(d.Get("health_check_interval").(int))) - req.QueryParams["HealthCheckHttpCode"] = d.Get("health_check_http_code").(string) + req.QueryParams["HealthCheckHttpCode"] = getHealthCheckHttpCodeValue(d) if d.Get("protocol").(string) == "http" || d.Get("protocol").(string) == "https" { - if health_check_method, ok := d.GetOk("health_check_method"); ok && health_check_method.(string) != "" { - req.QueryParams["HealthCheckMethod"] = health_check_method.(string) + if healthCheckMethod, ok := d.GetOk("health_check_method"); ok && healthCheckMethod.(string) != "" { + req.QueryParams["HealthCheckMethod"] = healthCheckMethod.(string) } } } @@ -1110,3 +1113,11 @@ func readListener(d *schema.ResourceData, listener map[string]interface{}) { return } + +func getHealthCheckHttpCodeValue(d *schema.ResourceData) string { + if v, ok := d.GetOk("health_check_http_code"); ok && v.(string) != "" { + return v.(string) + } + // After the version 1.144.0, removes health_check_http_code Default and using Computed instead. + return string(HTTP_2XX) +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_slb_tls_cipher_policy.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_slb_tls_cipher_policy.go new file mode 100644 index 00000000000..7b0ed6ac6ca --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_slb_tls_cipher_policy.go @@ -0,0 +1,173 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudSlbTlsCipherPolicy() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudSlbTlsCipherPolicyCreate, + Read: resourceAlicloudSlbTlsCipherPolicyRead, + Update: resourceAlicloudSlbTlsCipherPolicyUpdate, + Delete: resourceAlicloudSlbTlsCipherPolicyDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "ciphers": { + Type: schema.TypeList, + Required: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "tls_cipher_policy_name": { + Type: schema.TypeString, + Required: true, + }, + "tls_versions": { + Type: schema.TypeList, + Required: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + } +} + +func resourceAlicloudSlbTlsCipherPolicyCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateTLSCipherPolicy" + request := make(map[string]interface{}) + conn, err := client.NewSlbClient() + if err != nil { + return WrapError(err) + } + request["Ciphers"] = d.Get("ciphers") + request["RegionId"] = client.RegionId + request["Name"] = d.Get("tls_cipher_policy_name") + request["TLSVersions"] = d.Get("tls_versions") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_slb_tls_cipher_policy", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["TLSCipherPolicyId"])) + + return resourceAlicloudSlbTlsCipherPolicyRead(d, meta) +} +func resourceAlicloudSlbTlsCipherPolicyRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + slbService := SlbService{client} + object, err := slbService.DescribeSlbTlsCipherPolicy(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_slb_tls_cipher_policy slbService.DescribeSlbTlsCipherPolicy Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("ciphers", object["Ciphers"]) + d.Set("status", object["Status"]) + d.Set("tls_cipher_policy_name", object["Name"]) + d.Set("tls_versions", object["TLSVersions"]) + return nil +} +func resourceAlicloudSlbTlsCipherPolicyUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "TLSCipherPolicyId": d.Id(), + } + if d.HasChange("ciphers") { + update = true + } + request["Ciphers"] = d.Get("ciphers") + request["RegionId"] = client.RegionId + if d.HasChange("tls_cipher_policy_name") { + update = true + } + request["Name"] = d.Get("tls_cipher_policy_name") + if d.HasChange("tls_versions") { + update = true + } + request["TLSVersions"] = d.Get("tls_versions") + if update { + action := "SetTLSCipherPolicyAttribute" + conn, err := client.NewSlbClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudSlbTlsCipherPolicyRead(d, meta) +} +func resourceAlicloudSlbTlsCipherPolicyDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteTLSCipherPolicy" + var response map[string]interface{} + conn, err := client.NewSlbClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "TLSCipherPolicyId": d.Id(), + } + + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_snat_entry.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_snat_entry.go index c73698bbcf2..eb9289d8de7 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_snat_entry.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_snat_entry.go @@ -139,11 +139,8 @@ func resourceAlicloudSnatEntryRead(d *schema.ResourceData, meta interface{}) err d.Set("snat_table_id", parts[0]) d.Set("snat_entry_name", object["SnatEntryName"]) d.Set("snat_ip", object["SnatIp"]) - if _, ok := d.GetOk("source_cidr"); ok { - d.Set("source_cidr", object["SourceCIDR"]) - } else { - d.Set("source_vswitch_id", object["SourceVSwitchId"]) - } + d.Set("source_cidr", object["SourceCIDR"]) + d.Set("source_vswitch_id", object["SourceVSwitchId"]) d.Set("status", object["Status"]) return nil } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_video_surveillance_system_group.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_video_surveillance_system_group.go new file mode 100644 index 00000000000..15ff2c9d528 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_video_surveillance_system_group.go @@ -0,0 +1,254 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudVideoSurveillanceSystemGroup() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudVideoSurveillanceSystemGroupCreate, + Read: resourceAlicloudVideoSurveillanceSystemGroupRead, + Update: resourceAlicloudVideoSurveillanceSystemGroupUpdate, + Delete: resourceAlicloudVideoSurveillanceSystemGroupDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "group_name": { + Type: schema.TypeString, + Required: true, + }, + "in_protocol": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"gb28181", "rtmp"}, false), + }, + "out_protocol": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"flv", "rtmp", "hls"}, false), + }, + "play_domain": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "push_domain": { + Type: schema.TypeString, + Required: true, + }, + "callback": { + Type: schema.TypeString, + Optional: true, + }, + "enabled": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Optional: true, + }, + "capture_image": { + Type: schema.TypeInt, + Computed: true, + }, + "capture_interval": { + Type: schema.TypeInt, + Computed: true, + }, + "capture_oss_bucket": { + Type: schema.TypeString, + Computed: true, + }, + "capture_oss_path": { + Type: schema.TypeString, + Computed: true, + }, + "capture_video": { + Type: schema.TypeInt, + Computed: true, + }, + "lazy_pull": { + Type: schema.TypeBool, + Computed: true, + }, + "status": { + Type: schema.TypeBool, + Computed: true, + }, + }, + } +} + +func resourceAlicloudVideoSurveillanceSystemGroupCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateGroup" + request := make(map[string]interface{}) + conn, err := client.NewVsClient() + if err != nil { + return WrapError(err) + } + request["Region"] = client.RegionId + request["InProtocol"] = d.Get("in_protocol") + request["OutProtocol"] = d.Get("out_protocol") + request["PlayDomain"] = d.Get("play_domain") + request["PushDomain"] = d.Get("push_domain") + request["Name"] = d.Get("group_name") + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-12-12"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_video_surveillance_system_group", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["Id"])) + + return resourceAlicloudVideoSurveillanceSystemGroupUpdate(d, meta) +} +func resourceAlicloudVideoSurveillanceSystemGroupRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vsService := VsService{client} + object, err := vsService.DescribeVideoSurveillanceSystemGroup(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_video_surveillance_system_group vsService.DescribeVideoSurveillanceSystemGroup Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("callback", object["Callback"]) + d.Set("description", object["Description"]) + d.Set("enabled", object["Enabled"]) + d.Set("group_name", object["Name"]) + d.Set("lazy_pull", object["LazyPull"]) + d.Set("in_protocol", object["InProtocol"]) + d.Set("out_protocol", object["OutProtocol"]) + d.Set("play_domain", object["PlayDomain"]) + d.Set("push_domain", object["PushDomain"]) + d.Set("capture_oss_bucket", object["CaptureOssBucket"]) + d.Set("capture_oss_path", object["CaptureOssPath"]) + d.Set("capture_video", object["CaptureVideo"]) + d.Set("capture_image", object["CaptureImage"]) + d.Set("capture_interval", object["CaptureInterval"]) + return nil +} +func resourceAlicloudVideoSurveillanceSystemGroupUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "Id": d.Id(), + } + if d.HasChange("callback") { + update = true + if v, ok := d.GetOk("callback"); ok { + request["Callback"] = v + } + } + if d.HasChange("description") { + update = true + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + } + if d.HasChange("enabled") || d.IsNewResource() { + update = true + if v, ok := d.GetOkExists("enabled"); ok { + request["Enabled"] = v + } + } + if d.HasChange("group_name") { + update = true + if v, ok := d.GetOk("group_name"); ok { + request["Name"] = v + } + } + if d.HasChange("in_protocol") { + update = true + if v, ok := d.GetOk("in_protocol"); ok { + request["InProtocol"] = v + } + } + if d.HasChange("out_protocol") { + update = true + if v, ok := d.GetOk("out_protocol"); ok { + request["OutProtocol"] = v + } + } + if update { + action := "ModifyGroup" + conn, err := client.NewVsClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-12-12"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"2001"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudVideoSurveillanceSystemGroupRead(d, meta) +} +func resourceAlicloudVideoSurveillanceSystemGroupDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + conn, err := client.NewVsClient() + action := "DeleteGroup" + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "Id": d.Id(), + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-12-12"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vod_domain.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vod_domain.go new file mode 100644 index 00000000000..c1e4cd3105d --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vod_domain.go @@ -0,0 +1,316 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudVodDomain() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudVodDomainCreate, + Read: resourceAlicloudVodDomainRead, + Update: resourceAlicloudVodDomainUpdate, + Delete: resourceAlicloudVodDomainDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "domain_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "sources": { + Type: schema.TypeSet, + Required: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "source_content": { + Type: schema.TypeString, + Required: true, + }, + "source_port": { + Type: schema.TypeString, + Required: true, + }, + "source_priority": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"20", "30"}, false), + }, + "source_type": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"ipaddr", "domain", "oss"}, false), + }, + }, + }, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "gmt_modified": { + Type: schema.TypeString, + Computed: true, + }, + "gmt_created": { + Type: schema.TypeString, + Computed: true, + }, + "cname": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "weight": { + Type: schema.TypeString, + Computed: true, + }, + "ssl_pub": { + Type: schema.TypeString, + Computed: true, + }, + "ssl_protocol": { + Type: schema.TypeString, + Computed: true, + }, + "cert_name": { + Type: schema.TypeString, + Computed: true, + }, + "scope": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"domestic", "overseas", "global"}, false), + Default: "domestic", + }, + "top_level_domain": { + Type: schema.TypeString, + Optional: true, + }, + "check_url": { + Type: schema.TypeString, + Optional: true, + }, + "tags": tagsSchema(), + }, + } +} + +func resourceAlicloudVodDomainCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "AddVodDomain" + request := make(map[string]interface{}) + conn, err := client.NewVodClient() + if err != nil { + return WrapError(err) + } + request["DomainName"] = d.Get("domain_name") + if v, ok := d.GetOk("check_url"); ok { + request["CheckUrl"] = v + } + + if v, ok := d.GetOk("scope"); ok { + request["Scope"] = v + } + if v, ok := d.GetOk("top_level_domain"); ok { + request["TopLevelDomain"] = v + } + sourcesMaps := make([]map[string]interface{}, 0) + for _, sources := range d.Get("sources").(*schema.Set).List() { + sourcesArg := sources.(map[string]interface{}) + sourcesMap := map[string]interface{}{} + sourcesMap["content"] = sourcesArg["source_content"] + sourcesMap["priority"] = sourcesArg["source_priority"] + sourcesMap["type"] = sourcesArg["source_type"] + sourcesMap["port"] = sourcesArg["source_port"] + sourcesMaps = append(sourcesMaps, sourcesMap) + } + if v, err := convertArrayObjectToJsonString(sourcesMaps); err == nil { + request["Sources"] = v + } else { + return WrapError(err) + } + if v, ok := d.GetOk("top_level_domain"); ok { + request["TopLevelDomain"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-03-21"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_vod_domain", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["DomainName"])) + + return resourceAlicloudVodDomainUpdate(d, meta) +} +func resourceAlicloudVodDomainRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vodService := VodService{client} + object, err := vodService.DescribeVodDomain(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_vod_domain vodService.DescribeVodDomain Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + + d.Set("domain_name", d.Id()) + d.Set("scope", object["Scope"]) + d.Set("status", object["DomainStatus"]) + d.Set("gmt_modified", object["GmtModified"]) + d.Set("gmt_created", object["GmtCreated"]) + d.Set("weight", object["Weight"]) + d.Set("ssl_pub", object["SSLPub"]) + d.Set("ssl_protocol", object["SSLProtocol"]) + d.Set("cert_name", object["CertName"]) + d.Set("cname", object["Cname"]) + if v, ok := object["Sources"].(map[string]interface{})["Source"].([]interface{}); ok { + source := make([]map[string]interface{}, 0) + for _, val := range v { + item := val.(map[string]interface{}) + temp := map[string]interface{}{ + "source_content": item["Content"], + "source_port": item["Port"], + "source_priority": item["Priority"], + "source_type": item["Type"], + } + + source = append(source, temp) + } + if err := d.Set("sources", source); err != nil { + return WrapError(err) + } + } + return nil +} +func resourceAlicloudVodDomainUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vodService := VodService{client} + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "DomainName": d.Id(), + } + if d.HasChange("sources") { + update = true + sourcesMaps := make([]map[string]interface{}, 0) + for _, sources := range d.Get("sources").(*schema.Set).List() { + sourcesArg := sources.(map[string]interface{}) + sourcesMap := map[string]interface{}{} + sourcesMap["content"] = sourcesArg["source_content"] + sourcesMap["priority"] = sourcesArg["source_priority"] + sourcesMap["type"] = sourcesArg["source_type"] + sourcesMap["port"] = sourcesArg["source_port"] + sourcesMaps = append(sourcesMaps, sourcesMap) + } + if v, err := convertArrayObjectToJsonString(sourcesMaps); err == nil { + request["Sources"] = v + } else { + return WrapError(err) + } + } + if d.HasChange("top_level_domain") { + update = true + if v, ok := d.GetOk("top_level_domain"); ok { + request["TopLevelDomain"] = v + } + } + if update { + action := "UpdateVodDomain" + conn, err := client.NewVodClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-03-21"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"3", "2001"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + + if err := vodService.SetResourceTags(d, "DOMAIN"); err != nil { + return WrapError(err) + } + stateConf := BuildStateConf([]string{"configuring"}, []string{"online"}, d.Timeout(schema.TimeoutDelete), 5*time.Second, vodService.VodStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudVodDomainRead(d, meta) +} +func resourceAlicloudVodDomainDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vodService := VodService{client} + action := "DeleteVodDomain" + var response map[string]interface{} + conn, err := client.NewVodClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "DomainName": d.Id(), + } + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-03-21"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"2001"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + + stateConf := BuildStateConf([]string{"deleting"}, []string{}, d.Timeout(schema.TimeoutDelete), 5*time.Second, vodService.VodStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc.go index 47391be2b0a..839ecde1e2f 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc.go @@ -208,6 +208,7 @@ func resourceAlicloudVpcRead(d *schema.ResourceData, meta interface{}) error { if err != nil { return WrapError(err) } + d.Set("resource_group_id", describeRouteTableListObject["ResourceGroupId"]) d.Set("route_table_id", describeRouteTableListObject["RouteTableId"]) d.Set("router_table_id", describeRouteTableListObject["RouteTableId"]) return nil @@ -217,7 +218,11 @@ func resourceAlicloudVpcUpdate(d *schema.ResourceData, meta interface{}) error { vpcService := VpcService{client} var response map[string]interface{} d.Partial(true) - if err := vpcService.setInstanceSecondaryCidrBlocks(d); err != nil { + if err := vpcService.SetInstanceSecondaryCidrBlocks(d); err != nil { + return WrapError(err) + } + conn, err := client.NewVpcClient() + if err != nil { return WrapError(err) } @@ -239,10 +244,6 @@ func resourceAlicloudVpcUpdate(d *schema.ResourceData, meta interface{}) error { moveResourceGroupReq["ResourceType"] = "vpc" if update { action := "MoveResourceGroup" - conn, err := client.NewVpcClient() - if err != nil { - return WrapError(err) - } wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, moveResourceGroupReq, &util.RuntimeOptions{}) @@ -288,10 +289,6 @@ func resourceAlicloudVpcUpdate(d *schema.ResourceData, meta interface{}) error { modifyVpcAttributeReq["EnableIPv6"] = d.Get("enable_ipv6") } action := "ModifyVpcAttribute" - conn, err := client.NewVpcClient() - if err != nil { - return WrapError(err) - } wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, modifyVpcAttributeReq, &util.RuntimeOptions{}) diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_bgp_group.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_bgp_group.go new file mode 100644 index 00000000000..711f3f07b1d --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_bgp_group.go @@ -0,0 +1,261 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudVpcBgpGroup() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudVpcBgpGroupCreate, + Read: resourceAlicloudVpcBgpGroupRead, + Update: resourceAlicloudVpcBgpGroupUpdate, + Delete: resourceAlicloudVpcBgpGroupDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(5 * time.Minute), + Delete: schema.DefaultTimeout(5 * time.Minute), + Update: schema.DefaultTimeout(5 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "auth_key": { + Type: schema.TypeString, + Optional: true, + }, + "bgp_group_name": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.All(validation.StringMatch(regexp.MustCompile(`^[a-zA-Z][A-Za-z0-9._-]{1,127}$`), "The name must be `2` to `128` characters in length and can contain digits, periods (.), underscores (_), and hyphens (-)."), validation.StringDoesNotMatch(regexp.MustCompile(`(^http://.*)|(^https://.*)`), "It cannot begin with \"http://\", \"https://\".")), + }, + "description": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.All(validation.StringLenBetween(2, 256), validation.StringDoesNotMatch(regexp.MustCompile(`(^http://.*)|(^https://.*)`), "It cannot begin with \"http://\", \"https://\".")), + }, + "is_fake_asn": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "local_asn": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + }, + "peer_asn": { + Type: schema.TypeInt, + Required: true, + }, + "router_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudVpcBgpGroupCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateBgpGroup" + request := make(map[string]interface{}) + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("auth_key"); ok { + request["AuthKey"] = v + } + if v, ok := d.GetOk("bgp_group_name"); ok { + request["Name"] = v + } + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + if v, ok := d.GetOkExists("is_fake_asn"); ok { + request["IsFakeAsn"] = v + } + if v, ok := d.GetOk("local_asn"); ok { + request["LocalAsn"] = v + } + request["PeerAsn"] = d.Get("peer_asn") + request["RegionId"] = client.RegionId + request["RouterId"] = d.Get("router_id") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("CreateBgpGroup") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_vpc_bgp_group", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["BgpGroupId"])) + vpcService := VpcService{client} + stateConf := BuildStateConf([]string{}, []string{"Available"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, vpcService.VpcBgpGroupStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudVpcBgpGroupRead(d, meta) +} +func resourceAlicloudVpcBgpGroupRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vpcService := VpcService{client} + object, err := vpcService.DescribeVpcBgpGroup(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_vpc_bgp_group vpcService.DescribeVpcBgpGroup Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("auth_key", object["AuthKey"]) + d.Set("bgp_group_name", object["Name"]) + d.Set("description", object["Description"]) + d.Set("local_asn", formatInt(object["LocalAsn"])) + d.Set("peer_asn", formatInt(object["PeerAsn"])) + d.Set("router_id", object["RouterId"]) + d.Set("is_fake_asn", object["IsFake"]) + d.Set("status", object["Status"]) + return nil +} +func resourceAlicloudVpcBgpGroupUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vpcService := VpcService{client} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "BgpGroupId": d.Id(), + } + request["RegionId"] = client.RegionId + if d.HasChange("auth_key") { + update = true + if v, ok := d.GetOk("auth_key"); ok { + request["AuthKey"] = v + } + } + if d.HasChange("bgp_group_name") { + update = true + if v, ok := d.GetOk("bgp_group_name"); ok { + request["Name"] = v + } + } + if d.HasChange("description") { + update = true + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + } + if d.HasChange("local_asn") { + update = true + if v, ok := d.GetOk("local_asn"); ok { + request["LocalAsn"] = v + } + } + if d.HasChange("peer_asn") { + update = true + request["PeerAsn"] = d.Get("peer_asn") + } + if update { + if v, ok := d.GetOkExists("is_fake_asn"); ok { + request["IsFakeAsn"] = v + } + action := "ModifyBgpGroupAttribute" + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("ModifyBgpGroupAttribute") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Available"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, vpcService.VpcBgpGroupStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + return resourceAlicloudVpcBgpGroupRead(d, meta) +} +func resourceAlicloudVpcBgpGroupDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vpcService := VpcService{client} + action := "DeleteBgpGroup" + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "BgpGroupId": d.Id(), + } + + request["RegionId"] = client.RegionId + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("DeleteBgpGroup") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{}, d.Timeout(schema.TimeoutDelete), 5*time.Second, vpcService.VpcBgpGroupStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_bgp_network.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_bgp_network.go new file mode 100644 index 00000000000..e66343207f6 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_bgp_network.go @@ -0,0 +1,146 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudVpcBgpNetwork() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudVpcBgpNetworkCreate, + Read: resourceAlicloudVpcBgpNetworkRead, + Delete: resourceAlicloudVpcBgpNetworkDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(1 * time.Minute), + Delete: schema.DefaultTimeout(1 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "dst_cidr_block": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "router_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudVpcBgpNetworkCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "AddBgpNetwork" + request := make(map[string]interface{}) + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + request["DstCidrBlock"] = d.Get("dst_cidr_block") + request["RegionId"] = client.RegionId + request["RouterId"] = d.Get("router_id") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("AddBgpNetwork") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_vpc_bgp_network", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["RouterId"], ":", request["DstCidrBlock"])) + vpcService := VpcService{client} + stateConf := BuildStateConf([]string{}, []string{"Available"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, vpcService.VpcBgpNetworkStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudVpcBgpNetworkRead(d, meta) +} +func resourceAlicloudVpcBgpNetworkRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vpcService := VpcService{client} + object, err := vpcService.DescribeVpcBgpNetwork(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_vpc_bgp_network vpcService.DescribeVpcBgpNetwork Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("dst_cidr_block", object["DstCidrBlock"]) + d.Set("router_id", object["RouterId"]) + d.Set("status", object["Status"]) + return nil +} +func resourceAlicloudVpcBgpNetworkDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + vpcService := VpcService{client} + action := "DeleteBgpNetwork" + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "DstCidrBlock": parts[1], + "RouterId": parts[0], + } + + request["RegionId"] = client.RegionId + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("DeleteBgpNetwork") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{}, d.Timeout(schema.TimeoutDelete), 5*time.Second, vpcService.VpcBgpNetworkStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_bgp_peer.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_bgp_peer.go new file mode 100644 index 00000000000..3d0ceee4e00 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_bgp_peer.go @@ -0,0 +1,239 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudVpcBgpPeer() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudVpcBgpPeerCreate, + Read: resourceAlicloudVpcBgpPeerRead, + Update: resourceAlicloudVpcBgpPeerUpdate, + Delete: resourceAlicloudVpcBgpPeerDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(5 * time.Minute), + Delete: schema.DefaultTimeout(5 * time.Minute), + Update: schema.DefaultTimeout(5 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "bfd_multi_hop": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validation.IntBetween(1, 255), + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("enable_bfd"); ok && fmt.Sprint(v) == "true" { + return false + } + return true + }, + }, + "bgp_group_id": { + Type: schema.TypeString, + ForceNew: true, + Required: true, + }, + "enable_bfd": { + Type: schema.TypeBool, + Optional: true, + }, + "ip_version": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + }, + "peer_ip_address": { + Type: schema.TypeString, + Optional: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudVpcBgpPeerCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateBgpPeer" + request := make(map[string]interface{}) + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("bfd_multi_hop"); ok { + request["BfdMultiHop"] = v + } + request["BgpGroupId"] = d.Get("bgp_group_id") + if v, ok := d.GetOkExists("enable_bfd"); ok { + request["EnableBfd"] = v + } + if v, ok := d.GetOk("ip_version"); ok { + request["IpVersion"] = v + } + if v, ok := d.GetOk("peer_ip_address"); ok { + request["PeerIpAddress"] = v + } + request["RegionId"] = client.RegionId + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("CreateBgpPeer") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_vpc_bgp_peer", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["BgpPeerId"])) + vpcService := VpcService{client} + stateConf := BuildStateConf([]string{}, []string{"Available"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, vpcService.VpcBgpPeerStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudVpcBgpPeerRead(d, meta) +} +func resourceAlicloudVpcBgpPeerRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vpcService := VpcService{client} + object, err := vpcService.DescribeVpcBgpPeer(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_vpc_bgp_peer vpcService.DescribeVpcBgpPeer Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + if v, ok := object["BfdMultiHop"]; ok && fmt.Sprint(v) != "0" { + d.Set("bfd_multi_hop", formatInt(v)) + } + d.Set("bgp_group_id", object["BgpGroupId"]) + d.Set("enable_bfd", object["EnableBfd"]) + d.Set("ip_version", object["IpVersion"]) + d.Set("peer_ip_address", object["PeerIpAddress"]) + d.Set("status", object["Status"]) + return nil +} +func resourceAlicloudVpcBgpPeerUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vpcService := VpcService{client} + var response map[string]interface{} + update := false + request := map[string]interface{}{ + "BgpPeerId": d.Id(), + } + request["RegionId"] = client.RegionId + if d.HasChange("bfd_multi_hop") { + update = true + if v, ok := d.GetOk("bfd_multi_hop"); ok { + request["BfdMultiHop"] = v + } + } + if d.HasChange("enable_bfd") { + update = true + if v, ok := d.GetOkExists("enable_bfd"); ok { + request["EnableBfd"] = v + } + } + if d.HasChange("peer_ip_address") { + update = true + if v, ok := d.GetOk("peer_ip_address"); ok { + request["PeerIpAddress"] = v + } + } + if update { + action := "ModifyBgpPeerAttribute" + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("ModifyBgpPeerAttribute") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Available"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, vpcService.VpcBgpPeerStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + return resourceAlicloudVpcBgpPeerRead(d, meta) +} +func resourceAlicloudVpcBgpPeerDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vpcService := VpcService{client} + action := "DeleteBgpPeer" + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "BgpPeerId": d.Id(), + } + + request["RegionId"] = client.RegionId + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("DeleteBgpPeer") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{}, d.Timeout(schema.TimeoutDelete), 5*time.Second, vpcService.VpcBgpPeerStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_dhcp_options_set.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_dhcp_options_set.go new file mode 100644 index 00000000000..b46066ebda0 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_dhcp_options_set.go @@ -0,0 +1,365 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudVpcDhcpOptionsSet() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudVpcDhcpOptionsSetCreate, + Read: resourceAlicloudVpcDhcpOptionsSetRead, + Update: resourceAlicloudVpcDhcpOptionsSetUpdate, + Delete: resourceAlicloudVpcDhcpOptionsSetDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(2 * time.Minute), + Delete: schema.DefaultTimeout(1 * time.Minute), + Update: schema.DefaultTimeout(2 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "associate_vpcs": { + Type: schema.TypeSet, + Optional: true, + Deprecated: "Field 'associate_vpcs' has been deprecated from provider version 1.153.0 and it will be removed in the future version. Please use the new resource 'alicloud_vpc_dhcp_options_set_attachment' to attach DhcpOptionsSet and Vpc.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "vpc_id": { + Type: schema.TypeString, + Optional: true, + }, + "associate_status": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "dhcp_options_set_description": { + Type: schema.TypeString, + Optional: true, + }, + "dhcp_options_set_name": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile("^[a-zA-Z\u4E00-\u9FA5][\u4E00-\u9FA5A-Za-z0-9_-]{2,128}$"), "The name must be 2 to 128 characters in length and can contain letters, Chinese characters, digits, underscores (_), and hyphens (-). It must start with a letter or a Chinese character."), + }, + "domain_name": { + Type: schema.TypeString, + Optional: true, + }, + "domain_name_servers": { + Type: schema.TypeString, + Optional: true, + }, + "dry_run": { + Type: schema.TypeBool, + Optional: true, + }, + "owner_id": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudVpcDhcpOptionsSetCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateDhcpOptionsSet" + request := make(map[string]interface{}) + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("dhcp_options_set_description"); ok { + request["DhcpOptionsSetDescription"] = v + } + if v, ok := d.GetOk("dhcp_options_set_name"); ok { + request["DhcpOptionsSetName"] = v + } + if v, ok := d.GetOk("domain_name"); ok { + request["DomainName"] = v + } + if v, ok := d.GetOk("domain_name_servers"); ok { + request["DomainNameServers"] = v + } + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + request["RegionId"] = client.RegionId + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("CreateDhcpOptionsSet") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_vpc_dhcp_options_set", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["DhcpOptionsSetId"])) + vpcService := VpcService{client} + stateConf := BuildStateConf([]string{}, []string{"Available"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, vpcService.VpcDhcpOptionsSetStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudVpcDhcpOptionsSetUpdate(d, meta) +} +func resourceAlicloudVpcDhcpOptionsSetRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vpcService := VpcService{client} + object, err := vpcService.DescribeVpcDhcpOptionsSet(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_vpc_dhcp_options_set vpcService.DescribeVpcDhcpOptionsSet Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + if associateVpcsList, ok := object["AssociateVpcs"]; ok && associateVpcsList != nil { + associateVpcsMaps := make([]map[string]interface{}, 0) + for _, associateVpcsListItem := range associateVpcsList.([]interface{}) { + if associateVpcsListItemMap, ok := associateVpcsListItem.(map[string]interface{}); ok { + associateVpcsListItemMap["associate_status"] = associateVpcsListItemMap["AssociateStatus"] + associateVpcsListItemMap["vpc_id"] = associateVpcsListItemMap["VpcId"] + associateVpcsMaps = append(associateVpcsMaps, associateVpcsListItemMap) + } + } + d.Set("associate_vpcs", associateVpcsMaps) + } + + d.Set("dhcp_options_set_description", object["DhcpOptionsSetDescription"]) + d.Set("dhcp_options_set_name", object["DhcpOptionsSetName"]) + d.Set("domain_name", object["DhcpOptions"].(map[string]interface{})["DomainName"]) + d.Set("domain_name_servers", object["DhcpOptions"].(map[string]interface{})["DomainNameServers"]) + d.Set("owner_id", fmt.Sprint(formatInt(object["OwnerId"]))) + d.Set("status", object["Status"]) + return nil +} +func resourceAlicloudVpcDhcpOptionsSetUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vpcService := VpcService{client} + var response map[string]interface{} + d.Partial(true) + + update := false + request := map[string]interface{}{ + "DhcpOptionsSetId": d.Id(), + } + request["RegionId"] = client.RegionId + if d.HasChange("dhcp_options_set_description") { + update = true + if v, ok := d.GetOk("dhcp_options_set_description"); ok { + request["DhcpOptionsSetDescription"] = v + } + } + if d.HasChange("dhcp_options_set_name") { + update = true + if v, ok := d.GetOk("dhcp_options_set_name"); ok { + request["DhcpOptionsSetName"] = v + } + } + if d.HasChange("domain_name") { + update = true + if v, ok := d.GetOk("domain_name"); ok { + request["DomainName"] = v + } + } + if d.HasChange("domain_name_servers") { + update = true + if v, ok := d.GetOk("domain_name_servers"); ok { + request["DomainNameServers"] = v + } + } + if update { + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + action := "UpdateDhcpOptionsSetAttribute" + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("UpdateDhcpOptionsSetAttribute") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Available"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, vpcService.VpcDhcpOptionsSetStateRefreshFunc(d.Id(), []string{"InUse"})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + d.SetPartial("dhcp_options_set_description") + d.SetPartial("dhcp_options_set_name") + d.SetPartial("domain_name") + d.SetPartial("domain_name_servers") + } + d.Partial(false) + if d.HasChange("associate_vpcs") { + oldAssociateVpcs, newAssociateVpcs := d.GetChange("associate_vpcs") + oldAssociateVpcsSet := oldAssociateVpcs.(*schema.Set) + newAssociateVpcsSet := newAssociateVpcs.(*schema.Set) + removed := oldAssociateVpcsSet.Difference(newAssociateVpcsSet) + added := newAssociateVpcsSet.Difference(oldAssociateVpcsSet) + if removed.Len() > 0 { + action := "DetachDhcpOptionsSetFromVpc" + detachVpcDhcpOptionsSetRequest := map[string]interface{}{ + "DhcpOptionsSetId": d.Id(), + } + detachVpcDhcpOptionsSetRequest["RegionId"] = client.RegionId + if _, ok := d.GetOkExists("dry_run"); ok { + detachVpcDhcpOptionsSetRequest["DryRun"] = d.Get("dry_run") + } + for _, associateVpcs := range removed.List() { + associateVpc := associateVpcs.(map[string]interface{}) + detachVpcDhcpOptionsSetRequest["VpcId"] = associateVpc["vpc_id"].(string) + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("DetachDhcpOptionsSetFromVpc") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, detachVpcDhcpOptionsSetRequest, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, detachVpcDhcpOptionsSetRequest) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + d.SetPartial("associate_vpcs") + } + if added.Len() > 0 { + action := "AttachDhcpOptionsSetToVpc" + attachVpcDhcpOptionsSetRequest := map[string]interface{}{ + "DhcpOptionsSetId": d.Id(), + } + attachVpcDhcpOptionsSetRequest["RegionId"] = client.RegionId + if _, ok := d.GetOkExists("dry_run"); ok { + attachVpcDhcpOptionsSetRequest["DryRun"] = d.Get("dry_run") + } + for _, associateVpcs := range added.List() { + associateVpc := associateVpcs.(map[string]interface{}) + attachVpcDhcpOptionsSetRequest["VpcId"] = associateVpc["vpc_id"].(string) + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("AttachDhcpOptionsSetToVpc") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, attachVpcDhcpOptionsSetRequest, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, attachVpcDhcpOptionsSetRequest) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + d.SetPartial("associate_vpcs") + } + } + return resourceAlicloudVpcDhcpOptionsSetRead(d, meta) +} +func resourceAlicloudVpcDhcpOptionsSetDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteDhcpOptionsSet" + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "DhcpOptionsSetId": d.Id(), + } + + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + request["RegionId"] = client.RegionId + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 10*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("DeleteDhcpOptionsSet") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if IsExpectedErrors(err, []string{"IncorrectStatus.DhcpOptionsSet"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidDhcpOptionsSetId.NotFound"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_dhcp_options_set_attachment.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_dhcp_options_set_attachment.go new file mode 100644 index 00000000000..b5b4e66d036 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_dhcp_options_set_attachment.go @@ -0,0 +1,180 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudVpcDhcpOptionsSetAttachement() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudVpcDhcpOptionsAttachmentCreate, + Read: resourceAlicloudVpcDhcpOptionsSetAttachmentRead, + Update: resourceAlicloudVpcDhcpOptionsSetAttachmentUpdate, + Delete: resourceAlicloudVpcDhcpOptionsSetAttachmentDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(2 * time.Minute), + Delete: schema.DefaultTimeout(1 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "dhcp_options_set_id": { + Type: schema.TypeString, + ForceNew: true, + Required: true, + }, + "vpc_id": { + Type: schema.TypeString, + ForceNew: true, + Required: true, + }, + "dry_run": { + Type: schema.TypeBool, + Optional: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudVpcDhcpOptionsAttachmentCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "AttachDhcpOptionsSetToVpc" + request := make(map[string]interface{}) + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + + request["RegionId"] = client.RegionId + request["DhcpOptionsSetId"] = d.Get("dhcp_options_set_id") + request["VpcId"] = d.Get("vpc_id") + request["ClientToken"] = buildClientToken(action) + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_vpc_dhcp_options_set_attachment", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["VpcId"], ":", request["DhcpOptionsSetId"])) + + vpcService := VpcService{client} + stateConf := BuildStateConf([]string{"Pending"}, []string{"InUse"}, d.Timeout(schema.TimeoutCreate), 3*time.Second, vpcService.DescribeVpcDhcpOptionsSetAttachmentStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return resourceAlicloudVpcDhcpOptionsSetAttachmentRead(d, meta) +} +func resourceAlicloudVpcDhcpOptionsSetAttachmentRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vpcService := VpcService{client} + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + object, err := vpcService.DescribeVpcDhcpOptionsSetAttachment(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_vpc_dhcp_options_set_attachment vpcService.DescribeVpcDhcpOptionsSetAttachment Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + if associateVpcsList, ok := object["AssociateVpcs"]; ok { + for _, associateVpcsListItem := range associateVpcsList.([]interface{}) { + if associateVpcsListItem != nil { + associateVpcsListItemMap, ok := associateVpcsListItem.(map[string]interface{}) + if ok && associateVpcsListItemMap["VpcId"] == parts[0] { + d.Set("vpc_id", associateVpcsListItemMap["VpcId"]) + d.Set("dhcp_options_set_id", parts[1]) + d.Set("status", associateVpcsListItemMap["AssociateStatus"]) + break + } + } + } + } + return nil +} +func resourceAlicloudVpcDhcpOptionsSetAttachmentUpdate(d *schema.ResourceData, meta interface{}) error { + log.Println(fmt.Sprintf("[WARNING] The resouce has not update operation.")) + return resourceAlicloudVpcDhcpOptionsSetAttachmentRead(d, meta) +} +func resourceAlicloudVpcDhcpOptionsSetAttachmentDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DetachDhcpOptionsSetFromVpc" + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "DhcpOptionsSetId": parts[1], + } + request["RegionId"] = client.RegionId + request["VpcId"] = d.Get("vpc_id") + request["ClientToken"] = buildClientToken(action) + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 10*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if IsExpectedErrors(err, []string{"IncorrectStatus.DhcpOptionsSet"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidDhcpOptionsSetId.NotFound"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + vpcService := VpcService{client} + stateConf := BuildStateConf([]string{}, []string{}, d.Timeout(schema.TimeoutCreate), 5*time.Second, vpcService.VpcDhcpOptionsSetStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_flow_log.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_flow_log.go index bc4ea02491d..9ed577ff75f 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_flow_log.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_flow_log.go @@ -146,6 +146,10 @@ func resourceAlicloudVpcFlowLogRead(d *schema.ResourceData, meta interface{}) er func resourceAlicloudVpcFlowLogUpdate(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) vpcService := VpcService{client} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } var response map[string]interface{} d.Partial(true) @@ -164,10 +168,6 @@ func resourceAlicloudVpcFlowLogUpdate(d *schema.ResourceData, meta interface{}) } if update { action := "ModifyFlowLogAttribute" - conn, err := client.NewVpcClient() - if err != nil { - return WrapError(err) - } wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) @@ -200,10 +200,6 @@ func resourceAlicloudVpcFlowLogUpdate(d *schema.ResourceData, meta interface{}) } request["RegionId"] = client.RegionId action := "ActiveFlowLog" - conn, err := client.NewVpcClient() - if err != nil { - return WrapError(err) - } wait := incrementalWait(3*time.Second, 5*time.Second) err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) @@ -231,10 +227,6 @@ func resourceAlicloudVpcFlowLogUpdate(d *schema.ResourceData, meta interface{}) } request["RegionId"] = client.RegionId action := "DeactiveFlowLog" - conn, err := client.NewVpcClient() - if err != nil { - return WrapError(err) - } wait := incrementalWait(3*time.Second, 5*time.Second) err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_ipv6_egress_rule.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_ipv6_egress_rule.go new file mode 100644 index 00000000000..5c007faf680 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_ipv6_egress_rule.go @@ -0,0 +1,182 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudVpcIpv6EgressRule() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudVpcIpv6EgressRuleCreate, + Read: resourceAlicloudVpcIpv6EgressRuleRead, + Delete: resourceAlicloudVpcIpv6EgressRuleDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(1 * time.Minute), + Delete: schema.DefaultTimeout(1 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "description": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(2, 256), + }, + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "instance_type": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Ipv6Address"}, false), + }, + "ipv6_egress_rule_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile("^[a-zA-Z\u4E00-\u9FA5][\u4E00-\u9FA5A-Za-z0-9_-]{2,128}$"), "The name must be `2` to `128` characters in length, and can contain letters, digits, underscores (_), and hyphens (-). The name must start with a letter but cannot start with `http://` or `https://`."), + }, + "ipv6_gateway_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudVpcIpv6EgressRuleCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateIpv6EgressOnlyRule" + request := make(map[string]interface{}) + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + request["InstanceId"] = d.Get("instance_id") + if v, ok := d.GetOk("instance_type"); ok { + request["InstanceType"] = v + } + if v, ok := d.GetOk("ipv6_egress_rule_name"); ok { + request["Name"] = v + } + request["Ipv6GatewayId"] = d.Get("ipv6_gateway_id") + request["RegionId"] = client.RegionId + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("CreateIpv6EgressOnlyRule") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_vpc_ipv6_egress_rule", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["Ipv6GatewayId"], ":", response["Ipv6EgressRuleId"])) + vpcService := VpcService{client} + stateConf := BuildStateConf([]string{}, []string{"Available"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, vpcService.VpcIpv6EgressRuleStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudVpcIpv6EgressRuleRead(d, meta) +} +func resourceAlicloudVpcIpv6EgressRuleRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vpcService := VpcService{client} + object, err := vpcService.DescribeVpcIpv6EgressRule(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_vpc_ipv6_egress_rule vpcService.DescribeVpcIpv6EgressRule Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Set("ipv6_gateway_id", parts[0]) + d.Set("description", object["Description"]) + d.Set("instance_id", object["InstanceId"]) + d.Set("instance_type", object["InstanceType"]) + d.Set("ipv6_egress_rule_name", object["Name"]) + d.Set("status", object["Status"]) + return nil +} +func resourceAlicloudVpcIpv6EgressRuleDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + vpcService := VpcService{client} + action := "DeleteIpv6EgressOnlyRule" + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "Ipv6EgressOnlyRuleId": parts[1], + } + + request["RegionId"] = client.RegionId + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("DeleteIpv6EgressOnlyRule") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{}, d.Timeout(schema.TimeoutDelete), 5*time.Second, vpcService.VpcIpv6EgressRuleStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_ipv6_gateway.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_ipv6_gateway.go new file mode 100644 index 00000000000..d51a50cba5d --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_ipv6_gateway.go @@ -0,0 +1,256 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudVpcIpv6Gateway() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudVpcIpv6GatewayCreate, + Read: resourceAlicloudVpcIpv6GatewayRead, + Update: resourceAlicloudVpcIpv6GatewayUpdate, + Delete: resourceAlicloudVpcIpv6GatewayDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(1 * time.Minute), + Update: schema.DefaultTimeout(1 * time.Minute), + Delete: schema.DefaultTimeout(5 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "description": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(2, 256), + }, + "ipv6_gateway_name": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile("^[a-zA-Z\u4E00-\u9FA5][\u4E00-\u9FA5A-Za-z0-9_-]{2,128}$"), "The name must be `2` to `128` characters in length, and can contain letters, digits, underscores (_), and hyphens (-). The name must start with a letter but cannot start with `http://` or `https://`."), + }, + "spec": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"Large", "Medium", "Small"}, false), + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "vpc_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudVpcIpv6GatewayCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateIpv6Gateway" + request := make(map[string]interface{}) + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + if v, ok := d.GetOk("ipv6_gateway_name"); ok { + request["Name"] = v + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("spec"); ok { + request["Spec"] = v + } + request["VpcId"] = d.Get("vpc_id") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("CreateIpv6Gateway") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_vpc_ipv6_gateway", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["Ipv6GatewayId"])) + vpcService := VpcService{client} + stateConf := BuildStateConf([]string{}, []string{"Available"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, vpcService.VpcIpv6GatewayStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudVpcIpv6GatewayRead(d, meta) +} +func resourceAlicloudVpcIpv6GatewayRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vpcService := VpcService{client} + object, err := vpcService.DescribeVpcIpv6Gateway(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_vpc_ipv6_gateway vpcService.DescribeVpcIpv6Gateway Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("description", object["Description"]) + d.Set("ipv6_gateway_name", object["Name"]) + d.Set("spec", object["Spec"]) + d.Set("status", object["Status"]) + d.Set("vpc_id", object["VpcId"]) + return nil +} +func resourceAlicloudVpcIpv6GatewayUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vpcService := VpcService{client} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + var response map[string]interface{} + d.Partial(true) + + update := false + request := map[string]interface{}{ + "Ipv6GatewayId": d.Id(), + } + request["RegionId"] = client.RegionId + if d.HasChange("spec") { + update = true + } + if v, ok := d.GetOk("spec"); ok { + request["Spec"] = v + } + if update { + action := "ModifyIpv6GatewaySpec" + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("ModifyIpv6GatewaySpec") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Available"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, vpcService.VpcIpv6GatewayStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + d.SetPartial("spec") + } + update = false + modifyIpv6GatewayAttributeReq := map[string]interface{}{ + "Ipv6GatewayId": d.Id(), + } + modifyIpv6GatewayAttributeReq["RegionId"] = client.RegionId + if d.HasChange("description") { + update = true + if v, ok := d.GetOk("description"); ok { + modifyIpv6GatewayAttributeReq["Description"] = v + } + } + if d.HasChange("ipv6_gateway_name") { + update = true + if v, ok := d.GetOk("ipv6_gateway_name"); ok { + modifyIpv6GatewayAttributeReq["Name"] = v + } + } + if update { + action := "ModifyIpv6GatewayAttribute" + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, modifyIpv6GatewayAttributeReq, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, modifyIpv6GatewayAttributeReq) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Available"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, vpcService.VpcIpv6GatewayStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + d.SetPartial("description") + d.SetPartial("ipv6_gateway_name") + } + d.Partial(false) + return resourceAlicloudVpcIpv6GatewayRead(d, meta) +} +func resourceAlicloudVpcIpv6GatewayDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vpcService := VpcService{client} + action := "DeleteIpv6Gateway" + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "Ipv6GatewayId": d.Id(), + } + + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{}, d.Timeout(schema.TimeoutDelete), 5*time.Second, vpcService.VpcIpv6GatewayStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_ipv6_internet_bandwidth.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_ipv6_internet_bandwidth.go new file mode 100644 index 00000000000..8442a3f1b8c --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_ipv6_internet_bandwidth.go @@ -0,0 +1,186 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudVpcIpv6InternetBandwidth() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudVpcIpv6InternetBandwidthCreate, + Read: resourceAlicloudVpcIpv6InternetBandwidthRead, + Update: resourceAlicloudVpcIpv6InternetBandwidthUpdate, + Delete: resourceAlicloudVpcIpv6InternetBandwidthDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "bandwidth": { + Type: schema.TypeInt, + Required: true, + ValidateFunc: validation.IntBetween(1, 5000), + }, + "internet_charge_type": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"PayByBandwidth", "PayByTraffic"}, false), + }, + "ipv6_address_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "ipv6_gateway_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudVpcIpv6InternetBandwidthCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "AllocateIpv6InternetBandwidth" + request := make(map[string]interface{}) + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + request["Bandwidth"] = d.Get("bandwidth") + if v, ok := d.GetOk("internet_charge_type"); ok { + request["InternetChargeType"] = v + } + request["Ipv6AddressId"] = d.Get("ipv6_address_id") + request["Ipv6GatewayId"] = d.Get("ipv6_gateway_id") + request["RegionId"] = client.RegionId + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("AllocateIpv6InternetBandwidth") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_vpc_ipv6_internet_bandwidth", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["InternetBandwidthId"])) + + return resourceAlicloudVpcIpv6InternetBandwidthRead(d, meta) +} +func resourceAlicloudVpcIpv6InternetBandwidthRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vpcService := VpcService{client} + object, err := vpcService.DescribeVpcIpv6InternetBandwidth(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_vpc_ipv6_internet_bandwidth vpcService.DescribeVpcIpv6InternetBandwidth Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + + d.Set("ipv6_address_id", object["Ipv6AddressId"]) + d.Set("ipv6_gateway_id", object["Ipv6GatewayId"]) + if ipv6InternetBandwidth, ok := object["Ipv6InternetBandwidth"]; ok { + if v, ok := ipv6InternetBandwidth.(map[string]interface{}); ok { + d.Set("bandwidth", formatInt(v["Bandwidth"])) + d.Set("internet_charge_type", v["InternetChargeType"]) + d.Set("status", v["BusinessStatus"]) + } + } + return nil +} +func resourceAlicloudVpcIpv6InternetBandwidthUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + request := map[string]interface{}{ + "Ipv6InternetBandwidthId": d.Id(), + } + if d.HasChange("bandwidth") { + request["Bandwidth"] = d.Get("bandwidth") + } + request["RegionId"] = client.RegionId + action := "ModifyIpv6InternetBandwidth" + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("ModifyIpv6InternetBandwidth") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return resourceAlicloudVpcIpv6InternetBandwidthRead(d, meta) +} +func resourceAlicloudVpcIpv6InternetBandwidthDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteIpv6InternetBandwidth" + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "Ipv6InternetBandwidthId": d.Id(), + } + + request["Ipv6AddressId"] = d.Get("ipv6_address_id") + request["RegionId"] = client.RegionId + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_nat_ip.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_nat_ip.go new file mode 100644 index 00000000000..56d26136c00 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_nat_ip.go @@ -0,0 +1,256 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudVpcNatIp() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudVpcNatIpCreate, + Read: resourceAlicloudVpcNatIpRead, + Update: resourceAlicloudVpcNatIpUpdate, + Delete: resourceAlicloudVpcNatIpDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(1 * time.Minute), + Delete: schema.DefaultTimeout(1 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "dry_run": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "nat_gateway_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "nat_ip": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "nat_ip_id": { + Type: schema.TypeString, + Computed: true, + }, + "nat_ip_cidr": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "nat_ip_cidr_id": { + Type: schema.TypeString, + Optional: true, + }, + "nat_ip_description": { + Type: schema.TypeString, + Optional: true, + }, + "nat_ip_name": { + Type: schema.TypeString, + Optional: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudVpcNatIpCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateNatIp" + request := make(map[string]interface{}) + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + request["NatGatewayId"] = d.Get("nat_gateway_id") + if v, ok := d.GetOk("nat_ip"); ok { + request["NatIp"] = v + } + if v, ok := d.GetOk("nat_ip_cidr"); ok { + request["NatIpCidr"] = v + } + if v, ok := d.GetOk("nat_ip_cidr_id"); ok { + request["NatIpCidrId"] = v + } + if v, ok := d.GetOk("nat_ip_description"); ok { + request["NatIpDescription"] = v + } + if v, ok := d.GetOk("nat_ip_name"); ok { + request["NatIpName"] = v + } + request["RegionId"] = client.RegionId + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("CreateNatIp") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_vpc_nat_ip", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["NatGatewayId"], ":", response["NatIpId"])) + vpcService := VpcService{client} + stateConf := BuildStateConf([]string{}, []string{"Available"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, vpcService.VpcNatIpStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudVpcNatIpRead(d, meta) +} +func resourceAlicloudVpcNatIpRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vpcService := VpcService{client} + + object, err := vpcService.DescribeVpcNatIp(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_vpc_nat_ip vpcService.DescribeVpcNatIp Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("nat_gateway_id", object["NatGatewayId"]) + d.Set("nat_ip", object["NatIp"]) + d.Set("nat_ip_id", object["NatIpId"]) + d.Set("nat_ip_cidr", object["NatIpCidr"]) + d.Set("nat_ip_description", object["NatIpDescription"]) + d.Set("nat_ip_name", object["NatIpName"]) + d.Set("status", object["NatIpStatus"]) + return nil +} +func resourceAlicloudVpcNatIpUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + update := false + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "RegionId": client.RegionId, + "NatIpId": parts[1], + } + if d.HasChange("nat_ip_description") { + update = true + } + if v, ok := d.GetOk("nat_ip_description"); ok { + request["NatIpDescription"] = v + } + if d.HasChange("nat_ip_name") { + update = true + } + if v, ok := d.GetOk("nat_ip_name"); ok { + request["NatIpName"] = v + } + request["RegionId"] = client.RegionId + if d.HasChange("dry_run") || d.IsNewResource() { + update = true + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + } + if update { + action := "ModifyNatIpAttribute" + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("ModifyNatIpAttribute") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudVpcNatIpRead(d, meta) +} +func resourceAlicloudVpcNatIpDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vpcService := VpcService{client} + action := "DeleteNatIp" + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "NatIpId": parts[1], + } + + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + request["RegionId"] = client.RegionId + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("DeleteNatIp") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{}, d.Timeout(schema.TimeoutDelete), 5*time.Second, vpcService.VpcNatIpStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_nat_ip_cidr.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_nat_ip_cidr.go new file mode 100644 index 00000000000..c5bb332ca07 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_nat_ip_cidr.go @@ -0,0 +1,225 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudVpcNatIpCidr() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudVpcNatIpCidrCreate, + Read: resourceAlicloudVpcNatIpCidrRead, + Update: resourceAlicloudVpcNatIpCidrUpdate, + Delete: resourceAlicloudVpcNatIpCidrDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "dry_run": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "nat_gateway_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "nat_ip_cidr": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "nat_ip_cidr_description": { + Type: schema.TypeString, + Optional: true, + }, + "nat_ip_cidr_name": { + Type: schema.TypeString, + Optional: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudVpcNatIpCidrCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateNatIpCidr" + request := make(map[string]interface{}) + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + request["NatGatewayId"] = d.Get("nat_gateway_id") + if v, ok := d.GetOk("nat_ip_cidr"); ok { + request["NatIpCidr"] = v + } + if v, ok := d.GetOk("nat_ip_cidr_description"); ok { + request["NatIpCidrDescription"] = v + } + if v, ok := d.GetOk("nat_ip_cidr_name"); ok { + request["NatIpCidrName"] = v + } + request["RegionId"] = client.RegionId + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("CreateNatIpCidr") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_vpc_nat_ip_cidr", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["NatGatewayId"], ":", request["NatIpCidr"])) + + return resourceAlicloudVpcNatIpCidrRead(d, meta) +} +func resourceAlicloudVpcNatIpCidrRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vpcService := VpcService{client} + object, err := vpcService.DescribeVpcNatIpCidr(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_vpc_nat_ip_cidr vpcService.DescribeVpcNatIpCidr Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + d.Set("nat_gateway_id", parts[0]) + d.Set("nat_ip_cidr", parts[1]) + d.Set("nat_ip_cidr_description", object["NatIpCidrDescription"]) + d.Set("nat_ip_cidr_name", object["NatIpCidrName"]) + d.Set("status", object["NatIpCidrStatus"]) + return nil +} +func resourceAlicloudVpcNatIpCidrUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + update := false + request := map[string]interface{}{ + "NatGatewayId": parts[0], + "NatIpCidr": parts[1], + } + if d.HasChange("nat_ip_cidr_name") { + update = true + } + if v, ok := d.GetOk("nat_ip_cidr_name"); ok { + request["NatIpCidrName"] = v + } + request["RegionId"] = client.RegionId + if d.HasChange("dry_run") || d.IsNewResource() { + update = true + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + } + if d.HasChange("nat_ip_cidr_description") { + update = true + if v, ok := d.GetOk("nat_ip_cidr_description"); ok { + request["NatIpCidrDescription"] = v + } + } + if update { + action := "ModifyNatIpCidrAttribute" + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("ModifyNatIpCidrAttribute") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudVpcNatIpCidrRead(d, meta) +} +func resourceAlicloudVpcNatIpCidrDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + action := "DeleteNatIpCidr" + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "NatGatewayId": parts[0], + "NatIpCidr": parts[1], + } + + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + request["RegionId"] = client.RegionId + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("DeleteNatIpCidr") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_traffic_mirror_filter.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_traffic_mirror_filter.go new file mode 100644 index 00000000000..cefc6dcbcc5 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_traffic_mirror_filter.go @@ -0,0 +1,208 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudVpcTrafficMirrorFilter() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudVpcTrafficMirrorFilterCreate, + Read: resourceAlicloudVpcTrafficMirrorFilterRead, + Update: resourceAlicloudVpcTrafficMirrorFilterUpdate, + Delete: resourceAlicloudVpcTrafficMirrorFilterDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(5 * time.Minute), + Delete: schema.DefaultTimeout(5 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "dry_run": { + Type: schema.TypeBool, + Optional: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "traffic_mirror_filter_description": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-zA-Z][\w\-]{1,255}$`), "The description must be `2` to `256` characters in length. It must start with a letter and cannot start with `http://` or `https://`"), + }, + "traffic_mirror_filter_name": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-zA-Z][\w\-.]{1,127}$`), "The name must be `2` to `128` characters in length, and can contain digits, periods (.), underscores (_), and hyphens (-). It must start with a letter and cannot start with `http://` or `https://`."), + }, + }, + } +} + +func resourceAlicloudVpcTrafficMirrorFilterCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateTrafficMirrorFilter" + request := make(map[string]interface{}) + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("traffic_mirror_filter_description"); ok { + request["TrafficMirrorFilterDescription"] = v + } + if v, ok := d.GetOk("traffic_mirror_filter_name"); ok { + request["TrafficMirrorFilterName"] = v + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("CreateTrafficMirrorFilter") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_vpc_traffic_mirror_filter", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["TrafficMirrorFilterId"])) + vpcService := VpcService{client} + stateConf := BuildStateConf([]string{}, []string{"Created"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, vpcService.VpcTrafficMirrorFilterStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudVpcTrafficMirrorFilterRead(d, meta) +} +func resourceAlicloudVpcTrafficMirrorFilterRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vpcService := VpcService{client} + object, err := vpcService.DescribeVpcTrafficMirrorFilter(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_vpc_traffic_mirror_filter vpcService.DescribeVpcTrafficMirrorFilter Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("status", object["TrafficMirrorFilterStatus"]) + d.Set("traffic_mirror_filter_description", object["TrafficMirrorFilterDescription"]) + d.Set("traffic_mirror_filter_name", object["TrafficMirrorFilterName"]) + return nil +} +func resourceAlicloudVpcTrafficMirrorFilterUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + update := false + request := map[string]interface{}{ + "TrafficMirrorFilterId": d.Id(), + } + request["RegionId"] = client.RegionId + if d.HasChange("traffic_mirror_filter_description") { + update = true + if v, ok := d.GetOk("traffic_mirror_filter_description"); ok { + request["TrafficMirrorFilterDescription"] = v + } + } + if d.HasChange("traffic_mirror_filter_name") { + update = true + if v, ok := d.GetOk("traffic_mirror_filter_name"); ok { + request["TrafficMirrorFilterName"] = v + } + } + if update { + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + action := "UpdateTrafficMirrorFilterAttribute" + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("UpdateTrafficMirrorFilterAttribute") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + return resourceAlicloudVpcTrafficMirrorFilterRead(d, meta) +} +func resourceAlicloudVpcTrafficMirrorFilterDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + action := "DeleteTrafficMirrorFilter" + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "TrafficMirrorFilterId": d.Id(), + } + + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + request["RegionId"] = client.RegionId + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 10*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("DeleteTrafficMirrorFilter") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if IsExpectedErrors(err, []string{"IncorrectStatus.TrafficMirrorFilter", "IncorrectStatus.TrafficMirrorRule"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"ResourceNotFound.TrafficMirrorFilter"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_traffic_mirror_filter_egress_rule.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_traffic_mirror_filter_egress_rule.go new file mode 100644 index 00000000000..bb63609848d --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_traffic_mirror_filter_egress_rule.go @@ -0,0 +1,318 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudVpcTrafficMirrorFilterEgressRule() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudVpcTrafficMirrorFilterEgressRuleCreate, + Read: resourceAlicloudVpcTrafficMirrorFilterEgressRuleRead, + Update: resourceAlicloudVpcTrafficMirrorFilterEgressRuleUpdate, + Delete: resourceAlicloudVpcTrafficMirrorFilterEgressRuleDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(1 * time.Minute), + Update: schema.DefaultTimeout(1 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "destination_cidr_block": { + Type: schema.TypeString, + Required: true, + }, + "destination_port_range": { + Type: schema.TypeString, + Optional: true, + Computed: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("protocol"); ok && v.(string) == "ICMP" { + return true + } + return false + }, + }, + "dry_run": { + Type: schema.TypeBool, + Optional: true, + }, + "priority": { + Type: schema.TypeInt, + Required: true, + ValidateFunc: validation.IntBetween(1, 10), + }, + "protocol": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"ALL", "ICMP", "TCP", "UDP"}, false), + }, + "rule_action": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"accept", "drop"}, false), + }, + "source_cidr_block": { + Type: schema.TypeString, + Required: true, + }, + "source_port_range": { + Type: schema.TypeString, + Optional: true, + Computed: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("protocol"); ok && v.(string) == "ICMP" { + return true + } + return false + }, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "traffic_mirror_filter_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "traffic_mirror_filter_egress_rule_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudVpcTrafficMirrorFilterEgressRuleCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateTrafficMirrorFilterRules" + request := make(map[string]interface{}) + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + + requestEgressRules := make(map[string]interface{}) + requestEgressRulesMap := make([]interface{}, 0) + requestEgressRules["Action"] = d.Get("rule_action") + requestEgressRules["DestinationCidrBlock"] = d.Get("destination_cidr_block") + requestEgressRules["Priority"] = d.Get("priority") + requestEgressRules["Protocol"] = d.Get("protocol") + requestEgressRules["SourceCidrBlock"] = d.Get("source_cidr_block") + if fmt.Sprint(d.Get("protocol")) != "ICMP" { + if v, ok := d.GetOk("source_port_range"); ok { + requestEgressRules["SourcePortRange"] = v + } + if v, ok := d.GetOk("destination_port_range"); ok { + requestEgressRules["DestinationPortRange"] = v + } + } + requestEgressRulesMap = append(requestEgressRulesMap, requestEgressRules) + request["EgressRules"] = requestEgressRulesMap + + request["RegionId"] = client.RegionId + request["TrafficMirrorFilterId"] = d.Get("traffic_mirror_filter_id") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("CreateTrafficMirrorFilterRules") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_vpc_traffic_mirror_filter_egress_rule", action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.EgressRules", response) + if err != nil || len(v.([]interface{})) < 1 { + return WrapErrorf(err, IdMsg, d.Id()) + } + response = v.([]interface{})[0].(map[string]interface{}) + d.SetId(fmt.Sprint(request["TrafficMirrorFilterId"], ":", response["InstanceId"])) + + vpcService := VpcService{client} + stateConf := BuildStateConf([]string{}, []string{"Created"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, vpcService.VpcTrafficMirrorFilterEgressRuleStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudVpcTrafficMirrorFilterEgressRuleRead(d, meta) +} +func resourceAlicloudVpcTrafficMirrorFilterEgressRuleRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vpcService := VpcService{client} + object, err := vpcService.DescribeVpcTrafficMirrorFilterEgressRule(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_vpc_traffic_mirror_filter_egress_rule vpcService.DescribeVpcTrafficMirrorFilterEgressRule Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("traffic_mirror_filter_id", object["TrafficMirrorFilterId"]) + d.Set("destination_cidr_block", object["DestinationCidrBlock"]) + d.Set("destination_port_range", object["DestinationPortRange"]) + d.Set("priority", object["Priority"]) + d.Set("protocol", object["Protocol"]) + d.Set("rule_action", object["Action"]) + d.Set("source_cidr_block", object["SourceCidrBlock"]) + d.Set("source_port_range", object["SourcePortRange"]) + d.Set("status", object["TrafficMirrorFilterRuleStatus"]) + d.Set("traffic_mirror_filter_egress_rule_id", fmt.Sprint(object["TrafficMirrorFilterRuleId"])) + return nil +} +func resourceAlicloudVpcTrafficMirrorFilterEgressRuleUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vpcService := VpcService{client} + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + update := false + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "TrafficMirrorFilterRuleId": parts[1], + } + request["RegionId"] = client.RegionId + if d.HasChange("destination_cidr_block") { + update = true + if v, ok := d.GetOk("destination_cidr_block"); ok { + request["DestinationCidrBlock"] = v + } + } + if d.HasChange("destination_port_range") { + update = true + if v, ok := d.GetOk("destination_port_range"); ok { + request["DestinationPortRange"] = v + } + } + if d.HasChange("priority") { + update = true + if v, ok := d.GetOk("priority"); ok { + request["Priority"] = v + } + } + if d.HasChange("protocol") { + update = true + if v, ok := d.GetOk("protocol"); ok { + request["Protocol"] = v + } + } + if d.HasChange("source_cidr_block") { + update = true + if v, ok := d.GetOk("source_cidr_block"); ok { + request["SourceCidrBlock"] = v + } + } + if d.HasChange("source_port_range") { + update = true + if v, ok := d.GetOk("source_port_range"); ok { + request["SourcePortRange"] = v + } + } + if d.HasChange("rule_action") { + update = true + if v, ok := d.GetOk("rule_action"); ok { + request["RuleAction"] = v + } + } + if update { + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + action := "UpdateTrafficMirrorFilterRuleAttribute" + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("UpdateTrafficMirrorFilterRuleAttribute") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Created"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, vpcService.VpcTrafficMirrorFilterEgressRuleStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + return resourceAlicloudVpcTrafficMirrorFilterEgressRuleRead(d, meta) +} +func resourceAlicloudVpcTrafficMirrorFilterEgressRuleDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + action := "DeleteTrafficMirrorFilterRules" + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "TrafficMirrorFilterRuleIds": []string{parts[1]}, + "TrafficMirrorFilterId": parts[0], + "RegionId": client.RegionId, + } + + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("DeleteTrafficMirrorFilterRules") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_traffic_mirror_filter_ingress_rule.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_traffic_mirror_filter_ingress_rule.go new file mode 100644 index 00000000000..67f69e42235 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_traffic_mirror_filter_ingress_rule.go @@ -0,0 +1,318 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudVpcTrafficMirrorFilterIngressRule() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudVpcTrafficMirrorFilterIngressRuleCreate, + Read: resourceAlicloudVpcTrafficMirrorFilterIngressRuleRead, + Update: resourceAlicloudVpcTrafficMirrorFilterIngressRuleUpdate, + Delete: resourceAlicloudVpcTrafficMirrorFilterIngressRuleDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(1 * time.Minute), + Update: schema.DefaultTimeout(1 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "destination_cidr_block": { + Type: schema.TypeString, + Required: true, + }, + "destination_port_range": { + Type: schema.TypeString, + Optional: true, + Computed: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("protocol"); ok && v.(string) == "ICMP" { + return true + } + return false + }, + }, + "dry_run": { + Type: schema.TypeBool, + Optional: true, + }, + "priority": { + Type: schema.TypeInt, + Required: true, + ValidateFunc: validation.IntBetween(1, 10), + }, + "protocol": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"ALL", "ICMP", "TCP", "UDP"}, false), + }, + "rule_action": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"accept", "drop"}, false), + }, + "source_cidr_block": { + Type: schema.TypeString, + Required: true, + }, + "source_port_range": { + Type: schema.TypeString, + Optional: true, + Computed: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if v, ok := d.GetOk("protocol"); ok && v.(string) == "ICMP" { + return true + } + return false + }, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "traffic_mirror_filter_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "traffic_mirror_filter_ingress_rule_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAlicloudVpcTrafficMirrorFilterIngressRuleCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateTrafficMirrorFilterRules" + request := make(map[string]interface{}) + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + + requestIngressRules := make(map[string]interface{}) + requestIngressRulesMap := make([]interface{}, 0) + requestIngressRules["Action"] = d.Get("rule_action") + requestIngressRules["DestinationCidrBlock"] = d.Get("destination_cidr_block") + requestIngressRules["Priority"] = d.Get("priority") + requestIngressRules["Protocol"] = d.Get("protocol") + requestIngressRules["SourceCidrBlock"] = d.Get("source_cidr_block") + if fmt.Sprint(d.Get("protocol")) != "ICMP" { + if v, ok := d.GetOk("source_port_range"); ok { + requestIngressRules["SourcePortRange"] = v + } + if v, ok := d.GetOk("destination_port_range"); ok { + requestIngressRules["DestinationPortRange"] = v + } + } + requestIngressRulesMap = append(requestIngressRulesMap, requestIngressRules) + request["IngressRules"] = requestIngressRulesMap + + request["RegionId"] = client.RegionId + request["TrafficMirrorFilterId"] = d.Get("traffic_mirror_filter_id") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("CreateTrafficMirrorFilterRules") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_vpc_traffic_mirror_filter_ingress_rule", action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.IngressRules", response) + if err != nil || len(v.([]interface{})) < 1 { + return WrapErrorf(err, IdMsg, d.Id()) + } + response = v.([]interface{})[0].(map[string]interface{}) + d.SetId(fmt.Sprint(request["TrafficMirrorFilterId"], ":", response["InstanceId"])) + + vpcService := VpcService{client} + stateConf := BuildStateConf([]string{}, []string{"Created"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, vpcService.VpcTrafficMirrorFilterIngressRuleStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudVpcTrafficMirrorFilterIngressRuleRead(d, meta) +} +func resourceAlicloudVpcTrafficMirrorFilterIngressRuleRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vpcService := VpcService{client} + object, err := vpcService.DescribeVpcTrafficMirrorFilterIngressRule(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_vpc_traffic_mirror_filter_ingress_rule vpcService.DescribeVpcTrafficMirrorFilterIngressRule Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("traffic_mirror_filter_id", object["TrafficMirrorFilterId"]) + d.Set("destination_cidr_block", object["DestinationCidrBlock"]) + d.Set("destination_port_range", object["DestinationPortRange"]) + d.Set("priority", formatInt(object["Priority"])) + d.Set("protocol", object["Protocol"]) + d.Set("rule_action", object["Action"]) + d.Set("source_cidr_block", object["SourceCidrBlock"]) + d.Set("source_port_range", object["SourcePortRange"]) + d.Set("status", object["TrafficMirrorFilterRuleStatus"]) + d.Set("traffic_mirror_filter_ingress_rule_id", fmt.Sprint(object["TrafficMirrorFilterRuleId"])) + return nil +} +func resourceAlicloudVpcTrafficMirrorFilterIngressRuleUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vpcService := VpcService{client} + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + update := false + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "TrafficMirrorFilterRuleId": parts[1], + } + request["RegionId"] = client.RegionId + if d.HasChange("destination_cidr_block") { + update = true + if v, ok := d.GetOk("destination_cidr_block"); ok { + request["DestinationCidrBlock"] = v + } + } + if d.HasChange("destination_port_range") { + update = true + if v, ok := d.GetOk("destination_port_range"); ok { + request["DestinationPortRange"] = v + } + } + if d.HasChange("priority") { + update = true + if v, ok := d.GetOk("priority"); ok { + request["Priority"] = v + } + } + if d.HasChange("protocol") { + update = true + if v, ok := d.GetOk("protocol"); ok { + request["Protocol"] = v + } + } + if d.HasChange("source_cidr_block") { + update = true + if v, ok := d.GetOk("source_cidr_block"); ok { + request["SourceCidrBlock"] = v + } + } + if d.HasChange("source_port_range") { + update = true + if v, ok := d.GetOk("source_port_range"); ok { + request["SourcePortRange"] = v + } + } + if d.HasChange("rule_action") { + update = true + if v, ok := d.GetOk("rule_action"); ok { + request["RuleAction"] = v + } + } + if update { + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + action := "UpdateTrafficMirrorFilterRuleAttribute" + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("UpdateTrafficMirrorFilterRuleAttribute") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Created"}, d.Timeout(schema.TimeoutUpdate), 5*time.Second, vpcService.VpcTrafficMirrorFilterIngressRuleStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + } + return resourceAlicloudVpcTrafficMirrorFilterIngressRuleRead(d, meta) +} +func resourceAlicloudVpcTrafficMirrorFilterIngressRuleDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + action := "DeleteTrafficMirrorFilterRules" + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "TrafficMirrorFilterRuleIds": []string{parts[1]}, + "TrafficMirrorFilterId": parts[0], + "RegionId": client.RegionId, + } + + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("DeleteTrafficMirrorFilterRules") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_traffic_mirror_session.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_traffic_mirror_session.go new file mode 100644 index 00000000000..0688007ce28 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_traffic_mirror_session.go @@ -0,0 +1,392 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudVpcTrafficMirrorSession() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudVpcTrafficMirrorSessionCreate, + Read: resourceAlicloudVpcTrafficMirrorSessionRead, + Update: resourceAlicloudVpcTrafficMirrorSessionUpdate, + Delete: resourceAlicloudVpcTrafficMirrorSessionDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(1 * time.Minute), + Delete: schema.DefaultTimeout(1 * time.Minute), + Update: schema.DefaultTimeout(1 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "dry_run": { + Type: schema.TypeBool, + Optional: true, + }, + "enabled": { + Type: schema.TypeBool, + Optional: true, + }, + "priority": { + Type: schema.TypeInt, + Required: true, + ValidateFunc: validation.IntBetween(1, 32766), + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "traffic_mirror_filter_id": { + Type: schema.TypeString, + Required: true, + }, + "traffic_mirror_session_description": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(2, 256), + }, + "traffic_mirror_session_name": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile("^[a-zA-Z\u4E00-\u9FA5][\u4E00-\u9FA5A-Za-z0-9_-]{2,128}$"), "The name must be `2` to `128` characters in length and can contain digits, underscores (_), and hyphens (-). It must start with a letter."), + }, + "traffic_mirror_source_ids": { + Type: schema.TypeList, + Required: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "traffic_mirror_target_id": { + Type: schema.TypeString, + Required: true, + }, + "traffic_mirror_target_type": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"NetworkInterface", "SLB"}, false), + }, + "virtual_network_id": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + ValidateFunc: validation.IntBetween(0, 16777215), + }, + }, + } +} + +func resourceAlicloudVpcTrafficMirrorSessionCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateTrafficMirrorSession" + request := make(map[string]interface{}) + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + if v, ok := d.GetOk("enabled"); ok { + request["Enabled"] = v + } + request["Priority"] = d.Get("priority") + request["RegionId"] = client.RegionId + request["TrafficMirrorFilterId"] = d.Get("traffic_mirror_filter_id") + if v, ok := d.GetOk("traffic_mirror_session_description"); ok { + request["TrafficMirrorSessionDescription"] = v + } + if v, ok := d.GetOk("traffic_mirror_session_name"); ok { + request["TrafficMirrorSessionName"] = v + } + request["TrafficMirrorSourceIds"] = d.Get("traffic_mirror_source_ids") + request["TrafficMirrorTargetId"] = d.Get("traffic_mirror_target_id") + request["TrafficMirrorTargetType"] = d.Get("traffic_mirror_target_type") + if v, ok := d.GetOk("virtual_network_id"); ok { + request["VirtualNetworkId"] = v + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("CreateTrafficMirrorSession") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_vpc_traffic_mirror_session", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["TrafficMirrorSessionId"])) + vpcService := VpcService{client} + stateConf := BuildStateConf([]string{}, []string{"Created"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, vpcService.VpcTrafficMirrorSessionStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudVpcTrafficMirrorSessionRead(d, meta) +} +func resourceAlicloudVpcTrafficMirrorSessionRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vpcService := VpcService{client} + object, err := vpcService.DescribeVpcTrafficMirrorSession(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_vpc_traffic_mirror_session vpcService.DescribeVpcTrafficMirrorSession Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("enabled", object["Enabled"]) + d.Set("priority", formatInt(object["Priority"])) + d.Set("status", object["TrafficMirrorSessionStatus"]) + d.Set("traffic_mirror_filter_id", object["TrafficMirrorFilterId"]) + d.Set("traffic_mirror_session_description", object["TrafficMirrorSessionDescription"]) + d.Set("traffic_mirror_session_name", object["TrafficMirrorSessionName"]) + d.Set("traffic_mirror_source_ids", object["TrafficMirrorSourceIds"]) + d.Set("traffic_mirror_target_id", object["TrafficMirrorTargetId"]) + d.Set("traffic_mirror_target_type", object["TrafficMirrorTargetType"]) + d.Set("virtual_network_id", formatInt(object["VirtualNetworkId"])) + return nil +} +func resourceAlicloudVpcTrafficMirrorSessionUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vpcService := VpcService{client} + var response map[string]interface{} + d.Partial(true) + + update := false + request := map[string]interface{}{ + "TrafficMirrorSessionId": d.Id(), + } + request["RegionId"] = client.RegionId + if d.HasChange("enabled") { + update = true + if v, ok := d.GetOkExists("enabled"); ok { + request["Enabled"] = v + } + } + if d.HasChange("priority") { + update = true + request["Priority"] = d.Get("priority") + } + if d.HasChange("traffic_mirror_filter_id") { + update = true + request["TrafficMirrorFilterId"] = d.Get("traffic_mirror_filter_id") + } + if d.HasChange("traffic_mirror_session_description") { + update = true + if v, ok := d.GetOk("traffic_mirror_session_description"); ok { + request["TrafficMirrorSessionDescription"] = v + } + } + if d.HasChange("traffic_mirror_session_name") { + update = true + if v, ok := d.GetOk("traffic_mirror_session_name"); ok { + request["TrafficMirrorSessionName"] = v + } + } + request["TrafficMirrorTargetId"] = d.Get("traffic_mirror_target_id") + if d.HasChange("traffic_mirror_target_id") { + update = true + } + + request["TrafficMirrorTargetType"] = d.Get("traffic_mirror_target_type") + + if d.HasChange("traffic_mirror_target_type") { + update = true + } + if d.HasChange("virtual_network_id") { + update = true + if v, ok := d.GetOk("virtual_network_id"); ok { + request["VirtualNetworkId"] = v + } + } + if update { + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + action := "UpdateTrafficMirrorSessionAttribute" + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("UpdateTrafficMirrorSessionAttribute") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + vpcService := VpcService{client} + stateConf := BuildStateConf([]string{}, []string{"Created"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, vpcService.VpcTrafficMirrorSessionStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + d.SetPartial("enabled") + d.SetPartial("priority") + d.SetPartial("traffic_mirror_filter_id") + d.SetPartial("traffic_mirror_session_description") + d.SetPartial("traffic_mirror_session_name") + d.SetPartial("traffic_mirror_target_id") + d.SetPartial("traffic_mirror_target_type") + d.SetPartial("virtual_network_id") + } + d.Partial(false) + if d.HasChange("traffic_mirror_source_ids") { + oldTrafficMirrorSourceIds, newTrafficMirrorSourceIds := d.GetChange("traffic_mirror_source_ids") + removed := oldTrafficMirrorSourceIds.([]interface{}) + added := newTrafficMirrorSourceIds.([]interface{}) + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + if len(removed) > 0 { + removeSourcesFromTrafficMirrorSessionRequest := map[string]interface{}{ + "TrafficMirrorSessionId": d.Id(), + "RegionId": client.RegionId, + } + removeSourcesFromTrafficMirrorSessionRequest["TrafficMirrorSourceIds"] = removed + if _, ok := d.GetOkExists("dry_run"); ok { + removeSourcesFromTrafficMirrorSessionRequest["DryRun"] = d.Get("dry_run") + } + action := "RemoveSourcesFromTrafficMirrorSession" + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("RemoveSourcesFromTrafficMirrorSession") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, removeSourcesFromTrafficMirrorSessionRequest, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, removeSourcesFromTrafficMirrorSessionRequest) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Created"}, d.Timeout(schema.TimeoutUpdate), 10*time.Second, vpcService.VpcTrafficMirrorSessionStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + } + if len(added) > 0 { + AddSourcesToTrafficMirrorSessionRequest := map[string]interface{}{ + "TrafficMirrorSessionId": d.Id(), + "RegionId": client.RegionId, + } + AddSourcesToTrafficMirrorSessionRequest["TrafficMirrorSourceIds"] = added + if _, ok := d.GetOkExists("dry_run"); ok { + AddSourcesToTrafficMirrorSessionRequest["DryRun"] = d.Get("dry_run") + } + action := "AddSourcesToTrafficMirrorSession" + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("AddSourcesToTrafficMirrorSession") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, AddSourcesToTrafficMirrorSessionRequest, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, AddSourcesToTrafficMirrorSessionRequest) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{"Created"}, d.Timeout(schema.TimeoutUpdate), 10*time.Second, vpcService.VpcTrafficMirrorSessionStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + } + d.SetPartial("TrafficMirrorSourceIds") + } + return resourceAlicloudVpcTrafficMirrorSessionRead(d, meta) +} +func resourceAlicloudVpcTrafficMirrorSessionDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vpcService := VpcService{client} + action := "DeleteTrafficMirrorSession" + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "TrafficMirrorSessionId": d.Id(), + } + + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + request["RegionId"] = client.RegionId + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 10*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("DeleteTrafficMirrorSession") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if IsExpectedErrors(err, []string{"IncorrectStatus.TrafficMirrorSession"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"ResourceNotFound.TrafficMirrorSession"}) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{}, d.Timeout(schema.TimeoutDelete), 5*time.Second, vpcService.VpcTrafficMirrorSessionStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_vbr_ha.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_vbr_ha.go new file mode 100644 index 00000000000..e5bc34ce90e --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpc_vbr_ha.go @@ -0,0 +1,175 @@ +package alicloud + +import ( + "fmt" + "log" + "regexp" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudVpcVbrHa() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudVpcVbrHaCreate, + Read: resourceAlicloudVpcVbrHaRead, + Update: resourceAlicloudVpcVbrHaUpdate, + Delete: resourceAlicloudVpcVbrHaDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(10 * time.Minute), + Delete: schema.DefaultTimeout(10 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "description": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.All(validation.StringLenBetween(2, 256), validation.StringDoesNotMatch(regexp.MustCompile(`(^http://.*)|(^https://.*)`), "It cannot begin with \"http://\", \"https://\".")), + }, + "dry_run": { + Type: schema.TypeBool, + Optional: true, + }, + "peer_vbr_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "vbr_ha_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "vbr_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceAlicloudVpcVbrHaCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "CreateVbrHa" + request := make(map[string]interface{}) + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + if v, ok := d.GetOk("description"); ok { + request["Description"] = v + } + if v, ok := d.GetOkExists("dry_run"); ok { + request["DryRun"] = v + } + request["PeerVbrId"] = d.Get("peer_vbr_id") + request["RegionId"] = client.RegionId + if v, ok := d.GetOk("vbr_ha_name"); ok { + request["Name"] = v + } + request["VbrId"] = d.Get("vbr_id") + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("CreateVbrHa") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_vpc_vbr_ha", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(response["VbrHaId"])) + vpcService := VpcService{client} + stateConf := BuildStateConf([]string{}, []string{"Active"}, d.Timeout(schema.TimeoutCreate), 5*time.Second, vpcService.VpcVbrHaStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + + return resourceAlicloudVpcVbrHaRead(d, meta) +} +func resourceAlicloudVpcVbrHaRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vpcService := VpcService{client} + object, err := vpcService.DescribeVpcVbrHa(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_vpc_vbr_ha vpcService.DescribeVpcVbrHa Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + d.Set("description", object["Description"]) + d.Set("peer_vbr_id", object["PeerVbrId"]) + d.Set("status", object["Status"]) + d.Set("vbr_ha_name", object["Name"]) + d.Set("vbr_id", object["VbrId"]) + return nil +} +func resourceAlicloudVpcVbrHaUpdate(d *schema.ResourceData, meta interface{}) error { + log.Println(fmt.Sprintf("[WARNING] The resouce has not update operation.")) + return resourceAlicloudVpcVbrHaRead(d, meta) +} +func resourceAlicloudVpcVbrHaDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + vpcService := VpcService{client} + action := "DeleteVbrHa" + var response map[string]interface{} + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } + request := map[string]interface{}{ + "InstanceId": d.Id(), + } + + request["RegionId"] = client.RegionId + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + request["ClientToken"] = buildClientToken("DeleteVbrHa") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + stateConf := BuildStateConf([]string{}, []string{}, d.Timeout(schema.TimeoutDelete), 5*time.Second, vpcService.VpcVbrHaStateRefreshFunc(d.Id(), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, d.Id()) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpn_connection.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpn_connection.go index 90121c2d04d..3fe641049d8 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpn_connection.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpn_connection.go @@ -104,7 +104,7 @@ func resourceAliyunVpnConnection() *schema.Resource { "ike_auth_alg": { Type: schema.TypeString, Optional: true, - Default: VPN_AUTH_SHA, + Computed: true, ValidateFunc: validation.StringInSlice([]string{VPN_AUTH_SHA, VPN_AUTH_MD5, VPN_AUTH_SHA256, VPN_AUTH_SHA386, VPN_AUTH_SHA512}, false), }, "ike_pfs": { diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpn_customer_gateway.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpn_customer_gateway.go index c0c097ed617..2916dcd0c61 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpn_customer_gateway.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpn_customer_gateway.go @@ -66,7 +66,7 @@ func resourceAliyunVpnCustomerGatewayCreate(d *schema.ResourceData, meta interfa return vpcClient.CreateCustomerGateway(&args) }) if err != nil { - if IsExpectedErrors(err, []string{Throttling}) { + if IsExpectedErrors(err, []string{Throttling, "OperationConflict"}) { wait() return resource.RetryableError(err) } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpn_gateway.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpn_gateway.go index 3f24dbf6f2e..a7877c54631 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpn_gateway.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vpn_gateway.go @@ -2,10 +2,13 @@ package alicloud import ( "fmt" + "log" "strconv" "strings" "time" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/denverdino/aliyungo/common" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" @@ -13,7 +16,6 @@ import ( "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" "github.com/aliyun/alibaba-cloud-sdk-go/services/vpc" "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) @@ -265,6 +267,10 @@ func resourceAliyunVpnGatewayUpdate(d *schema.ResourceData, meta interface{}) er } func resourceAliyunVpnGatewayDelete(d *schema.ResourceData, meta interface{}) error { + if d.Get("instance_charge_type").(string) == "PrePaid" { + log.Printf("[WARN] Cannot destroy resource Alicloud Resource VPN Gateway. Terraform will remove this resource from the state file, however resources may remain.") + return nil + } client := meta.(*connectivity.AliyunClient) vpnGatewayService := VpnGatewayService{client} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vswitch.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vswitch.go index 080ac31a2a1..850cd7a78be 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vswitch.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_vswitch.go @@ -168,6 +168,10 @@ func resourceAlicloudVswitchUpdate(d *schema.ResourceData, meta interface{}) err vpcService := VpcService{client} var response map[string]interface{} d.Partial(true) + conn, err := client.NewVpcClient() + if err != nil { + return WrapError(err) + } if d.HasChange("tags") { if err := vpcService.SetResourceTags(d, "VSWITCH"); err != nil { @@ -194,10 +198,6 @@ func resourceAlicloudVswitchUpdate(d *schema.ResourceData, meta interface{}) err } if update { action := "ModifyVSwitchAttribute" - conn, err := client.NewVpcClient() - if err != nil { - return WrapError(err) - } wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_waf_certificate.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_waf_certificate.go new file mode 100644 index 00000000000..fec725dd601 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_waf_certificate.go @@ -0,0 +1,168 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAlicloudWafCertificate() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudWafCertificateCreate, + Read: resourceAlicloudWafCertificateRead, + Update: resourceAlicloudWafCertificateUpdate, + Delete: resourceAlicloudWafCertificateDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "domain": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "certificate": { + Type: schema.TypeString, + Optional: true, + ConflictsWith: []string{"certificate_id"}, + ForceNew: true, + }, + "private_key": { + Type: schema.TypeString, + Optional: true, + ConflictsWith: []string{"certificate_id"}, + ForceNew: true, + }, + "certificate_id": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ConflictsWith: []string{"certificate", "private_key", "certificate_name"}, + }, + "certificate_name": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ConflictsWith: []string{"certificate_id"}, + }, + }, + } +} + +func resourceAlicloudWafCertificateCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + request := make(map[string]interface{}) + conn, err := client.NewWafClient() + if err != nil { + return WrapError(err) + } + var response map[string]interface{} + if sslId, ok := d.GetOk("certificate_id"); ok { + action := "CreateCertificateByCertificateId" + request["InstanceId"] = d.Get("instance_id") + request["CertificateId"] = sslId.(string) + if v, ok := d.GetOk("domain"); ok { + request["Domain"] = v + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-10"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_waf_certificate", action, AlibabaCloudSdkGoERROR) + } + d.SetId(fmt.Sprint(request["InstanceId"], ":", request["Domain"], ":", formatInt(response["CertificateId"]))) + return resourceAlicloudWafCertificateRead(d, meta) + } + + request = make(map[string]interface{}) + action := "CreateCertificate" + if v, ok := d.GetOk("certificate"); ok { + request["Certificate"] = v + } else { + return WrapErrorf(err, RequiredWhenMsg, "certificate", "certificate_id", "null") + } + if v, ok := d.GetOk("private_key"); ok { + request["PrivateKey"] = v + } else { + return WrapErrorf(err, RequiredWhenMsg, "private_key", "certificate_id", "null") + } + if v, ok := d.GetOk("certificate_name"); ok { + request["CertificateName"] = v + } else { + return WrapErrorf(err, RequiredWhenMsg, "certificate_name", "certificate_id", "null") + } + request["Domain"] = d.Get("domain") + request["InstanceId"] = d.Get("instance_id") + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-10"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_waf_certificate", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["InstanceId"], ":", request["Domain"], ":", formatInt(response["CertificateId"]))) + + return resourceAlicloudWafCertificateRead(d, meta) +} +func resourceAlicloudWafCertificateRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + wafOpenapiService := Waf_openapiService{client} + object, err := wafOpenapiService.DescribeWafCertificate(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_waf_certificate wafOpenapiService.DescribeWafCertificate Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + d.Set("certificate_id", object["CertificateId"]) + d.Set("domain", parts[1]) + d.Set("instance_id", parts[0]) + d.Set("certificate_name", object["CertificateName"]) + return nil +} +func resourceAlicloudWafCertificateUpdate(d *schema.ResourceData, meta interface{}) error { + log.Println(fmt.Sprintf("[WARNING] The resouce has not update operation.")) + return resourceAlicloudWafCertificateRead(d, meta) +} +func resourceAlicloudWafCertificateDelete(d *schema.ResourceData, meta interface{}) error { + log.Printf("[WARN] Cannot destroy resourceAlicloudWafCertificate. Terraform will remove this resource from the state file, however resources may remain.") + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_waf_instance.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_waf_instance.go index efb8758f8f5..12b186ee245 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_waf_instance.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_waf_instance.go @@ -89,6 +89,10 @@ func resourceAlicloudWafInstance() *schema.Resource { Type: schema.TypeString, Required: true, }, + "region": { + Type: schema.TypeString, + Optional: true, + }, }, } } @@ -116,6 +120,10 @@ func resourceAlicloudWafInstanceCreate(d *schema.ResourceData, meta interface{}) request["RenewalStatus"] = v } + region := client.RegionId + if v, ok := d.GetOk("region"); ok && v.(string) != "" { + region = v.(string) + } request["SubscriptionType"] = d.Get("subscription_type") request["Parameter"] = []map[string]string{ { @@ -152,7 +160,7 @@ func resourceAlicloudWafInstanceCreate(d *schema.ResourceData, meta interface{}) }, { "Code": "Region", - "Value": client.RegionId, + "Value": region, }, { "Code": "WafLog", diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_waf_protection_module.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_waf_protection_module.go new file mode 100644 index 00000000000..e552d5de2f3 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_waf_protection_module.go @@ -0,0 +1,204 @@ +package alicloud + +import ( + "fmt" + "log" + "time" + + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceAlicloudWafProtectionModule() *schema.Resource { + return &schema.Resource{ + Create: resourceAlicloudWafProtectionModuleCreate, + Read: resourceAlicloudWafProtectionModuleRead, + Update: resourceAlicloudWafProtectionModuleUpdate, + Delete: resourceAlicloudWafProtectionModuleDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "defense_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"ac_cc", "antifraud", "dld", "normalized", "waf"}, false), + }, + "domain": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "mode": { + Type: schema.TypeInt, + Required: true, + ValidateFunc: validation.IntInSlice([]int{0, 1, 2}), + }, + "status": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validation.IntInSlice([]int{0, 1}), + }, + }, + } +} + +func resourceAlicloudWafProtectionModuleCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + action := "ModifyProtectionModuleMode" + request := make(map[string]interface{}) + conn, err := client.NewWafClient() + if err != nil { + return WrapError(err) + } + request["DefenseType"] = d.Get("defense_type") + request["Domain"] = d.Get("domain") + request["InstanceId"] = d.Get("instance_id") + request["Mode"] = d.Get("mode") + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-10"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_waf_protection_module", action, AlibabaCloudSdkGoERROR) + } + + d.SetId(fmt.Sprint(request["InstanceId"], ":", request["Domain"], ":", request["DefenseType"])) + + return resourceAlicloudWafProtectionModuleUpdate(d, meta) +} +func resourceAlicloudWafProtectionModuleRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + wafOpenapiService := Waf_openapiService{client} + object, err := wafOpenapiService.DescribeWafProtectionModule(d.Id()) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_waf_protection_module wafOpenapiService.DescribeWafProtectionModule Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + d.Set("defense_type", parts[2]) + d.Set("domain", parts[1]) + d.Set("instance_id", parts[0]) + d.Set("mode", formatInt(object["Mode"])) + describeProtectionModuleStatusObject, err := wafOpenapiService.DescribeProtectionModuleStatus(d.Id()) + if err != nil { + return WrapError(err) + } + d.Set("status", formatInt(describeProtectionModuleStatusObject["ModuleStatus"])) + return nil +} +func resourceAlicloudWafProtectionModuleUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var response map[string]interface{} + parts, err := ParseResourceId(d.Id(), 3) + if err != nil { + return WrapError(err) + } + d.Partial(true) + + request := map[string]interface{}{ + "DefenseType": parts[2], + "Domain": parts[1], + "InstanceId": parts[0], + } + + update := false + if !d.IsNewResource() && d.HasChange("mode") { + update = true + if v, ok := d.GetOkExists("mode"); ok { + request["Mode"] = v + } + } + + if update { + action := "ModifyProtectionModuleMode" + conn, err := client.NewWafClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-10"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("mode") + } + + update = false + if d.IsNewResource() || d.HasChange("status") { + update = true + if v, ok := d.GetOkExists("status"); ok { + request["ModuleStatus"] = v + } + } + + if update { + action := "ModifyProtectionModuleStatus" + conn, err := client.NewWafClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-10"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + d.SetPartial("status") + } + + d.Partial(false) + return resourceAlicloudWafProtectionModuleRead(d, meta) +} +func resourceAlicloudWafProtectionModuleDelete(d *schema.ResourceData, meta interface{}) error { + log.Printf("[WARN] Cannot destroy resourceAlicloudWafProtectionModule. Terraform will remove this resource from the state file, however resources may remain.") + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_yundun_dbaudit_instance.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_yundun_dbaudit_instance.go index ce806b96b0e..52ae3d0b911 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_yundun_dbaudit_instance.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_yundun_dbaudit_instance.go @@ -3,12 +3,12 @@ package alicloud import ( "time" + log "github.com/sirupsen/logrus" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" - "github.com/aliyun/alibaba-cloud-sdk-go/services/yundun_dbaudit" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" "github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi" "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" @@ -48,7 +48,7 @@ func resourceAlicloudDbauditInstance() *schema.Resource { "period": { Type: schema.TypeInt, ValidateFunc: validation.IntInSlice([]int{1, 3, 6, 12, 24, 36}), - Optional: true, + Required: true, }, "vswitch_id": { Type: schema.TypeString, @@ -198,24 +198,8 @@ func resourceAlicloudDbauditInstanceUpdate(d *schema.ResourceData, meta interfac } func resourceAlicloudDbauditInstanceDelete(d *schema.ResourceData, meta interface{}) error { - client := meta.(*connectivity.AliyunClient) - dbauditService := DbauditService{client} - request := yundun_dbaudit.CreateRefundInstanceRequest() - request.InstanceId = d.Id() - - raw, err := dbauditService.client.WithDbauditClient(func(dbauditClient *yundun_dbaudit.Client) (interface{}, error) { - return dbauditClient.RefundInstance(request) - }) - - if err != nil { - return WrapErrorf(err, DefaultErrorMsg, d.Id(), request.GetActionName(), AlibabaCloudSdkGoERROR) - } - addDebug(request.GetActionName(), raw, request.RpcRequest, request) - // Wait for the release procedure of cloud resource dependencies. Instance can not be fetched through api as soon as release has - // been invoked, however the resources have not been fully destroyed yet. Therefore, a certain amount time of waiting - // is quite necessary (conservative estimation cloud be less then 3 minutes) - time.Sleep(time.Duration(RELEASE_HANG_MINS) * time.Minute) - return WrapError(dbauditService.WaitForYundunDbauditInstance(d.Id(), Deleted, 0)) + log.Printf("[WARN] Cannot destroy resourceAlicloudDbauditInstance. Terraform will remove this resource from the state file, however resources may remain.") + return nil } func buildDbauditCreateRequest(d *schema.ResourceData, meta interface{}) *bssopenapi.CreateInstanceRequest { diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_actiontrail.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_actiontrail.go index 1419c3f8454..1fdbc40a62d 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_actiontrail.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_actiontrail.go @@ -1,6 +1,9 @@ package alicloud import ( + "fmt" + "time" + "github.com/PaesslerAG/jsonpath" util "github.com/alibabacloud-go/tea-utils/service" "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" @@ -64,3 +67,62 @@ func (s *ActiontrailService) ActiontrailTrailStateRefreshFunc(id string, failSta return object, object["Status"].(string), nil } } + +func (s *ActiontrailService) DescribeActiontrailHistoryDeliveryJob(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewActiontrailClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetDeliveryHistoryJob" + request := map[string]interface{}{ + "JobId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-07-06"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"DeliveryHistoryJobNotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("ActionTrail:HistoryDeliveryJob", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *ActiontrailService) ActiontrailHistoryDeliveryJobStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeActiontrailHistoryDeliveryJob(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["JobStatus"]) == failState { + return object, fmt.Sprint(object["JobStatus"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["JobStatus"]))) + } + } + return object, fmt.Sprint(object["JobStatus"]), nil + } +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_alb.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_alb.go index 87b30194ea1..47ce6d829be 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_alb.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_alb.go @@ -15,7 +15,7 @@ type AlbService struct { client *connectivity.AliyunClient } -func (s *AlbService) ListAclEntries(id string) (object map[string]interface{}, err error) { +func (s *AlbService) ListAclEntries(id string) (objects []map[string]interface{}, err error) { var response map[string]interface{} conn, err := s.client.NewAlbClient() if err != nil { @@ -23,39 +23,48 @@ func (s *AlbService) ListAclEntries(id string) (object map[string]interface{}, e } action := "ListAclEntries" request := map[string]interface{}{ - "AclId": id, + "AclId": id, + "MaxResults": PageSizeLarge, } - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) - wait := incrementalWait(3*time.Second, 3*time.Second) - err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-16"), StringPointer("AK"), nil, request, &runtime) + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-16"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) if err != nil { - if NeedRetry(err) { - wait() - return resource.RetryableError(err) + if IsExpectedErrors(err, []string{"ResourceNotFound.Acl"}) { + return objects, WrapErrorf(Error(GetNotFoundMessage("ALB:Acl", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) } - return resource.NonRetryableError(err) + return objects, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) } - return nil - }) - addDebug(action, response, request) - if err != nil { - return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) - } - v, err := jsonpath.Get("$.AclEntries", response) - if err != nil { - return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.AclEntries", response) - } - if len(v.([]interface{})) < 1 { - return object, WrapErrorf(Error(GetNotFoundMessage("ALB", id)), NotFoundWithResponse, response) - } else { - if v.([]interface{})[0].(map[string]interface{})["AclId"].(string) != id { - return object, WrapErrorf(Error(GetNotFoundMessage("ALB", id)), NotFoundWithResponse, response) + resp, err := jsonpath.Get("$.AclEntries", response) + if formatInt(response["TotalCount"]) != 0 && err != nil { + return objects, WrapErrorf(err, FailedGetAttributeMsg, id, "$.AclEntries", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + objects = append(objects, item) + } + + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break } } - object = v.([]interface{})[0].(map[string]interface{}) - return object, nil + return objects, nil } func (s *AlbService) ListTagResources(id string, resourceType string) (object interface{}, err error) { @@ -214,8 +223,18 @@ func (s *AlbService) DescribeAlbAcl(id string) (object map[string]interface{}, e }) addDebug(action, response, request) if err != nil { + if IsExpectedErrors(err, []string{"Forbidden.Acl"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("ALB:Acl", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) } + totalCount, err := jsonpath.Get("$.TotalCount", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.TotalCount", response) + } + if fmt.Sprint(totalCount) == "0" { + return object, WrapErrorf(Error(GetNotFoundMessage("ALB", id)), NotFoundWithResponse, response) + } v, err := jsonpath.Get("$.Acls", response) if err != nil { return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Acls", response) @@ -224,7 +243,7 @@ func (s *AlbService) DescribeAlbAcl(id string) (object map[string]interface{}, e return object, WrapErrorf(Error(GetNotFoundMessage("ALB", id)), NotFoundWithResponse, response) } for _, v := range v.([]interface{}) { - if v.(map[string]interface{})["AclId"].(string) == id { + if fmt.Sprint(v.(map[string]interface{})["AclId"]) == id { idExist = true return v.(map[string]interface{}), nil } @@ -273,6 +292,9 @@ func (s *AlbService) DescribeAlbSecurityPolicy(id string) (object map[string]int return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) } v, err := jsonpath.Get("$.SecurityPolicies", response) + if formatInt(response["TotalCount"]) == 0 { + return object, WrapErrorf(Error(GetNotFoundMessage("ALB", id)), NotFoundWithResponse, response) + } if err != nil { return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.SecurityPolicies", response) } @@ -326,6 +348,9 @@ func (s *AlbService) ListSystemSecurityPolicies(id string) (object map[string]in return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) } v, err := jsonpath.Get("$.SecurityPolicies", response) + if formatInt(response["TotalCount"]) == 0 { + return object, WrapErrorf(Error(GetNotFoundMessage("ALB", id)), NotFoundWithResponse, response) + } if err != nil { return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.SecurityPolicies", response) } @@ -576,3 +601,198 @@ func (s *AlbService) AlbLoadBalancerStateRefreshFunc(id string, failStates []str return object, fmt.Sprint(object["LoadBalancerStatus"]), nil } } + +func (s *AlbService) AlbAclStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeAlbAcl(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + + if fmt.Sprint(object["AclStatus"]) == failState { + return object, fmt.Sprint(object["AclStatus"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["AclStatus"]))) + } + } + return object, fmt.Sprint(object["AclStatus"]), nil + } +} + +func (s *AlbService) AlbListenerStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeAlbListener(id) + if err != nil { + if NotFoundError(err) { + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + + if fmt.Sprint(object["ListenerStatus"]) == failState { + return object, fmt.Sprint(object["ListenerStatus"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["ListenerStatus"]))) + } + } + return object, fmt.Sprint(object["ListenerStatus"]), nil + } +} + +func (s *AlbService) DescribeAlbListener(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewAlbClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetListenerAttribute" + request := map[string]interface{}{ + "ListenerId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-16"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"ResourceNotFound.Listener"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("ALB:Listener", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *AlbService) DescribeAlbRule(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewAlbClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListRules" + request := map[string]interface{}{ + "MaxResults": PageSizeLarge, + } + idExist := false + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-16"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Rules", response) + if formatInt(response["TotalCount"]) != 0 && err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Rules", response) + } + if val, ok := v.([]interface{}); !ok || len(val) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("ALB", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["RuleId"]) == id { + idExist = true + return v.(map[string]interface{}), nil + } + } + + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("ALB", id)), NotFoundWithResponse, response) + } + return +} + +func (s *AlbService) AlbRuleStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeAlbRule(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["RuleStatus"]) == failState { + return object, fmt.Sprint(object["RuleStatus"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["RuleStatus"]))) + } + } + return object, fmt.Sprint(object["RuleStatus"]), nil + } +} + +func (s *AlbService) DescribeAlbHealthCheckTemplate(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewAlbClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetHealthCheckTemplateAttribute" + request := map[string]interface{}{ + "HealthCheckTemplateId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-16"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"ResourceNotFound.HealthCheckTemplate"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("ALB:HealthCheckTemplate", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_alidns.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_alidns.go index d6a90a59f8e..10b0a096212 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_alidns.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_alidns.go @@ -254,3 +254,234 @@ func (s *AlidnsService) QueryAvailableInstances(id string) (object map[string]in object = res[0].(map[string]interface{}) return object, nil } + +func (s *AlidnsService) DescribeAlidnsCustomLine(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewAlidnsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeCustomLine" + request := map[string]interface{}{ + "LineId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-01-09"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"DnsCustomLine.NotExists"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("Alidns::CustomLine", id)), NotFoundMsg, ProviderERROR) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *AlidnsService) DescribeCustomLine(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewAlidnsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeCustomLine" + request := map[string]interface{}{ + "LineId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-01-09"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"DnsCustomLine.NotExists"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("Alidns::CustomLine", id)), NotFoundMsg, ProviderERROR) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *AlidnsService) DescribeAlidnsGtmInstance(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewAlidnsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeDnsGtmInstance" + request := map[string]interface{}{ + "InstanceId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-01-09"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"DnsGtmInstance.NotExists"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("Alidns:GtmInstance", id)), NotFoundWithResponse, response) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *AlidnsService) DescribeAlidnsAddressPool(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewAlidnsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeDnsGtmInstanceAddressPool" + request := map[string]interface{}{ + "AddrPoolId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-01-09"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"DnsGtmAddrPool.NotExists"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("Alidns::AddressPool", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *AlidnsService) DescribeAlidnsAccessStrategy(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewAlidnsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeDnsGtmAccessStrategy" + request := map[string]interface{}{ + "StrategyId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-01-09"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"DnsGtmAccessStrategy.NotExists"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("Alidns:DnsGtmAccessStrategy", id)), NotFoundWithResponse, response) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *AlidnsService) DescribeAlidnsMonitorConfig(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewAlidnsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeDnsGtmMonitorConfig" + request := map[string]interface{}{ + "MonitorConfigId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-01-09"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_alikafka.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_alikafka.go index 8b16f1b9c8c..97950fade46 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_alikafka.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_alikafka.go @@ -6,6 +6,9 @@ import ( "strings" "time" + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" @@ -735,6 +738,29 @@ func (s *AlikafkaService) ignoreTag(t alikafka.TagResource) bool { return false } +func (s *AlikafkaService) tagVOTagsToMap(tags []alikafka.TagVO) map[string]string { + result := make(map[string]string) + for _, t := range tags { + if !s.tagVOIgnoreTag(t) { + result[t.Key] = t.Value + } + } + return result +} + +func (s *AlikafkaService) tagVOIgnoreTag(t alikafka.TagVO) bool { + filter := []string{"^aliyun", "^acs:", "^http://", "^https://"} + for _, v := range filter { + log.Printf("[DEBUG] Matching prefix %v with %v\n", v, t.Key) + ok, _ := regexp.MatchString(v, t.Key) + if ok { + log.Printf("[DEBUG] Found Alibaba Cloud specific t %s (val: %s), ignoring.\n", t.Key, t.Value) + return true + } + } + return false +} + func (s *AlikafkaService) diffTags(oldTags, newTags []alikafka.TagResourcesTag) ([]alikafka.TagResourcesTag, []alikafka.TagResourcesTag) { // First, we're creating everything we have create := make(map[string]interface{}) @@ -766,3 +792,37 @@ func (s *AlikafkaService) tagsFromMap(m map[string]interface{}) []alikafka.TagRe return result } + +func (s *AlikafkaService) GetAllowedIpList(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewAlikafkaClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetAllowedIpList" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "InstanceId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-16"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_amqp_open.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_amqp_open.go index 1dca43da7b2..584fbd71579 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_amqp_open.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_amqp_open.go @@ -277,3 +277,66 @@ func (s *AmqpOpenService) AmqpInstanceStateRefreshFunc(id string, failStates []s return object, fmt.Sprint(object["Status"]), nil } } + +func (s *AmqpOpenService) DescribeAmqpBinding(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewOnsproxyClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListBindings" + parts, err := ParseResourceId(id, 4) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "InstanceId": parts[0], + "VirtualHost": parts[1], + "MaxResults": 100, + } + idExist := false + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("GET"), StringPointer("2019-12-12"), StringPointer("AK"), request, nil, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Data.Bindings", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Data.Bindings", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("Amqp", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["SourceExchange"]) == parts[2] { + idExist = true + return v.(map[string]interface{}), nil + } + } + + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("Amqp", id)), NotFoundWithResponse, response) + } + return +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_arms.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_arms.go index 0b3cb28b18f..e87cf987314 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_arms.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_arms.go @@ -102,3 +102,96 @@ func (s *ArmsService) DescribeArmsAlertContactGroup(id string) (object map[strin object = v.([]interface{})[0].(map[string]interface{}) return object, nil } + +func (s *ArmsService) DescribeArmsDispatchRule(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewArmsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeDispatchRule" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "Id": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-08-08"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"50003"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("ARMS", id)), NotFoundWithResponse, response) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.DispatchRule", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.DispatchRule", response) + } + return v.(map[string]interface{}), nil +} + +func (s *ArmsService) DescribeArmsPrometheusAlertRule(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewArmsClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListPrometheusAlertRules" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "ClusterId": parts[0], + } + idExist := false + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-08-08"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.PrometheusAlertRules", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.PrometheusAlertRules", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("ARMS", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["AlertId"]) == parts[1] { + idExist = true + return v.(map[string]interface{}), nil + } + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("ARMS", id)), NotFoundWithResponse, response) + } + return object, nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_bss_open_api.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_bss_open_api.go index 2b2cdcb6d3a..021d25fc7d6 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_bss_open_api.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_bss_open_api.go @@ -14,7 +14,7 @@ type BssOpenApiService struct { client *connectivity.AliyunClient } -func (s *BssOpenApiService) QueryAvailableInstances(id, productCode, productType string) (object map[string]interface{}, err error) { +func (s *BssOpenApiService) QueryAvailableInstances(id, productCode, productType, productTypeIntl string) (object map[string]interface{}, err error) { var response map[string]interface{} conn, err := s.client.NewBssopenapiClient() if err != nil { @@ -39,6 +39,9 @@ func (s *BssOpenApiService) QueryAvailableInstances(id, productCode, productType } if IsExpectedErrors(err, []string{"NotApplicable"}) { conn.Endpoint = String(connectivity.BssOpenAPIEndpointInternational) + if len(productTypeIntl) != 0 { + request["ProductType"] = productTypeIntl + } return resource.RetryableError(err) } return resource.NonRetryableError(err) @@ -66,3 +69,55 @@ func (s *BssOpenApiService) QueryAvailableInstances(id, productCode, productType object = v.([]interface{})[0].(map[string]interface{}) return object, nil } + +func (s *BssOpenApiService) QueryAvailableInstance(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewBssopenapiClient() + if err != nil { + return nil, WrapError(err) + } + action := "QueryAvailableInstances" + request := map[string]interface{}{ + "InstanceIDs": id, + "ProductCode": "vipcloudfw", + "ProductType": "vipcloudfw", + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-12-14"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + if IsExpectedErrors(err, []string{"NotApplicable"}) { + conn.Endpoint = String(connectivity.BssOpenAPIEndpointInternational) + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Code"]) != "Success" { + return object, WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + v, err := jsonpath.Get("$.Data.InstanceList", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Data.InstanceList", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("Amqp", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["InstanceID"]) != id { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudFirewall", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_bssopenapi.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_bssopenapi.go index 5a8b623dbe7..29136a5246e 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_bssopenapi.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_bssopenapi.go @@ -81,7 +81,7 @@ func (b *BssopenapiService) GetInstanceTypePrice(productCode, productType string return priceList, nil } -func (b *BssopenapiService) getSubscriptionData(request *bssopenapi.GetSubscriptionPriceRequest) (*bssopenapi.Data, error) { +func (b *BssopenapiService) getSubscriptionData(request *bssopenapi.GetSubscriptionPriceRequest) (*bssopenapi.DataInGetSubscriptionPrice, error) { request.OrderType = "NewOrder" request.SubscriptionType = "Subscription" request.RegionId = string(connectivity.Hangzhou) @@ -119,7 +119,7 @@ func (b *BssopenapiService) getSubscriptionData(request *bssopenapi.GetSubscript return &response.Data, nil } -func (b *BssopenapiService) getPayAsYouGoData(request *bssopenapi.GetPayAsYouGoPriceRequest) (*bssopenapi.Data, error) { +func (b *BssopenapiService) getPayAsYouGoData(request *bssopenapi.GetPayAsYouGoPriceRequest) (*bssopenapi.DataInGetPayAsYouGoPrice, error) { request.SubscriptionType = "PayAsYouGo" request.RegionId = string(connectivity.Hangzhou) var response *bssopenapi.GetPayAsYouGoPriceResponse diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_cddc.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_cddc.go index 7a64b48de98..08af171827f 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_cddc.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_cddc.go @@ -8,6 +8,7 @@ import ( util "github.com/alibabacloud-go/tea-utils/service" "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) type CddcService struct { @@ -57,3 +58,269 @@ func (s *CddcService) DescribeCddcDedicatedHostGroup(id string) (object map[stri object = v.([]interface{})[0].(map[string]interface{}) return object, nil } + +func (s *CddcService) ListTagResources(id string, resourceType string) (object interface{}, err error) { + conn, err := s.client.NewCddcClient() + if err != nil { + return nil, WrapError(err) + } + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + action := "ListTagResources" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "ResourceType": resourceType, + "ResourceId.1": parts[1], + } + tags := make([]interface{}, 0) + var response map[string]interface{} + + for { + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-03-20"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + addDebug(action, response, request) + v, err := jsonpath.Get("$.TagResources", response) + if err != nil { + return resource.NonRetryableError(WrapErrorf(err, FailedGetAttributeMsg, id, "$.TagResources", response)) + } + if v != nil { + tags = append(tags, v.([]interface{})...) + } + return nil + }) + if err != nil { + err = WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + return + } + if response["NextToken"] == nil { + break + } + request["NextToken"] = response["NextToken"] + } + + return tags, nil +} + +func (s *CddcService) SetResourceTags(d *schema.ResourceData, resourceType string) error { + + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + if d.HasChange("tags") { + added, removed := parsingTags(d) + conn, err := s.client.NewCddcClient() + if err != nil { + return WrapError(err) + } + + removedTagKeys := make([]string, 0) + for _, v := range removed { + if !ignoredTags(v, "") { + removedTagKeys = append(removedTagKeys, v) + } + } + if len(removedTagKeys) > 0 { + action := "UntagResources" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "ResourceType": resourceType, + "ResourceId.1": parts[1], + } + for i, key := range removedTagKeys { + request[fmt.Sprintf("TagKey.%d", i+1)] = key + } + wait := incrementalWait(2*time.Second, 1*time.Second) + err := resource.Retry(10*time.Minute, func() *resource.RetryError { + response, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-03-20"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + + } + return resource.NonRetryableError(err) + } + addDebug(action, response, request) + return nil + }) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + if len(added) > 0 { + action := "TagResources" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "ResourceType": resourceType, + "ResourceId.1": parts[1], + } + count := 1 + for key, value := range added { + request[fmt.Sprintf("Tag.%d.Key", count)] = key + request[fmt.Sprintf("Tag.%d.Value", count)] = value + count++ + } + + wait := incrementalWait(2*time.Second, 1*time.Second) + err := resource.Retry(10*time.Minute, func() *resource.RetryError { + response, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-03-20"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + + } + return resource.NonRetryableError(err) + } + addDebug(action, response, request) + return nil + }) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + d.SetPartial("tags") + } + return nil +} + +func (s *CddcService) DescribeCddcDedicatedHost(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewCddcClient() + if err != nil { + return nil, WrapError(err) + } + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + action := "DescribeDedicatedHostAttribute" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "DedicatedHostGroupId": parts[0], + "DedicatedHostId": parts[1], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-03-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidDedicatedHostGroup.NotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("DedicatedHost", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + if fmt.Sprint(v.(map[string]interface{})["DedicatedHostId"]) != parts[1] { + return object, WrapErrorf(Error(GetNotFoundMessage("CDDC", id)), NotFoundWithResponse, response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *CddcService) CddcDedicatedHostStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeCddcDedicatedHost(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["HostStatus"]) == failState { + return object, fmt.Sprint(object["HostStatus"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["HostStatus"]))) + } + } + return object, fmt.Sprint(object["HostStatus"]), nil + } +} +func (s *CddcService) DescribeCddcDedicatedHostAccount(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewCddcClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeDedicatedHosts" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "DedicatedHostId": parts[0], + "PageSize": PageSizeMedium, + } + idExist := false + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-03-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.DedicatedHosts.DedicatedHosts", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.DedicatedHosts.DedicatedHosts", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("CDDC", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["AccountName"]) == parts[1] { + idExist = true + return v.(map[string]interface{}), nil + } + } + if len(v.([]interface{})) < request["PageSize"].(int) { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("CDDC", id)), NotFoundWithResponse, response) + } + return +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_cdn.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_cdn.go index 1accd334688..5736a603ccd 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_cdn.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_cdn.go @@ -221,3 +221,62 @@ func (c *CdnService) CdnDomainConfigRefreshFunc(id string, failStates []string) return val, fmt.Sprint(val["Status"]), nil } } + +func (s *CdnService) DescribeCdnRealTimeLogDelivery(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewCdnClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeDomainRealtimeLogDelivery" + request := map[string]interface{}{ + "Domain": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("GET"), StringPointer("2018-05-10"), StringPointer("AK"), request, nil, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"Domain.NotFound", "InternalError"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("CDN:RealTimeLogDelivery", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *CdnService) CdnRealTimeLogDeliveryStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeCdnRealTimeLogDelivery(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["Status"]) == failState { + return object, fmt.Sprint(object["Status"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["Status"]))) + } + } + return object, fmt.Sprint(object["Status"]), nil + } +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_clickhouse.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_clickhouse.go new file mode 100644 index 00000000000..2261e7342f6 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_clickhouse.go @@ -0,0 +1,244 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +type ClickhouseService struct { + client *connectivity.AliyunClient +} + +func (s *ClickhouseService) DescribeClickHouseDbCluster(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewClickhouseClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeDBClusterAttribute" + request := map[string]interface{}{ + "DBClusterId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-11"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidDBClusterId.NotFound"}) { + return nil, WrapErrorf(err, NotFoundMsg, AlibabaCloudSdkGoERROR) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.DBCluster", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.DBCluster", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *ClickhouseService) ClickHouseDbClusterStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeClickHouseDbCluster(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if object["DBClusterStatus"].(string) == failState { + return object, object["DBClusterStatus"].(string), WrapError(Error(FailedToReachTargetStatus, object["DBClusterStatus"].(string))) + } + } + return object, object["DBClusterStatus"].(string), nil + } +} + +func (s *ClickhouseService) DescribeClickHouseAccount(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewClickhouseClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeAccounts" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "AccountName": parts[1], + "DBClusterId": parts[0], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-11"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if IsExpectedErrors(err, []string{"IncorrectAccountStatus", "IncorrectDBInstanceState"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidDBClusterId.NotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("ClickHouse", id)), NotFoundWithResponse, response) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Accounts.Account", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Accounts.Account", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("ClickHouse", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["AccountName"]) != parts[1] { + return object, WrapErrorf(Error(GetNotFoundMessage("ClickHouse", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *ClickhouseService) ClickhouseStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeClickHouseAccount(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + if object != nil { + for _, failState := range failStates { + if object["AccountStatus"].(string) == failState { + return object, object["AccountStatus"].(string), WrapError(Error(FailedToReachTargetStatus, object["AccountStatus"].(string))) + } + } + return object, object["AccountStatus"].(string), nil + } + + return nil, "", WrapErrorf(Error(GetNotFoundMessage("ClickHouse:Account", id)), NotFoundMsg, ProviderERROR) + } +} + +func (s *ClickhouseService) DescribeDBClusterAccessWhiteList(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewClickhouseClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeDBClusterAccessWhiteList" + request := map[string]interface{}{ + "DBClusterId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-11"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.DBClusterAccessWhiteList.IPArray", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *ClickhouseService) DescribeClickHouseBackupPolicy(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewClickhouseClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeBackupPolicy" + request := map[string]interface{}{ + "DBClusterId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-11"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidDBClusterId.NotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("ClickHouse", id)), NotFoundWithResponse, response) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *ClickhouseService) ClickHouseBackupPolicyStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeClickHouseBackupPolicy(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["Switch"]) == failState { + return object, fmt.Sprint(object["Switch"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["Switch"]))) + } + } + return object, fmt.Sprint(object["Switch"]), nil + } +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_cloudauth.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_cloudauth.go new file mode 100644 index 00000000000..f4496db2300 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_cloudauth.go @@ -0,0 +1,60 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +type CloudauthService struct { + client *connectivity.AliyunClient +} + +func (s *CloudauthService) DescribeCloudauthFaceConfig(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewCloudauthClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeFaceConfig" + request := map[string]interface{}{ + "Lang": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-03-07"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Items", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Items", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("Cloudauth", id)), NotFoundWithResponse, response) + } else { + for _, obj := range v.([]interface{}) { + if fmt.Sprint(obj.(map[string]interface{})["BizType"]) == id { + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil + } + } + return object, WrapErrorf(Error(GetNotFoundMessage("Cloudauth", id)), NotFoundWithResponse, response) + } +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_cloudsso.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_cloudsso.go new file mode 100644 index 00000000000..46bee955800 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_cloudsso.go @@ -0,0 +1,867 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +type CloudssoService struct { + client *connectivity.AliyunClient +} + +func (s *CloudssoService) GetDirectory(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewCloudssoClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetDirectory" + request := map[string]interface{}{ + "DirectoryId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"EntityNotExists.Directory"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudSSO:Directory", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Directory", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Directory", response) + } + object = v.(map[string]interface{}) + return object, nil +} +func (s *CloudssoService) GetMFAAuthenticationStatus(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewCloudssoClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetMFAAuthenticationStatus" + request := map[string]interface{}{ + "DirectoryId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"EntityNotExists.Directory"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudSSO:Directory", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} +func (s *CloudssoService) GetSCIMSynchronizationStatus(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewCloudssoClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetSCIMSynchronizationStatus" + request := map[string]interface{}{ + "DirectoryId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"EntityNotExists.Directory"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudSSO:Directory", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} +func (s *CloudssoService) GetDirectoryTasks(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewCloudssoClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListTasks" + request := map[string]interface{}{ + "DirectoryId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"EntityNotExists.Directory"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudSSO:Directory", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Tasks", response) + } + + object = v.(map[string]interface{}) + return object, nil +} +func (s *CloudssoService) GetExternalSAMLIdentityProvider(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewCloudssoClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetExternalSAMLIdentityProvider" + request := map[string]interface{}{ + "DirectoryId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"EntityNotExists.Directory"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudSSO:Directory", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.SAMLIdentityProviderConfiguration", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.SAMLIdentityProviderConfiguration", response) + } + object = v.(map[string]interface{}) + return object, nil +} +func (s *CloudssoService) DescribeCloudSsoDirectory(id string) (object map[string]interface{}, err error) { + + getDirectoryObject, err := s.GetDirectory(id) + getMFAAuthenticationStatusObject, err := s.GetMFAAuthenticationStatus(id) + if err != nil { + return nil, err + } + getSCIMSynchronizationStatusObject, err := s.GetSCIMSynchronizationStatus(id) + if err != nil { + return nil, err + } + getExternalSAMLIdentityProviderObject, err := s.GetExternalSAMLIdentityProvider(id) + if err != nil { + return nil, err + } + getDirectoryObject["MFAAuthenticationStatus"] = getMFAAuthenticationStatusObject["MFAAuthenticationStatus"] + getDirectoryObject["SCIMSynchronizationStatus"] = getSCIMSynchronizationStatusObject["SCIMSynchronizationStatus"] + getDirectoryObject["SAMLIdentityProviderConfiguration"] = getExternalSAMLIdentityProviderObject + + return getDirectoryObject, nil +} + +func (s *CloudssoService) DescribeCloudSsoScimServerCredential(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewCloudssoClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListSCIMServerCredentials" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "DirectoryId": parts[0], + } + idExist := false + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"EntityNotExists.Directory"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudSSO:SCIMServerCredential", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.SCIMServerCredentials", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.SCIMServerCredentials", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudSSO", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["CredentialId"]) == parts[1] { + idExist = true + return v.(map[string]interface{}), nil + } + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudSSO", id)), NotFoundWithResponse, response) + } + return object, nil +} + +func (s *CloudssoService) DescribeCloudSsoGroup(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewCloudssoClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetGroup" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "DirectoryId": parts[0], + "GroupId": parts[1], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"EntityNotExists.Group"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudSSO:Group", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Group", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Group", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *CloudssoService) DescribeCloudSsoUser(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewCloudssoClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetUser" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "DirectoryId": parts[0], + "UserId": parts[1], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"EntityNotExists.User"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudSSO:User", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.User", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.User", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *CloudssoService) ListMFADevicesForUser(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewCloudssoClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListMFADevicesForUser" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "DirectoryId": parts[0], + "UserId": parts[1], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"EntityNotExists.Directory", "EntityNotExists.User"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudSSO:User", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.MFADevices", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *CloudssoService) DescribeCloudSsoAccessConfiguration(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewCloudssoClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetAccessConfiguration" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "AccessConfigurationId": parts[1], + "DirectoryId": parts[0], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"EntityNotExists.AccessConfiguration"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudSSO:AccessConfiguration", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.AccessConfiguration", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.AccessConfiguration", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *CloudssoService) ListPermissionPoliciesInAccessConfiguration(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewCloudssoClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListPermissionPoliciesInAccessConfiguration" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "AccessConfigurationId": parts[1], + "DirectoryId": parts[0], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"EntityNotExists.AccessConfiguration"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudSSO:AccessConfiguration", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + + return response, nil +} + +func (s *CloudssoService) DescribeCloudSsoUserAttachment(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewCloudssoClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListGroupMembers" + parts, err := ParseResourceId(id, 3) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "DirectoryId": parts[0], + "GroupId": parts[1], + "MaxResults": PageSizeLarge, + } + idExist := false + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + + if NeedRetry(err) { + + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"EntityNotExists.Directory", "EntityNotExists.Group"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudSSO:UserAttachment", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.GroupMembers", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.GroupMembers", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudSSO", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["UserId"]) == parts[2] { + idExist = true + return v.(map[string]interface{}), nil + } + } + + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudSSO", id)), NotFoundWithResponse, response) + } + return +} + +func (s *CloudssoService) DescribeCloudSsoAccessAssignment(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewCloudssoClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListAccessAssignments" + parts, err := ParseResourceId(id, 6) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "DirectoryId": parts[0], + "AccessConfigurationId": parts[1], + "TargetType": parts[2], + "TargetId": parts[3], + "PrincipalType": parts[4], + "PrincipalId": parts[5], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"EntityNotExists.Directory"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudSSO:AccessAttachment", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.AccessAssignments", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.AccessAssignments", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudSSO", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["PrincipalId"]) != parts[5] { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudSSO", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *CloudssoService) GetTaskStatus(directoryId, taskId string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewCloudssoClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetTaskStatus" + request := map[string]interface{}{ + "DirectoryId": directoryId, + "TaskId": taskId, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"EntityNotExists.Task"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudSSO", fmt.Sprint(directoryId, ":", taskId))), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, fmt.Sprint(directoryId, ":", taskId), action, AlibabaCloudSdkGoERROR) + } + + v, err := jsonpath.Get("$.TaskStatus", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, fmt.Sprint(directoryId, ":", taskId), "$.TaskStatus", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *CloudssoService) CloudssoServiceAccessAssignmentStateRefreshFunc(directoryId, taskId string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.GetTaskStatus(directoryId, taskId) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["Status"]) == failState { + return object, fmt.Sprint(object["Status"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprintf(directoryId, ":", taskId))) + } + } + return object, fmt.Sprint(object["Status"]), nil + } +} + +func (s *CloudssoService) DescribeCloudSsoAccessConfigurationProvisioning(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewCloudssoClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListAccessConfigurationProvisionings" + parts, err := ParseResourceId(id, 4) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "AccessConfigurationId": parts[1], + "DirectoryId": parts[0], + "TargetId": parts[3], + "TargetType": parts[2], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"EntityNotExists.AccessConfigurationProvisioning"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudSSO:AccessConfigurationProvisioning", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.AccessConfigurationProvisionings", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.AccessConfigurationProvisionings", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudSSO", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["TargetId"]) != parts[3] { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudSSO", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *CloudssoService) CloudssoServiceAccessConfigurationProvisioningStateRefreshFunc(directoryId, taskId string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.GetTaskStatus(directoryId, taskId) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["Status"]) == failState { + return object, fmt.Sprint(object["Status"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprintf(directoryId, ":", taskId))) + } + } + return object, fmt.Sprint(object["Status"]), nil + } +} + +func (s *CloudssoService) CloudssoServicAccessConfigurationProvisioning(directoryId, accessConfigurationId, targetType, targetId string) (err error) { + var response map[string]interface{} + action := "ProvisionAccessConfiguration" + request := make(map[string]interface{}) + conn, err := s.client.NewCloudssoClient() + if err != nil { + return WrapError(err) + } + + request["DirectoryId"] = directoryId + request["AccessConfigurationId"] = accessConfigurationId + request["TargetType"] = targetType + request["TargetId"] = targetId + + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(10*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"OperationConflict.Task"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_cloud_sso_access_configuration_provisioning", action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Tasks", response) + if err != nil || len(v.([]interface{})) < 1 { + return WrapErrorf(err, IdMsg, fmt.Sprint(directoryId, ":", accessConfigurationId, ":", targetType, ":", targetId)) + } + response = v.([]interface{})[0].(map[string]interface{}) + _, err = s.GetTaskStatus(fmt.Sprint(request["DirectoryId"]), fmt.Sprint(response["TaskId"])) + if err != nil { + if NotFoundError(err) { + return nil + } + return WrapError(err) + } + stateConf := BuildStateConf([]string{}, []string{"Success"}, 10*time.Minute, 5*time.Second, s.CloudssoServiceAccessConfigurationProvisioningStateRefreshFunc(fmt.Sprint(request["DirectoryId"]), fmt.Sprint(response["TaskId"]), []string{})) + if _, err := stateConf.WaitForState(); err != nil { + return WrapErrorf(err, IdMsg, fmt.Sprint(directoryId, ":", accessConfigurationId, ":", targetType, ":", targetId)) + } + return nil +} + +func (s *CloudssoService) DescribeCloudSsoAccessConfigurationProvisionings(directoryId, accessConfigurationId string) (objects []map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewCloudssoClient() + if err != nil { + return nil, WrapError(err) + } + + action := "ListAccessConfigurationProvisionings" + request := map[string]interface{}{ + "AccessConfigurationId": accessConfigurationId, + "DirectoryId": directoryId, + "MaxResults": PageSizeMedium, + } + + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-05-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return objects, WrapErrorf(err, DataDefaultErrorMsg, "alicloud_cloud_sso_access_configuration", action, AlibabaCloudSdkGoERROR) + } + resp, err := jsonpath.Get("$.AccessConfigurationProvisionings", response) + if err != nil { + return objects, WrapErrorf(err, FailedGetAttributeMsg, action, "$.AccessConfigurationProvisionings", response) + } + result, _ := resp.([]interface{}) + for _, v := range result { + item := v.(map[string]interface{}) + objects = append(objects, item) + } + + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + + return objects, nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_cms.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_cms.go index ec57fccd7c1..af668c27875 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_cms.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_cms.go @@ -445,7 +445,7 @@ func (s *CmsService) DescribeCmsMonitorGroup(id string) (object map[string]inter return object, nil } -func (s *CmsService) DescribeCmsMonitorGroupInstances(id string) (object map[string]interface{}, err error) { +func (s *CmsService) DescribeCmsMonitorGroupInstances(id string) (object []map[string]interface{}, err error) { var response map[string]interface{} conn, err := s.client.NewCmsClient() if err != nil { @@ -456,30 +456,150 @@ func (s *CmsService) DescribeCmsMonitorGroupInstances(id string) (object map[str "RegionId": s.client.RegionId, "GroupId": id, } + request["PageSize"] = PageSizeMedium + request["PageNumber"] = 1 + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-01-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"ResourceNotFound", "ResourceNotFoundError"}) { + err = WrapErrorf(Error(GetNotFoundMessage("CmsMonitorGroupInstances", id)), NotFoundMsg, ProviderERROR) + return object, err + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return object, WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + v, err := jsonpath.Get("$.Resources.Resource", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Resources.Resource", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("CmsMonitorGroupInstances", id)), NotFoundWithResponse, response) + } + + for _, v := range v.([]interface{}) { + object = append(object, v.(map[string]interface{})) + } + if len(v.([]interface{})) < request["PageSize"].(int) { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + + return object, nil +} +func (s *CmsService) DescribeCmsMetricRuleTemplate(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewCmsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeMetricRuleTemplateAttribute" + request := map[string]interface{}{ + "TemplateId": id, + } runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-01-01"), StringPointer("AK"), nil, request, &runtime) - if err != nil { - if IsExpectedErrors(err, []string{"ResourceNotFound", "ResourceNotFoundError"}) { - err = WrapErrorf(Error(GetNotFoundMessage("CmsMonitorGroupInstances", id)), NotFoundMsg, ProviderERROR) - return object, err + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-01-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) } - err = WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) - return object, err - } + return nil + }) addDebug(action, response, request) - if IsExpectedErrorCodes(fmt.Sprintf("%v", response["Code"]), []string{"ResourceNotFound", "ResourceNotFoundError"}) { - err = WrapErrorf(Error(GetNotFoundMessage("CmsMonitorGroupInstances", id)), NotFoundMsg, ProviderERROR) - return object, err + if err != nil { + if IsExpectedErrors(err, []string{"ResourceNotFound"}) { + return nil, WrapErrorf(Error(GetNotFoundMessage("CloudMonitorService:MetricRuleTemplate", id)), NotFoundMsg, ProviderERROR) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) } - if fmt.Sprintf(`%v`, response["Code"]) != "200" { - err = Error("DescribeMonitorGroupInstances failed for " + response["Message"].(string)) - return object, err + if fmt.Sprint(response["Success"]) == "false" { + return object, WrapError(fmt.Errorf("%s failed, response: %v", action, response)) } - v, err := jsonpath.Get("$", response) + v, err := jsonpath.Get("$.Resource", response) if err != nil { - return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Resource", response) } object = v.(map[string]interface{}) return object, nil } + +func (s *CmsService) DescribeCmsDynamicTagGroup(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewCmsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeDynamicTagRuleList" + request := map[string]interface{}{ + "TagRegionId": s.client.RegionId, + "PageSize": PageSizeLarge, + "PageNumber": 1, + } + idExist := false + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-01-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return object, WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + v, err := jsonpath.Get("$.TagGroupList.TagGroup", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.TagGroupList.TagGroup", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudMonitorService", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["DynamicTagRuleId"]) == id { + idExist = true + return v.(map[string]interface{}), nil + } + } + if len(v.([]interface{})) < request["PageSize"].(int) { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudMonitorService", id)), NotFoundWithResponse, response) + } + return +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_config.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_config.go index 7704acf9855..e4fca0a5f53 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_config.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_config.go @@ -427,3 +427,128 @@ func (s *ConfigService) ConfigRuleStateRefreshFunc(id string, failStates []strin return object, fmt.Sprint(object["ConfigRuleState"]), nil } } + +func (s *ConfigService) StopConfigRule(id string) (err error) { + var response map[string]interface{} + conn, err := s.client.NewConfigClient() + if err != nil { + return WrapError(err) + } + action := "StopConfigRules" + request := map[string]interface{}{ + "ConfigRuleIds": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("GET"), StringPointer("2019-01-08"), StringPointer("AK"), request, nil, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + return nil +} +func (s *ConfigService) ActiveConfigRule(id string) (err error) { + var response map[string]interface{} + conn, err := s.client.NewConfigClient() + if err != nil { + return WrapError(err) + } + action := "ActiveConfigRules" + request := map[string]interface{}{ + "ConfigRuleIds": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("GET"), StringPointer("2019-01-08"), StringPointer("AK"), request, nil, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + return nil +} + +func (s *ConfigService) ActiveAggregateConfigRules(id, aggregatorId string) (err error) { + var response map[string]interface{} + conn, err := s.client.NewConfigClient() + if err != nil { + return WrapError(err) + } + action := "ActiveAggregateConfigRules" + request := map[string]interface{}{ + "ConfigRuleIds": id, + "AggregatorId": aggregatorId, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("GET"), StringPointer("2020-09-07"), StringPointer("AK"), request, nil, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + return nil +} + +func (s *ConfigService) DeactiveAggregateConfigRules(id, aggregatorId string) (err error) { + var response map[string]interface{} + conn, err := s.client.NewConfigClient() + if err != nil { + return WrapError(err) + } + action := "DeactiveAggregateConfigRules" + request := map[string]interface{}{ + "ConfigRuleIds": id, + "AggregatorId": aggregatorId, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("GET"), StringPointer("2020-09-07"), StringPointer("AK"), request, nil, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_cr.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_cr.go index 3f71da9df3d..e61066b8183 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_cr.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_cr.go @@ -2,9 +2,12 @@ package alicloud import ( "encoding/json" + "fmt" "strings" "time" + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" "github.com/aliyun/alibaba-cloud-sdk-go/services/cr" "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" @@ -257,3 +260,210 @@ func (c *CrService) InstanceStatusRefreshFunc(id string, failStates []string) re return resp, resp.InstanceStatus, nil } } + +func (s *CrService) DescribeCrEndpointAclPolicy(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewAcrClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetInstanceEndpoint" + parts, err := ParseResourceId(id, 3) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "EndpointType": parts[1], + "InstanceId": parts[0], + } + idExist := false + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-12-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.AclEntries", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.AclEntries", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("CR", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["Entry"]) == parts[2] { + idExist = true + return v.(map[string]interface{}), nil + } + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("CR", id)), NotFoundWithResponse, response) + } + return object, nil +} + +func (s *CrService) DescribeCrEndpointAclService(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewAcrClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetInstanceEndpoint" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "EndpointType": parts[1], + "InstanceId": parts[0], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-12-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *CrService) CrEndpointAclServiceStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeCrEndpointAclService(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["Status"]) == failState { + return object, fmt.Sprint(object["Status"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["Status"]))) + } + } + return object, fmt.Sprint(object["Status"]), nil + } +} + +func (s *CrService) DescribeCrChartNamespace(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewAcrClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetChartNamespace" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "InstanceId": parts[0], + "NamespaceName": parts[1], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-12-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if IsExpectedErrorCodes(fmt.Sprint(response["Code"]), []string{"CHART_NAMESPACE_NOT_EXIST"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("CR", id)), NotFoundWithResponse, response) + } + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} +func (s *CrService) DescribeCrChartRepository(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewAcrClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetChartRepository" + parts, err := ParseResourceId(id, 3) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "RepoName": parts[2], + "RepoNamespaceName": parts[1], + "InstanceId": parts[0], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-12-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if IsExpectedErrorCodes(fmt.Sprint(response["Code"]), []string{"CHART_REPO_NOT_EXIST"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("CR", id)), NotFoundWithResponse, response) + } + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_cs.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_cs.go index 504bc448dc7..c4e87f10abe 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_cs.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_cs.go @@ -7,6 +7,8 @@ import ( "strings" "time" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/alibabacloud-go/tea/tea" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" @@ -29,6 +31,16 @@ type CsClient struct { client *client.Client } +type Component struct { + ComponentName string `json:"component_name"` + Version string `json:"version"` + NextVersion string `json:"next_version"` + CanUpgrade bool `json:"can_upgrade"` + Required bool `json:"required"` + Status string `json:"status"` + ErrMessage string `json:"err_message"` +} + const ( COMPONENT_AUTO_SCALER = "cluster-autoscaler" COMPONENT_DEFAULT_VRESION = "v1.0.0" @@ -186,6 +198,236 @@ func (s *CsService) DescribeCsKubernetes(id string) (cluster *cs.KubernetesClust return } +// This function returns the latest addon status information +func (s *CsClient) DescribeCsKubernetesAddonStatus(clusterId string, addonName string) (*Component, error) { + result := &Component{} + + resp, err := s.client.DescribeClusterAddonsUpgradeStatus(&clusterId, &client.DescribeClusterAddonsUpgradeStatusRequest{ + ComponentIds: []*string{tea.String(addonName)}, + }) + if err != nil { + return nil, WrapErrorf(err, DefaultErrorMsg, ResourceAlicloudCSKubernetesAddon, "DescribeClusterAddonsUpgradeStatus", err) + } + + addon, ok := resp.Body[addonName] + if !ok { + return nil, WrapErrorf(Error(ResourceNotfound), DefaultErrorMsg, ResourceAlicloudCSKubernetesAddon, "DescribeClusterAddonsUpgradeStatus") + } + + addonInfo := addon.(map[string]interface{})["addon_info"] + tasks := addon.(map[string]interface{})["tasks"] + result.Version = addonInfo.(map[string]interface{})["version"].(string) + result.CanUpgrade = addon.(map[string]interface{})["can_upgrade"].(bool) + result.Status = tasks.(map[string]interface{})["status"].(string) + if message, ok := tasks.(map[string]interface{})["message"]; ok { + result.ErrMessage = message.(string) + } + + return result, nil +} + +// This function returns the latest multiple addons status information +func (s *CsClient) DescribeCsKubernetesAllAddonsStatus(clusterId string, addons []*string) (map[string]*Component, error) { + addonsStatus := make(map[string]*Component) + resp, err := s.client.DescribeClusterAddonsUpgradeStatus(&clusterId, &client.DescribeClusterAddonsUpgradeStatusRequest{ + ComponentIds: addons, + }) + if err != nil { + return nil, WrapErrorf(err, DefaultErrorMsg, ResourceAlicloudCSKubernetesAddon, "DescribeClusterAddonsUpgradeStatus", err) + } + + for name, status := range resp.Body { + c := &Component{} + addonInfo := status.(map[string]interface{})["addon_info"] + tasks := status.(map[string]interface{})["tasks"] + c.Version = addonInfo.(map[string]interface{})["version"].(string) + c.CanUpgrade = status.(map[string]interface{})["can_upgrade"].(bool) + c.Status = tasks.(map[string]interface{})["status"].(string) + if message, ok := tasks.(map[string]interface{})["message"]; ok { + c.ErrMessage = message.(string) + } + + addonsStatus[name] = c + } + + return addonsStatus, nil +} + +// This function returns all available addons metadata of the cluster +func (s *CsClient) DescribeClusterAddonsMetadata(clusterId string) (map[string]*Component, error) { + result := make(map[string]*Component) + + resp, err := s.client.DescribeClusterAddonsVersion(&clusterId) + if err != nil { + return nil, WrapErrorf(err, DefaultErrorMsg, ResourceAlicloudCSKubernetesAddon, "DescribeClusterAddonsVersion", err) + } + + for name, addon := range resp.Body { + fields := addon.(map[string]interface{}) + version := fields["version"].(string) + nextVersion := fields["next_version"].(string) + canUpgrade := fields["can_upgrade"].(bool) + required := fields["required"].(bool) + c := &Component{ + ComponentName: name, + Version: version, + NextVersion: nextVersion, + CanUpgrade: canUpgrade, + Required: required, + } + result[name] = c + } + + return result, nil +} + +func (s *CsClient) DescribeCsKubernetesAddon(id string) (*Component, error) { + parts, err := ParseResourceId(id, 2) + if err != nil { + return nil, WrapError(err) + } + clusterId := parts[0] + addonName := parts[1] + addonsMetadata, err := s.DescribeClusterAddonsMetadata(clusterId) + if err != nil { + return nil, err + } + + addonStatus, err := s.DescribeCsKubernetesAddonStatus(clusterId, addonName) + if err != nil { + return nil, WrapErrorf(err, DefaultErrorMsg, ResourceAlicloudCSKubernetesAddon, "DescribeCsKubernetesAddonStatus", err) + } + + // Update some fields + if addon, existed := addonsMetadata[addonName]; existed { + addon.Version = addonStatus.Version + addon.Status = addonStatus.Status + addon.CanUpgrade = addonStatus.CanUpgrade + addon.ErrMessage = addonStatus.ErrMessage + return addon, nil + } + + return nil, WrapErrorf(Error(ResourceNotfound), DefaultErrorMsg, ResourceAlicloudCSKubernetesAddon, "DescribeCsKubernetesAddon") +} + +func (s *CsClient) CsKubernetesAddonStateRefreshFunc(clusterId string, addonName string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeCsKubernetesAddonStatus(clusterId, addonName) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + for _, failState := range failStates { + if object.Status == failState { + return object, object.Status, WrapError(Error(FailedToReachTargetStatusWithResponse, object.Status, object.ErrMessage)) + } + } + return object, object.Status, nil + } +} + +func (s *CsClient) installAddon(d *schema.ResourceData) error { + clusterId := d.Get("cluster_id").(string) + + body := make([]*client.InstallClusterAddonsRequestBody, 0) + b := &client.InstallClusterAddonsRequestBody{ + Name: tea.String(d.Get("name").(string)), + Version: tea.String(d.Get("version").(string)), + } + body = append(body, b) + + creationArgs := &client.InstallClusterAddonsRequest{ + Body: body, + } + + _, err := s.client.InstallClusterAddons(&clusterId, creationArgs) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, ResourceAlicloudCSKubernetesAddon, "installAddon", err) + } + + return nil +} + +func (s *CsClient) upgradeAddon(d *schema.ResourceData) error { + clusterId := d.Get("cluster_id").(string) + + body := make([]*client.UpgradeClusterAddonsRequestBody, 0) + b := &client.UpgradeClusterAddonsRequestBody{ + ComponentName: tea.String(d.Get("name").(string)), + NextVersion: tea.String(d.Get("version").(string)), + } + body = append(body, b) + + upgradeArgs := &client.UpgradeClusterAddonsRequest{ + Body: body, + } + + _, err := s.client.UpgradeClusterAddons(&clusterId, upgradeArgs) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, ResourceAlicloudCSKubernetesAddon, "upgradeAddon", err) + } + + return nil +} + +func (s *CsClient) uninstallAddon(d *schema.ResourceData) error { + parts, err := ParseResourceId(d.Id(), 2) + if err != nil { + return WrapError(err) + } + clusterId := parts[0] + + body := make([]*client.UnInstallClusterAddonsRequestAddons, 0) + b := &client.UnInstallClusterAddonsRequestAddons{ + Name: tea.String(parts[1]), + } + body = append(body, b) + + uninstallArgs := &client.UnInstallClusterAddonsRequest{ + Addons: body, + } + + _, err = s.client.UnInstallClusterAddons(&clusterId, uninstallArgs) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, ResourceAlicloudCSKubernetesAddon, "uninstallAddon", err) + } + + return nil +} + +// This function returns the status of all available addons of the cluster +func (s *CsClient) DescribeCsKubernetesAllAvailableAddons(clusterId string) (map[string]*Component, error) { + availableAddons, err := s.DescribeClusterAddonsMetadata(clusterId) + if err != nil { + return nil, err + } + + queryList := make([]*string, 0) + for name := range availableAddons { + queryList = append(queryList, tea.String(name)) + } + + status, err := s.DescribeCsKubernetesAllAddonsStatus(clusterId, queryList) + if err != nil { + return nil, WrapErrorf(err, DefaultErrorMsg, ResourceAlicloudCSKubernetesAddon, "DescribeCsKubernetesExistedAddons", err) + } + + for name, addon := range availableAddons { + if _, ok := status[name]; !ok { + continue + } + addon.Version = status[name].Version + addon.Status = status[name].Status + addon.CanUpgrade = status[name].CanUpgrade + addon.ErrMessage = status[name].ErrMessage + } + + return availableAddons, nil +} + func (s *CsService) DescribeCsKubernetesNodePool(id string) (nodePool *cs.NodePoolDetail, err error) { invoker := NewInvoker() var requestInfo *cs.Client diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_dbfs.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_dbfs.go new file mode 100644 index 00000000000..0d13efb35b2 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_dbfs.go @@ -0,0 +1,91 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +type DbfsService struct { + client *connectivity.AliyunClient +} + +func (s *DbfsService) DescribeDbfsInstance(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewDbfsClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListDbfs" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "PageNumber": 1, + "PageSize": PageSizeLarge, + } + idExist := false + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-04-18"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.DBFSInfo", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.DBFSInfo", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("DBFS", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["FsId"]) == id { + idExist = true + return v.(map[string]interface{}), nil + } + } + if len(v.([]interface{})) < request["PageSize"].(int) { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("DBFS", id)), NotFoundWithResponse, response) + } + return +} + +func (s *DbfsService) DbfsInstanceStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeDbfsInstance(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["Status"]) == failState { + return object, fmt.Sprint(object["Status"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["Status"]))) + } + } + return object, fmt.Sprint(object["Status"]), nil + } +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_devops_rdc.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_devops_rdc.go new file mode 100644 index 00000000000..456207f875d --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_devops_rdc.go @@ -0,0 +1,107 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +type DevopsRdcService struct { + client *connectivity.AliyunClient +} + +func (s *DevopsRdcService) ListUserOrganization(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewDevopsrdcClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListUserOrganization" + request := map[string]interface{}{} + idExist := false + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-03-03"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Object", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Object", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("RDC", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["Id"]) == id { + idExist = true + return v.(map[string]interface{}), nil + } + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("RDC", id)), NotFoundWithResponse, response) + } + return object, nil +} + +func (s *DevopsRdcService) DescribeRdcOrganization(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewDevopsrdcClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListUserOrganization" + request := map[string]interface{}{} + idExist := false + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-03-03"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Object", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Object", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("RDC", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["Id"]) == id { + idExist = true + return v.(map[string]interface{}), nil + } + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("RDC", id)), NotFoundWithResponse, response) + } + return object, nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_dfs.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_dfs.go new file mode 100644 index 00000000000..0ef33396df9 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_dfs.go @@ -0,0 +1,227 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +type DfsService struct { + client *connectivity.AliyunClient +} + +func (s *DfsService) DescribeDfsAccessGroup(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewAlidfsClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetAccessGroup" + request := map[string]interface{}{ + "InputRegionId": s.client.RegionId, + "AccessGroupId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-06-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidParameter.AccessGroupNotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("DFS:AccessGroup", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.AccessGroup", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.AccessGroup", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *DfsService) GetAccessGroup(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewAlidfsClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetAccessGroup" + request := map[string]interface{}{ + "InputRegionId": s.client.RegionId, + "AccessGroupId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-06-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidParameter.AccessGroupNotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("DFS:AccessGroup", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.AccessGroup", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.AccessGroup", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *DfsService) DescribeDfsFileSystem(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewAlidfsClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetFileSystem" + request := map[string]interface{}{ + "InputRegionId": s.client.RegionId, + "FileSystemId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-06-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidParameter.FileSystemNotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("DFS:FileSystem", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.FileSystem", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.FileSystem", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *DfsService) DescribeDfsAccessRule(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewAlidfsClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetAccessRule" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "AccessGroupId": parts[0], + "AccessRuleId": parts[1], + } + request["InputRegionId"] = s.client.RegionId + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-06-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidParameter.AccessRuleNotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("DFS:AccessRule", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.AccessRule", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.AccessRule", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *DfsService) DescribeDfsMountPoint(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewAlidfsClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetMountPoint" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "InputRegionId": s.client.RegionId, + "FileSystemId": parts[0], + "MountPointId": parts[1], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-06-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidParameter.MountPointNotFound", "InvalidParameter.FileSystemNotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("DFS:MountPoint", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.MountPoint", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.MountPoint", response) + } + object = v.(map[string]interface{}) + return object, nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_dg.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_dg.go new file mode 100644 index 00000000000..632609e469f --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_dg.go @@ -0,0 +1,127 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +type DgService struct { + client *connectivity.AliyunClient +} + +func (s *DgService) DescribeDatabaseGatewayGateway(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewDgClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetUserGateways" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "PageSize": PageSizeLarge, + "PageNumber": 1, + } + idExist := false + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-03-27"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return object, WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + m, err := jsonpath.Get("$.Data", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Data", response) + } + v, err := convertJsonStringToList(m.(string)) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + if len(v) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("DatabaseGateway", id)), NotFoundWithResponse, response) + } + for _, v := range v { + if fmt.Sprint(v.(map[string]interface{})["gatewayId"]) == id { + idExist = true + return v.(map[string]interface{}), nil + } + } + if len(v) < request["PageSize"].(int) { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("DatabaseGateway", id)), NotFoundWithResponse, response) + } + return +} + +func (s *DgService) GetUserGatewayInstances(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewDgClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetUserGatewayInstances" + request := map[string]interface{}{ + "GatewayId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-03-27"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return object, WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + m, err := jsonpath.Get("$.Data", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Data", response) + } + v, err := convertJsonStringToList(m.(string)) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + if len(v) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("DatabaseGateway", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v[0].(map[string]interface{})["gatewayId"]) != id { + return object, WrapErrorf(Error(GetNotFoundMessage("DatabaseGateway", id)), NotFoundWithResponse, response) + } + } + return object, nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_dm.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_dm.go index 429ce733df6..084f84fc2ed 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_dm.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_dm.go @@ -1,6 +1,7 @@ package alicloud import ( + "fmt" "time" "github.com/PaesslerAG/jsonpath" @@ -68,3 +69,188 @@ func (s *DmService) DescribeDirectMailReceivers(id string) (object map[string]in } return } +func (s *DmService) DescribeDirectMailDomain(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewDmClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescDomain" + request := map[string]interface{}{ + "DomainId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-11-23"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidDomainId.NotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("DirectMail:Domain", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} +func (s *DmService) DescDomain(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewDmClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescDomain" + request := map[string]interface{}{ + "DomainId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-11-23"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidDomainId.NotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("DirectMail:Domain", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} +func (s *DmService) DescribeDirectMailMailAddress(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewDmClient() + if err != nil { + return nil, WrapError(err) + } + action := "QueryMailAddressByParam" + request := map[string]interface{}{ + "PageSize": PageSizeLarge, + } + idExist := false + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-11-23"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.data.mailAddress", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.data.mailAddress", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("DirectMail", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["MailAddressId"]) == id { + idExist = true + return v.(map[string]interface{}), nil + } + } + if len(v.([]interface{})) < request["PageSize"].(int) { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("DirectMail", id)), NotFoundWithResponse, response) + } + return +} +func (s *DmService) DescribeDirectMailTag(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewDmClient() + if err != nil { + return nil, WrapError(err) + } + action := "QueryTagByParam" + request := map[string]interface{}{ + "PageSize": 10, + } + idExist := false + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-11-23"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidTag.NotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("DirectMail:Tag", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.data.tag", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.data.tag", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("DirectMail", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["TagId"]) == id { + idExist = true + return v.(map[string]interface{}), nil + } + } + if len(v.([]interface{})) < request["PageSize"].(int) { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("DirectMail", id)), NotFoundWithResponse, response) + } + return +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_dts.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_dts.go new file mode 100644 index 00000000000..761062e79c0 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_dts.go @@ -0,0 +1,467 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +type DtsService struct { + client *connectivity.AliyunClient +} + +func (s *DtsService) DescribeDtsJobMonitorRule(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewDtsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeJobMonitorRule" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "DtsJobId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return object, WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *DtsService) DescribeDtsSubscriptionJob(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewDtsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeDtsJobDetail" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "DtsJobId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"Forbidden.InstanceNotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("DTS:SubscriptionJob", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return object, WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + if object["Status"] == "Starting" { + object["Status"] = "Normal" + } + return object, nil +} + +func (s *DtsService) DtsSubscriptionJobStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeDtsSubscriptionJob(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["Status"]) == failState { + return object, fmt.Sprint(object["Status"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["Status"]))) + } + } + return object, fmt.Sprint(object["Status"]), nil + } +} + +func (s *DtsService) DescribeDtsSynchronizationInstance(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewDtsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeDtsJobDetail" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "DtsInstanceID": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"Forbidden.InstanceNotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("DTS:SynchronizationInstance", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return object, WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *DtsService) ListTagResources(id string, resourceType string) (object interface{}, err error) { + conn, err := s.client.NewDtsClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListTagResources" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "ResourceType": resourceType, + "ResourceId.1": id, + } + tags := make([]interface{}, 0) + var response map[string]interface{} + + for { + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{Throttling}) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + addDebug(action, response, request) + v, err := jsonpath.Get("$.TagResources.TagResource", response) + if err != nil { + return resource.NonRetryableError(WrapErrorf(err, FailedGetAttributeMsg, id, "$.TagResources.TagResource", response)) + } + if v != nil { + tags = append(tags, v.([]interface{})...) + } + return nil + }) + if err != nil { + err = WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + return + } + if response["NextToken"] == nil { + break + } + request["NextToken"] = response["NextToken"] + } + + return tags, nil +} + +func (s *DtsService) SetResourceTags(d *schema.ResourceData, resourceType string) error { + + if d.HasChange("tags") { + added, removed := parsingTags(d) + conn, err := s.client.NewDtsClient() + if err != nil { + return WrapError(err) + } + + removedTagKeys := make([]string, 0) + for _, v := range removed { + if !ignoredTags(v, "") { + removedTagKeys = append(removedTagKeys, v) + } + } + if len(removedTagKeys) > 0 { + action := "UntagResources" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "ResourceType": resourceType, + "ResourceId.1": d.Get("dts_instance_id"), + } + for i, key := range removedTagKeys { + request[fmt.Sprintf("TagKey.%d", i+1)] = key + } + wait := incrementalWait(2*time.Second, 1*time.Second) + err := resource.Retry(10*time.Minute, func() *resource.RetryError { + response, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsThrottling(err) { + wait() + return resource.RetryableError(err) + + } + return resource.NonRetryableError(err) + } + addDebug(action, response, request) + return nil + }) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + if len(added) > 0 { + action := "TagResources" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "ResourceType": resourceType, + "ResourceId.1": d.Get("dts_instance_id"), + } + count := 1 + for key, value := range added { + request[fmt.Sprintf("Tag.%d.Key", count)] = key + request[fmt.Sprintf("Tag.%d.Value", count)] = value + count++ + } + + wait := incrementalWait(2*time.Second, 1*time.Second) + err := resource.Retry(10*time.Minute, func() *resource.RetryError { + response, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsThrottling(err) { + wait() + return resource.RetryableError(err) + + } + return resource.NonRetryableError(err) + } + addDebug(action, response, request) + return nil + }) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + d.SetPartial("tags") + } + return nil +} + +func (s *DtsService) DescribeDtsSynchronizationJob(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewDtsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeDtsJobDetail" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "DtsJobId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"Forbidden.InstanceNotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("DTS:SynchronizationJob", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return object, WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + // From startup to synchronizing, the resource goes through the pre-check and initialization phases. + // Because the initialization phase takes too long, and once it passes the pre-check, it can be considered that the task can be executed normally. + // Therefore, the initialization state is regarded as an equivalent synchronization state. + if object["Status"] == "synchronizing" || object["Status"] == "Initializing" { + object["Status"] = "Synchronizing" + } + return object, nil +} + +func (s *DtsService) DescribeDtsJobDetail(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewDtsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeDtsJobDetail" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "DtsJobId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"Forbidden.InstanceNotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("DTS:SynchronizationJob", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return object, WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *DtsService) DtsSynchronizationJobStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeDtsSynchronizationJob(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["Status"]) == failState { + return object, fmt.Sprint(object["Status"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["Status"]))) + } + } + return object, fmt.Sprint(object["Status"]), nil + } +} + +func (s *DtsService) DescribeDtsConsumerChannel(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewDtsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeConsumerChannel" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "DtsInstanceId": parts[0], + "PageSize": PageSizeMedium, + "PageNumber": 1, + } + idExist := false + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.ConsumerChannels", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.ConsumerChannels", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("DTS", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["ConsumerGroupId"]) == parts[1] { + idExist = true + return v.(map[string]interface{}), nil + } + } + if len(v.([]interface{})) < request["PageSize"].(int) { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("DTS", id)), NotFoundWithResponse, response) + } + return +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_eais.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_eais.go new file mode 100644 index 00000000000..f184fda7fc4 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_eais.go @@ -0,0 +1,79 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +type EaisService struct { + client *connectivity.AliyunClient +} + +func (s *EaisService) DescribeEaisInstance(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewEaisClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeEais" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "ElasticAcceleratedInstanceIds": "[\"" + id + "\"]", + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-24"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Instances.Instance", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Instances.Instance", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("EAIS", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["ElasticAcceleratedInstanceId"]) != id { + return object, WrapErrorf(Error(GetNotFoundMessage("EAIS", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *EaisService) EaisInstanceStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeEaisInstance(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["Status"]) == failState { + return object, fmt.Sprint(object["Status"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["Status"]))) + } + } + return object, fmt.Sprint(object["Status"]), nil + } +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_ecd.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_ecd.go index 5d2042d394e..fe9d788cfa1 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_ecd.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_ecd.go @@ -168,3 +168,507 @@ func (s *EcdService) setAuthSecurityPolicyRules(d *schema.ResourceData, request } return nil } + +func (s *EcdService) DescribeEcdSimpleOfficeSite(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewGwsecdClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeOfficeSites" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "OfficeSiteId": []string{id}, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.OfficeSites", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.OfficeSites", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("ECD", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["OfficeSiteId"]) != id { + return object, WrapErrorf(Error(GetNotFoundMessage("ECD", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *EcdService) EcdSimpleOfficeSiteStateRefreshFunc(id string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeEcdSimpleOfficeSite(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + return object, object["Status"].(string), nil + } +} + +func (s *EcdService) DescribeEcdNasFileSystem(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewGwsecdClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeNASFileSystems" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "FileSystemId": []string{id}, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.FileSystems", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.FileSystems", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("ECD", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["FileSystemId"]) != id { + return object, WrapErrorf(Error(GetNotFoundMessage("ECD", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *EcdService) DescribeEcdNetworkPackage(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewGwsecdClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeNetworkPackages" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "NetworkPackageId": []string{id}, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + + v, err := jsonpath.Get("$.NetworkPackages", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.NetworkPackages", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("ECD", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["NetworkPackageId"]) != id { + return object, WrapErrorf(Error(GetNotFoundMessage("ECD", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *EcdService) EcdNasFileSystemStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeEcdNasFileSystem(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + for _, failState := range failStates { + if fmt.Sprint(object["FileSystemStatus"]) == failState { + return object, fmt.Sprint(object["FileSystemStatus"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["FileSystemStatus"]))) + } + } + return object, fmt.Sprint(object["FileSystemStatus"]), nil + } +} + +func (s *EcdService) EcdNetworkPackageRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeEcdNetworkPackage(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["NetworkPackageStatus"]) == failState { + return object, fmt.Sprint(object["NetworkPackageStatus"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["FileSystemStatus"]))) + } + } + return object, fmt.Sprint(object["NetworkPackageStatus"]), nil + } +} + +func (s *EcdService) SetResourceTags(d *schema.ResourceData, resourceType string) error { + + if d.HasChange("tags") { + added, removed := parsingTags(d) + conn, err := s.client.NewGwsecdClient() + if err != nil { + return WrapError(err) + } + + removedTagKeys := make([]string, 0) + for _, v := range removed { + if !ignoredTags(v, "") { + removedTagKeys = append(removedTagKeys, v) + } + } + if len(removedTagKeys) > 0 { + action := "UntagResources" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "ResourceType": resourceType, + "ResourceId": []string{d.Id()}, + } + for i, key := range removedTagKeys { + request[fmt.Sprintf("TagKey.%d", i+1)] = key + } + wait := incrementalWait(2*time.Second, 1*time.Second) + err := resource.Retry(10*time.Minute, func() *resource.RetryError { + response, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsThrottling(err) { + wait() + return resource.RetryableError(err) + + } + return resource.NonRetryableError(err) + } + addDebug(action, response, request) + return nil + }) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + if len(added) > 0 { + action := "TagResources" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "ResourceType": resourceType, + "ResourceId": []string{d.Id()}, + } + count := 1 + for key, value := range added { + request[fmt.Sprintf("Tag.%d.Key", count)] = key + request[fmt.Sprintf("Tag.%d.Value", count)] = value + count++ + } + + wait := incrementalWait(2*time.Second, 1*time.Second) + err := resource.Retry(10*time.Minute, func() *resource.RetryError { + response, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsThrottling(err) { + wait() + return resource.RetryableError(err) + + } + return resource.NonRetryableError(err) + } + addDebug(action, response, request) + return nil + }) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + d.SetPartial("tags") + } + return nil +} + +func (s *EcdService) DescribeEcdDesktop(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewGwsecdClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeDesktops" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "DesktopId.1": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Desktops", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Desktops", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("ECD", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["DesktopId"]) != id { + return object, WrapErrorf(Error(GetNotFoundMessage("ECD", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *EcdService) EcdDesktopStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeEcdDesktop(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["DesktopStatus"]) == failState { + return object, fmt.Sprint(object["DesktopStatus"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["DesktopStatus"]))) + } + } + + return object, fmt.Sprint(object["DesktopStatus"]), nil + } +} + +func (s *EcdService) EcdDesktopDesktopTypeRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeEcdDesktop(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["DesktopType"]) == failState { + return object, fmt.Sprint(object["DesktopType"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["DesktopType"]))) + } + } + + return object, fmt.Sprint(object["DesktopType"]), nil + } +} + +func (s *EcdService) EcdDesktopChargeTypeFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeEcdDesktop(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(convertEcdDesktopPaymentTypeResponse(object["ChargeType"])) == failState { + return object, fmt.Sprint(object["ChargeType"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(convertEcdDesktopPaymentTypeResponse(object["DesktopStatus"])))) + } + } + + return object, fmt.Sprint(convertEcdDesktopPaymentTypeResponse(object["ChargeType"])), nil + } +} + +func (s *EcdService) DescribeEcdImage(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewGwsecdClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeImages" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "ImageId": []string{id}, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Images", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Images", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("ECD", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["ImageId"]) != id { + return object, WrapErrorf(Error(GetNotFoundMessage("ECD", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *EcdService) EcdImageStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeEcdImage(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["Status"]) == failState { + return object, fmt.Sprint(object["Status"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["Status"]))) + } + } + return object, fmt.Sprint(object["Status"]), nil + } +} + +func (s *EcdService) DescribeEcdCommand(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewGwsecdClient() + if err != nil { + return nil, WrapError(err) + } + + action := "DescribeInvocations" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "InvokeId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-09-30"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + + v, err := jsonpath.Get("$.Invocations", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Invocations", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("ECD", id)), NotFoundWithResponse, response) + } else { + + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["InvokeId"]) != id { + return object, WrapErrorf(Error(GetNotFoundMessage("ECD", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *EcdService) EcdCommandStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeEcdCommand(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + for _, failState := range failStates { + if fmt.Sprint(object["InvocationStatus"]) == failState { + return object, fmt.Sprint(object["InvocationStatus"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["InvocationStatus"]))) + } + } + return object, fmt.Sprint(object["InvocationStatus"]), nil + } +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_eci.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_eci.go index 000b15c0d81..1ff1e926ee4 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_eci.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_eci.go @@ -2,6 +2,8 @@ package alicloud import ( "encoding/json" + "fmt" + "time" "github.com/PaesslerAG/jsonpath" util "github.com/alibabacloud-go/tea-utils/service" @@ -118,3 +120,79 @@ func (s *EciService) EciContainerGroupStateRefreshFunc(id string, failStates []s return object, object["Status"].(string), nil } } + +func (s *EciService) DescribeEciVirtualNode(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewEciClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeVirtualNodes" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + } + idExist := false + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-08-08"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.VirtualNodes", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.VirtualNodes", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("ECI", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["VirtualNodeId"]) == id { + idExist = true + return v.(map[string]interface{}), nil + } + } + + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("ECI", id)), NotFoundWithResponse, response) + } + return +} + +func (s *EciService) EciVirtualNodeStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeEciVirtualNode(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["Status"]) == failState { + return object, fmt.Sprint(object["Status"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["Status"]))) + } + } + return object, fmt.Sprint(object["Status"]), nil + } +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_ecs.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_ecs.go index 88ae8cec24f..a9ba8a6ffa4 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_ecs.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_ecs.go @@ -344,6 +344,14 @@ func (s *EcsService) DescribeAvailableResources(d *schema.ResourceData, meta int request := ecs.CreateDescribeAvailableResourceRequest() request.RegionId = s.client.RegionId request.DestinationResource = string(destination) + if destination == InstanceTypeResource { + if v, ok := d.GetOk("cpu_core_count"); ok && v.(int) > 0 { + request.Cores = requests.NewInteger(v.(int)) + } + if v, ok := d.GetOk("memory_size"); ok && v.(float64) > 0 { + request.Memory = requests.NewFloat(v.(float64)) + } + } request.IoOptimized = string(IOOptimized) if v, ok := d.GetOk("availability_zone"); ok && strings.TrimSpace(v.(string)) != "" { @@ -385,7 +393,7 @@ func (s *EcsService) DescribeAvailableResources(d *schema.ResourceData, meta int requestId = response.RequestId if len(response.AvailableZones.AvailableZone) < 1 { - err = WrapError(Error("There are no availability resources in the region: %s. RequestId: %s.", client.RegionId, requestId)) + err = WrapError(Error("There are no available zones in the API DescribeAvailableResource response: %#v.", response)) return } @@ -409,19 +417,19 @@ func (s *EcsService) DescribeAvailableResources(d *schema.ResourceData, meta int } if zoneId != "" { if !valid { - err = WrapError(Error("Availability zone %s status is not available in the region %s. Expected availability zones: %s. RequestId: %s.", - zoneId, client.RegionId, strings.Join(expectedZones, ", "), requestId)) + err = WrapError(Error("Availability zone %s status is not available in the region %s. Expected availability zones: %s. \nDescribeAvailableResource response: %#v.", + zoneId, client.RegionId, strings.Join(expectedZones, ", "), response)) return } if soldout { - err = WrapError(Error("Availability zone %s status is sold out in the region %s. Expected availability zones: %s. RequestId: %s.", - zoneId, client.RegionId, strings.Join(expectedZones, ", "), requestId)) + err = WrapError(Error("Availability zone %s status is sold out in the region %s. Expected availability zones: %s. \nDescribeAvailableResource response: %#v.", + zoneId, client.RegionId, strings.Join(expectedZones, ", "), response)) return } } if len(validZones) <= 0 { - err = WrapError(Error("There is no availability resources in the region %s. Please choose another region. RequestId: %s.", client.RegionId, response.RequestId)) + err = WrapError(Error("There is no availability resources in the region %s. Please choose another region. \nDescribeAvailableResource response: %#v.", client.RegionId, response)) return } @@ -659,6 +667,35 @@ func (s *EcsService) deleteImage(d *schema.ResourceData) error { return WrapErrorf(err, IdMsg, d.Id()) } + if v, ok := d.GetOk("delete_auto_snapshot"); ok && v.(bool) { + errs := map[string]error{} + + for _, item := range object.DiskDeviceMappings.DiskDeviceMapping { + if item.SnapshotId == "" { + continue + } + request := ecs.CreateDeleteSnapshotRequest() + request.RegionId = s.client.RegionId + request.SnapshotId = item.SnapshotId + request.Force = requests.NewBoolean(true) + raw, err := s.client.WithEcsClient(func(ecsClient *ecs.Client) (interface{}, error) { + return ecsClient.DeleteSnapshot(request) + }) + if err != nil { + errs[item.SnapshotId] = err + } + addDebug(request.GetActionName(), raw, request.RpcRequest, request) + } + if len(errs) > 0 { + errParts := []string{"Errors while deleting associated snapshots:"} + for snapshotId, err := range errs { + errParts = append(errParts, fmt.Sprintf("%s: %s", snapshotId, err)) + } + errParts = append(errParts, "These are no longer managed by Terraform and must be deleted manually.") + return WrapError(fmt.Errorf(strings.Join(errParts, "\n"))) + } + } + return nil } @@ -913,7 +950,6 @@ func (s *EcsService) WaitForNetworkInterface(id string, status Status, timeout i return WrapErrorf(err, WaitTimeoutMsg, id, GetFunc(1), timeout, object.Status, string(status), ProviderERROR) } } - return nil } func (s *EcsService) QueryPrivateIps(eniId string) ([]string, error) { @@ -2157,3 +2193,179 @@ func (s *EcsService) EcsNetworkInterfaceStateRefreshFunc(id string, failStates [ return object, fmt.Sprint(object["Status"]), nil } } + +func (s *EcsService) DescribeEcsDeploymentSet(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewEcsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeDeploymentSets" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "DeploymentSetIds": convertListToJsonString([]interface{}{id}), + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-26"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.DeploymentSets.DeploymentSet", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.DeploymentSets.DeploymentSet", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("ECS", id)), NotFoundWithResponse, response) + } else { + if v.([]interface{})[0].(map[string]interface{})["DeploymentSetId"].(string) != id { + return object, WrapErrorf(Error(GetNotFoundMessage("ECS", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *EcsService) DescribeEcsDedicatedHostCluster(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewEcsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeDedicatedHostClusters" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "PageNumber": 1, + "PageSize": PageSizeLarge, + } + idExist := false + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-26"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.DedicatedHostClusters.DedicatedHostCluster", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.DedicatedHostClusters.DedicatedHostCluster", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("ECS", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["DedicatedHostClusterId"]) == id { + idExist = true + return v.(map[string]interface{}), nil + } + } + if len(v.([]interface{})) < request["PageSize"].(int) { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("ECS", id)), NotFoundWithResponse, response) + } + return +} + +func (s *EcsService) DescribeEcsSessionManagerStatus(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewEcsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeUserBusinessBehavior" + request := map[string]interface{}{ + "statusKey": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-26"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *EcsService) DescribeEcsPrefixList(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewEcsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribePrefixListAttributes" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "PrefixListId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-26"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidPrefixListId.NotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("ECS:PrefixList", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_eds_user.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_eds_user.go new file mode 100644 index 00000000000..e4006116b70 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_eds_user.go @@ -0,0 +1,92 @@ +package alicloud + +import ( + "fmt" + "strconv" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +type EdsUserService struct { + client *connectivity.AliyunClient +} + +func (s *EdsUserService) DescribeEcdUser(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewEdsuserClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeUsers" + request := map[string]interface{}{ + "MaxResults": PageSizeLarge, + } + idExist := false + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-03-08"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + if IsExpectedErrors(err, []string{"Forbidden"}) { + conn.Endpoint = String(connectivity.EcdOpenAPIEndpointUser) + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Users", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Users", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("ECD", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["EndUserId"]) == id { + idExist = true + return v.(map[string]interface{}), nil + } + } + + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("ECD", id)), NotFoundWithResponse, response) + } + return +} + +func (s *EdsUserService) EcdUserStateRefreshFunc(id string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeEcdUser(id) + status := convertEcdUserStatusResponse(strconv.Itoa(formatInt(object["Status"]))) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + return object, status, nil + } +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_ehpc.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_ehpc.go new file mode 100644 index 00000000000..f3c929224e9 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_ehpc.go @@ -0,0 +1,70 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +type EhpcService struct { + client *connectivity.AliyunClient +} + +func (s *EhpcService) DescribeEhpcJobTemplate(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewEhpcClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListJobTemplates" + request := map[string]interface{}{ + "PageSize": PageSizeLarge, + "PageNumber": 1, + } + idExist := false + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("GET"), StringPointer("2018-04-12"), StringPointer("AK"), request, nil, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Templates.JobTemplates", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Templates.JobTemplates", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("Ehpc", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["Id"]) == id { + idExist = true + return v.(map[string]interface{}), nil + } + } + if len(v.([]interface{})) < request["PageSize"].(int) { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("Ehpc", id)), NotFoundWithResponse, response) + } + return +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_elasticsearch.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_elasticsearch.go index 4408d4d1efe..e836b3a411c 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_elasticsearch.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_elasticsearch.go @@ -246,10 +246,20 @@ func updateDescription(d *schema.ResourceData, meta interface{}) error { "clientToken": StringPointer(buildClientToken(action)), } elasticsearchClient, err := client.NewElasticsearchClient() - response, err := elasticsearchClient.DoRequestWithAction(StringPointer(action), StringPointer("2017-06-13"), nil, StringPointer("POST"), StringPointer("AK"), - String(fmt.Sprintf("/openapi/instances/%s/description", d.Id())), requestQuery, nil, content, &util.RuntimeOptions{}) - - addDebug(action, response, content) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err := elasticsearchClient.DoRequestWithAction(StringPointer(action), StringPointer("2017-06-13"), nil, StringPointer("POST"), StringPointer("AK"), + String(fmt.Sprintf("/openapi/instances/%s/description", d.Id())), requestQuery, nil, content, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"GetCustomerLabelFail"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + addDebug(action, response, nil) + return nil + }) if err != nil { return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) } diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_emr.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_emr.go index f791511a7f1..63512fb95cc 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_emr.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_emr.go @@ -1,8 +1,11 @@ package alicloud import ( + "fmt" "time" + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" @@ -35,6 +38,43 @@ func (s *EmrService) DescribeEmrCluster(id string) (*emr.DescribeClusterV2Respon return response, nil } +func (s *EmrService) DataSourceDescribeEmrCluster(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewEmrClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeClusterV2" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "Id": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-08"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.ClusterInfo", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.ClusterInfo", response) + } + object = v.(map[string]interface{}) + return object, nil +} + func (s *EmrService) WaitForEmrCluster(id string, status Status, timeout int) error { deadline := time.Now().Add(time.Duration(timeout) * time.Second) for { @@ -187,3 +227,203 @@ func (s *EmrService) tagsToMap(tags []emr.TagResource) map[string]string { } return result } + +func (s *EmrService) ListTagResources(id string, resourceType string) (object interface{}, err error) { + conn, err := s.client.NewEmrClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListTagResources" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "ResourceType": resourceType, + "ResourceId.1": id, + } + tags := make([]interface{}, 0) + var response map[string]interface{} + + for { + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-08"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{Throttling}) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + addDebug(action, response, request) + v, err := jsonpath.Get("$.TagResources.TagResource", response) + if err != nil { + return resource.NonRetryableError(WrapErrorf(err, FailedGetAttributeMsg, id, "$.TagResources.TagResource", response)) + } + if v != nil { + tags = append(tags, v.([]interface{})...) + } + return nil + }) + if err != nil { + err = WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + return + } + if response["NextToken"] == nil { + break + } + request["NextToken"] = response["NextToken"] + } + + return tags, nil +} + +func (s *EmrService) SetResourceTags(d *schema.ResourceData, resourceType string) error { + + if d.HasChange("tags") { + added, removed := parsingTags(d) + conn, err := s.client.NewEmrClient() + if err != nil { + return WrapError(err) + } + + removedTagKeys := make([]string, 0) + for _, v := range removed { + if !ignoredTags(v, "") { + removedTagKeys = append(removedTagKeys, v) + } + } + if len(removedTagKeys) > 0 { + action := "UntagResources" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "ResourceType": resourceType, + "ResourceId.1": d.Id(), + } + for i, key := range removedTagKeys { + request[fmt.Sprintf("TagKey.%d", i+1)] = key + } + wait := incrementalWait(2*time.Second, 1*time.Second) + err := resource.Retry(10*time.Minute, func() *resource.RetryError { + response, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-08"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsThrottling(err) { + wait() + return resource.RetryableError(err) + + } + return resource.NonRetryableError(err) + } + addDebug(action, response, request) + return nil + }) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + if len(added) > 0 { + action := "TagResources" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "ResourceType": resourceType, + "ResourceId.1": d.Id(), + } + count := 1 + for key, value := range added { + request[fmt.Sprintf("Tag.%d.Key", count)] = key + request[fmt.Sprintf("Tag.%d.Value", count)] = value + count++ + } + + wait := incrementalWait(2*time.Second, 1*time.Second) + err := resource.Retry(10*time.Minute, func() *resource.RetryError { + response, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-08"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsThrottling(err) { + wait() + return resource.RetryableError(err) + + } + return resource.NonRetryableError(err) + } + addDebug(action, response, request) + return nil + }) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + d.SetPartial("tags") + } + return nil +} +func (s *EmrService) DescribeClusterBasicInfo(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewEmrClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeClusterBasicInfo" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "ClusterId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-08"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.ClusterInfo", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.ClusterInfo", response) + } + object = v.(map[string]interface{}) + return object, nil +} +func (s *EmrService) DescribeClusterV2(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewEmrClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeClusterV2" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "Id": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-08"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.ClusterInfo", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.ClusterInfo", response) + } + object = v.(map[string]interface{}) + return object, nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_ens.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_ens.go new file mode 100644 index 00000000000..0af6b1e9a53 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_ens.go @@ -0,0 +1,59 @@ +package alicloud + +import ( + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +type EnsService struct { + client *connectivity.AliyunClient +} + +func (s *EnsService) DescribeEnsKeyPair(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewEnsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeKeyPairs" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "KeyPairName": parts[0], + "Version": parts[1], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-11-10"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.KeyPairs.KeyPair", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.KeyPairs.KeyPair", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("ENS", id)), NotFoundWithResponse, response) + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_ess.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_ess.go index 70c74737c00..d9829d8215c 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_ess.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_ess.go @@ -2,6 +2,7 @@ package alicloud import ( "fmt" + "strconv" "strings" "time" @@ -256,6 +257,19 @@ func (s *EssService) flattenDataDiskMappings(list []ess.DataDisk) []map[string]i return result } +func (s *EssService) flattenSpotPriceLimitMappings(list []ess.SpotPriceModel) []map[string]interface{} { + result := make([]map[string]interface{}, 0, len(list)) + for _, i := range list { + p, _ := strconv.ParseFloat(strconv.FormatFloat(i.PriceLimit, 'f', 2, 64), 64) + l := map[string]interface{}{ + "instance_type": i.InstanceType, + "price_limit": p, + } + result = append(result, l) + } + return result +} + func (s *EssService) flattenVserverGroupList(vServerGroups []ess.VServerGroup) []map[string]interface{} { groups := make([]map[string]interface{}, 0, len(vServerGroups)) for _, v := range vServerGroups { diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_eventbridge.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_eventbridge.go index 25b650e33a4..4226f1754a2 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_eventbridge.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_eventbridge.go @@ -126,7 +126,7 @@ func (s *EventbridgeService) EventBridgeRuleStateRefreshFunc(id string, failStat } } -func (s *EventbridgeService) DescribeEventBridgeSlr(id string) (object map[string]interface{}, err error) { +func (s *EventbridgeService) DescribeEventBridgeServiceLinkedRole(id string) (object map[string]interface{}, err error) { var response map[string]interface{} conn, err := s.client.NewEventbridgeClient() if err != nil { @@ -168,7 +168,7 @@ func (s *EventbridgeService) DescribeEventBridgeSlr(id string) (object map[strin func (s *EventbridgeService) CheckRoleForProductRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { return func() (interface{}, string, error) { - object, err := s.DescribeEventBridgeSlr(id) + object, err := s.DescribeEventBridgeServiceLinkedRole(id) if err != nil { if NotFoundError(err) { return nil, "", nil diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_fc.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_fc.go index 2c735cb70f0..35394a0df2c 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_fc.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_fc.go @@ -206,6 +206,19 @@ func delEmptyPayloadIfExist(s string) (string, error) { return string(out), err } +func resolveFcTriggerConfig(s string) (string, error) { + if s == "" { + return s, nil + } + in := []byte(s) + var raw map[string]interface{} + if err := json.Unmarshal(in, &raw); err != nil { + return s, err + } + out, err := json.Marshal(raw) + return string(out), err +} + func (s *FcService) WaitForFcTrigger(id string, status Status, timeout int) error { parts, err := ParseResourceId(id, 3) if err != nil { diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_fnf.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_fnf.go index 5b16c0946c2..7e71d9924e3 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_fnf.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_fnf.go @@ -1,9 +1,13 @@ package alicloud import ( + "fmt" + "time" + "github.com/PaesslerAG/jsonpath" util "github.com/alibabacloud-go/tea-utils/service" "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) type FnfService struct { @@ -77,3 +81,112 @@ func (s *FnfService) DescribeFnfSchedule(id string) (object map[string]interface object = v.(map[string]interface{}) return object, nil } + +func (s *FnfService) DescribeFnFExecution(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewFnfClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeExecution" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "ExecutionName": parts[1], + "FlowName": parts[0], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("GET"), StringPointer("2019-03-15"), StringPointer("AK"), request, nil, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"FlowNotExists"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("FnF:Execution", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *FnfService) FnFExecutionStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeFnFExecution(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["Status"]) == failState { + return object, fmt.Sprint(object["Status"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["Status"]))) + } + } + return object, fmt.Sprint(object["Status"]), nil + } +} +func (s *FnfService) DescribeExecution(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewFnfClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeExecution" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "ExecutionName": parts[1], + "FlowName": parts[0], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("GET"), StringPointer("2019-03-15"), StringPointer("AK"), request, nil, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"FlowNotExists"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("FnF:Execution", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_ga.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_ga.go index f47957a3f4a..eafedad7d68 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_ga.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_ga.go @@ -1,6 +1,7 @@ package alicloud import ( + "fmt" "time" "github.com/PaesslerAG/jsonpath" @@ -26,16 +27,25 @@ func (s *GaService) DescribeGaAccelerator(id string) (object map[string]interfac } runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) if err != nil { if IsExpectedErrors(err, []string{"UnknownError"}) { - err = WrapErrorf(Error(GetNotFoundMessage("GaAccelerator", id)), NotFoundMsg, ProviderERROR) - return object, err + return object, WrapErrorf(Error(GetNotFoundMessage("Ga:Accelerator", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) } - err = WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) - return object, err + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) } - addDebug(action, response, request) v, err := jsonpath.Get("$", response) if err != nil { return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) @@ -56,11 +66,11 @@ func (s *GaService) GaAcceleratorStateRefreshFunc(id string, failStates []string } for _, failState := range failStates { - if object["State"].(string) == failState { - return object, object["State"].(string), WrapError(Error(FailedToReachTargetStatus, object["State"].(string))) + if fmt.Sprint(object["State"]) == failState { + return object, fmt.Sprint(object["State"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["State"]))) } } - return object, object["State"].(string), nil + return object, fmt.Sprint(object["State"]), nil } } @@ -315,10 +325,13 @@ func (s *GaService) DescribeGaBandwidthPackageAttachment(id string) (object map[ return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) } object = v.(map[string]interface{}) - if object["BasicBandwidthPackage"] == nil || object["BasicBandwidthPackage"].(map[string]interface{})["InstanceId"] != parts[1] { - return object, WrapErrorf(Error(GetNotFoundMessage("GaBandwidthPackageAttachment", id)), NotFoundMsg, ProviderERROR) + + basic, exist1 := object["BasicBandwidthPackage"] + cross, exist2 := object["CrossDomainBandwidthPackage"] + if (exist1 && basic.(map[string]interface{})["InstanceId"] == parts[1]) || (exist2 && cross.(map[string]interface{})["InstanceId"] == parts[1]) { + return object, nil } - return object, nil + return object, WrapErrorf(Error(GetNotFoundMessage("GaBandwidthPackageAttachment", id)), NotFoundMsg, ProviderERROR) } func (s *GaService) GaEndpointGroupStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { @@ -400,3 +413,284 @@ func (s *GaService) GaIpSetStateRefreshFunc(id string, failStates []string) reso return object, object["State"].(string), nil } } +func (s *GaService) DescribeAcceleratorAutoRenewAttribute(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewGaplusClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeAcceleratorAutoRenewAttribute" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "AcceleratorId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *GaService) DescribeGaAcl(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewGaplusClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetAcl" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "AclId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"NotExist.Acl"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("Ga:Acl", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *GaService) GaAclStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeGaAcl(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["AclStatus"]) == failState { + return object, fmt.Sprint(object["AclStatus"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["AclStatus"]))) + } + } + return object, fmt.Sprint(object["AclStatus"]), nil + } +} + +func (s *GaService) GetAcl(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewGaplusClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetAcl" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "AclId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"NotExist.Acl"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("Ga:Acl", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *GaService) DescribeGaAclAttachment(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewGaplusClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeListener" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "ListenerId": parts[0], + } + idExist := false + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"NotExist.Listener"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("Ga::AclAttachment", id)), NotFoundWithResponse, response) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + resp, _ := v.(map[string]interface{}) + if v, ok := resp["RelatedAcls"].([]interface{}); ok && len(v) > 0 { + for _, aclArgs := range v { + aclArg := aclArgs.(map[string]interface{}) + if fmt.Sprint(aclArg["AclId"]) == parts[1] { + idExist = true + resp["status"] = aclArg["Status"] + return resp, nil + } + } + } + + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("Ga::AclAttachment", id)), NotFoundWithResponse, response) + } + return object, nil +} + +func (s *GaService) GaAclAttachmentStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeGaAclAttachment(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["status"]) == failState { + return object, fmt.Sprint(object["status"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["RelatedAcls[*].Status"]))) + } + } + return object, fmt.Sprint(object["status"]), nil + } +} + +func (s *GaService) DescribeGaAdditionalCertificate(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewGaplusClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListListenerCertificates" + parts, err := ParseResourceId(id, 3) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "AcceleratorId": parts[0], + "ListenerId": parts[1], + "Role": "additional", + "MaxResults": PageSizeMedium, + } + idExist := false + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Certificates", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Certificates", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("Ga", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["Domain"]) == parts[2] { + idExist = true + return v.(map[string]interface{}), nil + } + } + + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("Ga", id)), NotFoundWithResponse, response) + } + return +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_gdb.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_gdb.go new file mode 100644 index 00000000000..06647871def --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_gdb.go @@ -0,0 +1,173 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +type GdbService struct { + client *connectivity.AliyunClient +} + +func (s *GdbService) DescribeGraphDatabaseDbInstance(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewGdsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeDBInstanceAttribute" + request := map[string]interface{}{ + "DBInstanceId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-03"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidDBInstance.NotFound", "InvalidDBInstanceId.NotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("GraphDatabase:DbInstance", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Items.DBInstance", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Items.DBInstance", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("GraphDatabase", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["DBInstanceId"]) != id { + return object, WrapErrorf(Error(GetNotFoundMessage("GraphDatabase", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + + GetDBInstanceAccessWhiteListObject, err := s.GetDBInstanceAccessWhiteList(id) + if err != nil { + return nil, err + } + + object["DBInstanceIPArray"] = GetDBInstanceAccessWhiteListObject["DBInstanceIPArray"] + return object, nil +} + +func (s *GdbService) GetDBInstanceAccessWhiteList(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewGdsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeDBInstanceAccessWhiteList" + request := map[string]interface{}{ + "DBInstanceId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-03"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidDBInstance.NotFound", "InvalidDBInstanceId.NotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("GraphDatabase:DbInstance", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Items", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Items", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *GdbService) GraphDatabaseDbInstanceStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeGraphDatabaseDbInstance(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["DBInstanceStatus"]) == failState { + return object, fmt.Sprint(object["DBInstanceStatus"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["DBInstanceStatus"]))) + } + } + return object, fmt.Sprint(object["DBInstanceStatus"]), nil + } +} + +func (s *GdbService) DescribeDBInstanceAttribute(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewGdsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeDBInstanceAttribute" + request := map[string]interface{}{ + "DBInstanceId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-03"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidDBInstance.NotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("GraphDatabase:DbInstance", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Items.DBInstance", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Items.DBInstance", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("GraphDatabase", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["DBInstanceId"]) != id { + return object, WrapErrorf(Error(GetNotFoundMessage("GraphDatabase", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_gpdb.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_gpdb.go index 1e8e50b179e..b4d25c2f42d 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_gpdb.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_gpdb.go @@ -1,6 +1,7 @@ package alicloud import ( + "fmt" "log" "regexp" "strings" @@ -308,3 +309,78 @@ func (s *GpdbService) ignoreTag(t gpdb.Tag) bool { } return false } + +func (s *GpdbService) DescribeGpdbAccount(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewGpdbClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeAccounts" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "AccountName": parts[1], + "DBInstanceId": parts[0], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-05-03"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + + if NeedRetry(err) { + + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidDBInstanceId.NotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("GPDB:Account", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Accounts.DBInstanceAccount", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Accounts.DBInstanceAccount", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("GPDB", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["AccountName"]) != parts[1] { + return object, WrapErrorf(Error(GetNotFoundMessage("GPDB", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *GpdbService) GpdbAccountStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeGpdbAccount(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["AccountStatus"]) == failState { + return object, fmt.Sprint(object["AccountStatus"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["AccountStatus"]))) + } + } + return object, fmt.Sprint(object["AccountStatus"]), nil + } +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_hbr.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_hbr.go index 5cf5af93fe1..50b156f647e 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_hbr.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_hbr.go @@ -16,6 +16,36 @@ type HbrService struct { client *connectivity.AliyunClient } +func (s *HbrService) convertDetailToString(details []interface{}) (string, error) { + configRulesMap := make(map[string]interface{}) + for _, configRules := range details { + configRulesArg := configRules.(map[string]interface{}) + configRulesMap["enableWriters"] = true + configRulesMap["appConsistent"] = configRulesArg["app_consistent"] + configRulesMap["snapshotGroup"] = configRulesArg["snapshot_group"] + configRulesMap["EnableFsFreeze"] = configRulesArg["enable_fs_freeze"] + configRulesMap["preScriptPath"] = configRulesArg["pre_script_path"] + configRulesMap["postScriptPath"] = configRulesArg["post_script_path"] + configRulesMap["timeoutInSeconds"] = configRulesArg["timeout_in_seconds"] + configRulesMap["doCopy"] = configRulesArg["do_copy"] + + if configRulesArg["destination_region_id"] != "" { + configRulesMap["destinationRegionId"] = configRulesArg["destination_region_id"] + } + configRulesMap["destinationRetention"] = configRulesArg["destination_retention"] + diskListArg := make([]interface{}, 0) + if configRulesArg["disk_id_list"] != nil { + diskListArg = append(diskListArg, configRulesArg["disk_id_list"].([]interface{})...) + configRulesMap["diskIdList"] = diskListArg + } + } + if v, err := convertArrayObjectToJsonString(configRulesMap); err != nil { + return "", WrapError(err) + } else { + return v, nil + } +} + func (s *HbrService) DescribeHbrVault(id string) (object map[string]interface{}, err error) { var response map[string]interface{} conn, err := s.client.NewHbrClient() @@ -401,3 +431,204 @@ func (s *HbrService) HbrEcsBackupClientStateRefreshFunc(id string, failStates [] return object, fmt.Sprint(object["Status"]), nil } } +func (s *HbrService) DescribeHbrRestoreJob(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewHbrClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeRestoreJobs2" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "RestoreType": parts[1], + "PageSize": 50, + "PageNumber": 1, + } + filtersMapList := make([]map[string]interface{}, 0) + request["Filters"] = filtersMapList + idExist := false + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-09-08"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return object, WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + v, err := jsonpath.Get("$.RestoreJobs.RestoreJob", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.RestoreJobs.RestoreJob", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("HBR", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["RestoreId"]) == parts[0] { + idExist = true + return v.(map[string]interface{}), nil + } + } + if len(v.([]interface{})) < request["PageSize"].(int) { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("HBR", id)), NotFoundWithResponse, response) + } + return +} + +func (s *HbrService) HbrRestoreJobStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeHbrRestoreJob(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["Status"]) == failState { + return object, fmt.Sprint(object["Status"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["Status"]))) + } + } + return object, fmt.Sprint(object["Status"]), nil + } +} +func (s *HbrService) DescribeHbrServerBackupPlan(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewHbrClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeBackupPlans" + request := map[string]interface{}{ + "SourceType": "UDM_ECS", + "PageNumber": 1, + "PageSize": PageSizeLarge, + } + idExist := false + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-09-08"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return object, WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + v, err := jsonpath.Get("$.BackupPlans.BackupPlan", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.BackupPlans.BackupPlan", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("HBR", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["PlanId"]) == id { + idExist = true + return v.(map[string]interface{}), nil + } + } + if len(v.([]interface{})) < request["PageSize"].(int) { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("HBR", id)), NotFoundWithResponse, response) + } + return +} + +func (s *HbrService) DescribeHbrReplicationVault(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewHbrClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeVaults" + request := map[string]interface{}{ + "PageSize": 10, + "PageNumber": 1, + } + idExist := false + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-09-08"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return object, WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + v, err := jsonpath.Get("$.Vaults.Vault", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Vaults.Vault", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("HBR", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["VaultId"]) == id { + idExist = true + return v.(map[string]interface{}), nil + } + } + if len(v.([]interface{})) < request["PageSize"].(int) { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("HBR", id)), NotFoundWithResponse, response) + } + return +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_imm.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_imm.go new file mode 100644 index 00000000000..172beb7c69a --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_imm.go @@ -0,0 +1,54 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +type ImmService struct { + client *connectivity.AliyunClient +} + +func (s *ImmService) DescribeImmProject(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewImmClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetProject" + request := map[string]interface{}{ + "Project": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-09-06"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidProject.NotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("IMM:Project", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_imp.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_imp.go new file mode 100644 index 00000000000..5b580d773ab --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_imp.go @@ -0,0 +1,54 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +type ImpService struct { + client *connectivity.AliyunClient +} + +func (s *ImpService) DescribeImpAppTemplate(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewImpClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetAppTemplate" + request := map[string]interface{}{ + "AppTemplateId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2021-06-30"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidAppTemplateId.App.NotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("IMP:AppTemplate", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Result", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Result", response) + } + object = v.(map[string]interface{}) + return object, nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_iot.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_iot.go new file mode 100644 index 00000000000..548108680ef --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_iot.go @@ -0,0 +1,59 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +type IotService struct { + client *connectivity.AliyunClient +} + +func (s *IotService) DescribeIotDeviceGroup(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewIotClient() + if err != nil { + return nil, WrapError(err) + } + action := "QueryDeviceGroupInfo" + request := map[string]interface{}{ + "GroupId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-01-20"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + if IsExpectedErrorCodes(fmt.Sprint(response["Code"]), []string{"iot.group.QueryGroupInfoFailed"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("Iot:DeviceGroup", id)), NotFoundMsg, ProviderERROR) + } + + if fmt.Sprint(response["Success"]) == "false" { + return object, WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_mhub.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_mhub.go new file mode 100644 index 00000000000..a7ed8d10558 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_mhub.go @@ -0,0 +1,113 @@ +package alicloud + +import ( + "fmt" + + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +type MhubService struct { + client *connectivity.AliyunClient +} + +func (s *MhubService) DescribeMhubProduct(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewMhubClient() + if err != nil { + return nil, WrapError(err) + } + action := "QueryProductInfo" + request := map[string]interface{}{ + "ProductId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-08-25"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + + if IsExpectedErrors(err, []string{"ProductNotExist"}) { + err = WrapErrorf(Error(GetNotFoundMessage("MHUBProduct", id)), NotFoundMsg, ProviderERROR) + return object, err + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + + v, err := jsonpath.Get("$.ProductInfo", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.ProductInfo", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *MhubService) DescribeMhubApp(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewMhubClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListApps" + idExist := false + parts, err := ParseResourceId(id, 2) + request := map[string]interface{}{ + "ProductId": parts[0], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-08-25"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"ProductNotExist"}) { + err = WrapErrorf(Error(GetNotFoundMessage("MHUBProduct", id)), NotFoundMsg, ProviderERROR) + return object, err + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.AppInfos.AppInfo", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.AppInfos.AppInfo", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("MHUB", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["AppKey"]) == parts[1] { + idExist = true + return v.(map[string]interface{}), nil + } + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("MHUB", id)), NotFoundWithResponse, response) + } + + object = v.(map[string]interface{}) + return object, nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_mongodb.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_mongodb.go index 3b3cbc5bc35..9c2ae494b86 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_mongodb.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_mongodb.go @@ -7,6 +7,8 @@ import ( "strings" "time" + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" @@ -220,6 +222,11 @@ func (server *MongoDBService) ModifyMongodbShardingInstanceNode( if state["node_class"] != diff["node_class"] || state["node_storage"] != diff["node_storage"] { request := dds.CreateModifyNodeSpecRequest() + if d.Get("instance_charge_type").(string) == "PrePaid" { + if v, ok := d.GetOk("order_type"); ok { + request.OrderType = v.(string) + } + } request.RegionId = server.client.RegionId request.DBInstanceId = d.Id() request.NodeClass = diff["node_class"].(string) @@ -462,3 +469,505 @@ func (s *MongoDBService) tagsFromMap(m map[string]interface{}) []dds.TagResource return result } + +func (s *MongoDBService) DescribeMongodbAuditPolicy(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewDdsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeAuditPolicy" + request := map[string]interface{}{ + "DBInstanceId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-12-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *MongoDBService) DescribeMongodbAccount(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewDdsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeAccounts" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "AccountName": parts[1], + "DBInstanceId": parts[0], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-12-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Accounts.Account", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Accounts.Account", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("MongoDB", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["AccountName"]) != parts[1] { + return object, WrapErrorf(Error(GetNotFoundMessage("MongoDB", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *MongoDBService) MongodbAccountStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeMongodbAccount(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["AccountStatus"]) == failState { + return object, fmt.Sprint(object["AccountStatus"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["AccountStatus"]))) + } + } + return object, fmt.Sprint(object["AccountStatus"]), nil + } +} + +func (s *MongoDBService) DescribeSecurityIps(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewDdsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeSecurityIps" + request := map[string]interface{}{ + "DBInstanceId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-12-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *MongoDBService) DescribeMongodbServerlessInstance(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewDdsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeDBInstanceAttribute" + request := map[string]interface{}{ + "DBInstanceId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-12-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidDBInstanceId.NotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("MongoDB:ServerlessInstance", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.DBInstances.DBInstance", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.DBInstances.DBInstance", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("MongoDB", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["DBInstanceId"]) != id { + return object, WrapErrorf(Error(GetNotFoundMessage("MongoDB", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *MongoDBService) MongodbServerlessInstanceStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeMongodbServerlessInstance(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["DBInstanceStatus"]) == failState { + return object, fmt.Sprint(object["DBInstanceStatus"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["DBInstanceStatus"]))) + } + } + return object, fmt.Sprint(object["DBInstanceStatus"]), nil + } +} + +func (s *MongoDBService) SetResourceTags(d *schema.ResourceData, resourceType string) error { + if d.HasChange("tags") { + added, removed := parsingTags(d) + conn, err := s.client.NewDdsClient() + if err != nil { + return WrapError(err) + } + + removedTagKeys := make([]string, 0) + for _, v := range removed { + if !ignoredTags(v, "") { + removedTagKeys = append(removedTagKeys, v) + } + } + if len(removedTagKeys) > 0 { + action := "UntagResources" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "ResourceType": resourceType, + "ResourceId.1": d.Id(), + } + for i, key := range removedTagKeys { + request[fmt.Sprintf("TagKey.%d", i+1)] = key + } + wait := incrementalWait(2*time.Second, 1*time.Second) + err := resource.Retry(10*time.Minute, func() *resource.RetryError { + response, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-12-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + + } + return resource.NonRetryableError(err) + } + addDebug(action, response, request) + return nil + }) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + if len(added) > 0 { + action := "TagResources" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "ResourceType": resourceType, + "ResourceId.1": d.Id(), + } + count := 1 + for key, value := range added { + request[fmt.Sprintf("Tag.%d.Key", count)] = key + request[fmt.Sprintf("Tag.%d.Value", count)] = value + count++ + } + + wait := incrementalWait(2*time.Second, 1*time.Second) + err := resource.Retry(10*time.Minute, func() *resource.RetryError { + response, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-12-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + + } + return resource.NonRetryableError(err) + } + addDebug(action, response, request) + return nil + }) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + d.SetPartial("tags") + } + return nil +} + +func (s *MongoDBService) ListTagResources(id string, resourceType string) (object interface{}, err error) { + conn, err := s.client.NewDdsClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListTagResources" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "ResourceType": resourceType, + "ResourceId.1": id, + } + tags := make([]interface{}, 0) + var response map[string]interface{} + + for { + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-12-01"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + addDebug(action, response, request) + v, err := jsonpath.Get("$.TagResources.TagResource", response) + if err != nil { + return resource.NonRetryableError(WrapErrorf(err, FailedGetAttributeMsg, id, "$.TagResources.TagResource", response)) + } + if v != nil { + tags = append(tags, v.([]interface{})...) + } + return nil + }) + if err != nil { + err = WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + return + } + if response["NextToken"] == nil { + break + } + request["NextToken"] = response["NextToken"] + } + + return tags, nil +} + +func (s *MongoDBService) DescribeMongodbShardingNetworkPublicAddress(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewDdsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeShardingNetworkAddress" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "DBInstanceId": parts[0], + "NodeId": parts[1], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-12-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidDBInstanceId.NotFound"}) { + return object, WrapErrorf(err, NotFoundMsg, AlibabaCloudSdkGoERROR) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.NetworkAddresses.NetworkAddress", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.NetworkAddresses.NetworkAddress", response) + } + exist := false + var networkAddress = make([]map[string]interface{}, 0) + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("MongoDB", id)), NotFoundWithResponse, response) + } else { + for _, item := range v.([]interface{}) { + if item.(map[string]interface{})["NetworkType"].(string) == "Public" { + exist = true + networkAddress = append(networkAddress, item.(map[string]interface{})) + } + } + if !exist { + return object, WrapErrorf(Error(GetNotFoundMessage("MongoDB", id)), NotFoundWithResponse, response) + } + } + object = make(map[string]interface{}, 0) + object["NetworkAddress"] = networkAddress + return object, nil +} + +func (s *MongoDBService) DescribeShardingNodeType(id string) (string, error) { + var response map[string]interface{} + conn, err := s.client.NewDdsClient() + if err != nil { + return "", WrapError(err) + } + action := "DescribeShardingNetworkAddress" + parts, err := ParseResourceId(id, 2) + if err != nil { + return "", WrapError(err) + } + request := map[string]interface{}{ + "DBInstanceId": parts[0], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2015-12-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidDBInstanceId.NotFound"}) { + return "", WrapErrorf(err, NotFoundMsg, AlibabaCloudSdkGoERROR) + } + return "", WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.NetworkAddresses.NetworkAddress", response) + if err != nil { + return "", WrapErrorf(err, FailedGetAttributeMsg, id, "$.NetworkAddresses.NetworkAddress", response) + } + + var nodeType string + if len(v.([]interface{})) < 1 { + return "", WrapErrorf(Error(GetNotFoundMessage("MongoDB", id)), NotFoundWithResponse, response) + } else { + for _, item := range v.([]interface{}) { + if item.(map[string]interface{})["NodeId"].(string) == parts[1] { + nodeType = fmt.Sprint(item.(map[string]interface{})["NodeType"]) + break + } + } + } + if nodeType == "" { + return "", WrapErrorf(Error(GetNotFoundMessage("MongoDB", id)), NotFoundWithResponse, response) + } + + return nodeType, nil +} + +func (s *MongoDBService) MongodbShardingNetworkPublicAddressStateRefreshFunc(id, nodeType string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + parts, err := ParseResourceId(id, 2) + if err != nil { + return nil, "", WrapError(err) + } + object, err := s.DescribeMongodbServerlessInstance(parts[0]) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + var status string + + switch nodeType { + case "mongos": + status = fmt.Sprint(object["DBInstanceStatus"]) + case "db": + list := object["ShardList"].(map[string]interface{})["ShardAttribute"] + for _, item := range list.([]interface{}) { + mongos := item.(map[string]interface{}) + if mongos["NodeId"] == parts[1] { + status = fmt.Sprint(mongos["Status"]) + break + } + } + case "cs": + list := object["ConfigserverList"].(map[string]interface{})["ConfigserverAttribute"] + for _, item := range list.([]interface{}) { + mongos := item.(map[string]interface{}) + if mongos["NodeId"] == parts[1] { + status = fmt.Sprint(mongos["Status"]) + break + } + } + } + + for _, failState := range failStates { + if status == failState { + return object, status, WrapError(Error(FailedToReachTargetStatus, status)) + } + } + + return object, status, nil + } +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_msc_open_subscription.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_msc_open_subscription.go index 8ae5b2e4926..12204ebdd3a 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_msc_open_subscription.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_msc_open_subscription.go @@ -23,6 +23,7 @@ func (s *MscOpenSubscriptionService) GetContact(id string) (object map[string]in action := "GetContact" request := map[string]interface{}{ "ContactId": id, + "Locale": "en", } runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) @@ -65,6 +66,7 @@ func (s *MscOpenSubscriptionService) DescribeMscSubContact(id string) (object ma action := "GetContact" request := map[string]interface{}{ "ContactId": id, + "Locale": "en", } runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) @@ -94,3 +96,85 @@ func (s *MscOpenSubscriptionService) DescribeMscSubContact(id string) (object ma object = v.(map[string]interface{}) return object, nil } + +func (s *MscOpenSubscriptionService) DescribeMscSubSubscription(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewMscopensubscriptionClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetSubscriptionItem" + request := map[string]interface{}{ + "ItemId": id, + "Locale": "en", + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("GET"), StringPointer("2021-07-13"), StringPointer("AK"), request, nil, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return object, WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + v, err := jsonpath.Get("$.SubscriptionItem", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.SubscriptionItem", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *MscOpenSubscriptionService) DescribeMscSubWebhook(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewMscopensubscriptionClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetWebhook" + request := map[string]interface{}{ + "WebhookId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("GET"), StringPointer("2021-07-13"), StringPointer("AK"), request, nil, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"ResourceNotFound"}) { + return nil, WrapErrorf(err, NotFoundMsg, AlibabaCloudSdkGoERROR) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return object, WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + v, err := jsonpath.Get("$.Webhook", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Webhook", response) + } + object = v.(map[string]interface{}) + return object, nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_nas.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_nas.go index 0469ad17973..ef65c971a34 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_nas.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_nas.go @@ -1,6 +1,11 @@ package alicloud import ( + "fmt" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/PaesslerAG/jsonpath" util "github.com/alibabacloud-go/tea-utils/service" "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" @@ -26,8 +31,8 @@ func (s *NasService) DescribeNasFileSystem(id string) (object map[string]interfa runtime.SetAutoretry(true) response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-06-26"), StringPointer("AK"), nil, request, &runtime) if err != nil { - if IsExpectedErrors(err, []string{"InvalidFileSystem.NotFound", "Forbidden.NasNotFound"}) { - err = WrapErrorf(Error(GetNotFoundMessage("NasFileSystem", id)), NotFoundMsg, ProviderERROR) + if IsExpectedErrors(err, []string{"InvalidFileSystem.NotFound", "Forbidden.NasNotFound", "Resource.NotFound", "InvalidFileSystemStatus.Ordering"}) { + err = WrapErrorf(Error(GetNotFoundMessage("NasFileSystem", id)), NotFoundWithResponse, ProviderERROR) return object, err } err = WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) @@ -188,3 +193,432 @@ func (s *NasService) NasMountTargetStateRefreshFunc(id string, failStates []stri return object, object["Status"].(string), nil } } + +func (s *NasService) DescribeNasFileSystemStateRefreshFunc(id string, defaultRetryState string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeNasFileSystem(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, defaultRetryState, nil + } + return nil, "", WrapError(err) + } + for _, failState := range failStates { + if fmt.Sprint(object["Status"]) == failState { + return object, fmt.Sprint(object["Status"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["Status"]))) + } + } + return object, fmt.Sprint(object["Status"]), nil + } +} + +func (s *NasService) DescribeNasSnapshot(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewNasClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeSnapshots" + request := map[string]interface{}{ + "SnapshotIds": id, + "FileSystemType": "extreme", + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-06-26"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidFileSystem.NotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("NAS:Snapshot", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Snapshots.Snapshot", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Snapshots.Snapshot", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("NAS", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["SnapshotId"]) != id { + return object, WrapErrorf(Error(GetNotFoundMessage("NAS", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *NasService) NasSnapshotStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeNasSnapshot(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["Status"]) == failState { + return object, fmt.Sprint(object["Status"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["Status"]))) + } + } + return object, fmt.Sprint(object["Status"]), nil + } +} +func (s *NasService) DescribeNasFileset(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewNasClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeFilesets" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "FileSystemId": parts[0], + "MaxResults": 20, + } + idExist := false + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-06-26"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidFileSystem.NotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("NAS:Snapshot", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Entries.Entrie", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Entries.Entrie", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("NAS", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["FsetId"]) == parts[1] { + idExist = true + return v.(map[string]interface{}), nil + } + } + + if nextToken, ok := response["NextToken"].(string); ok && nextToken != "" { + request["NextToken"] = nextToken + } else { + break + } + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("NAS", id)), NotFoundWithResponse, response) + } + return +} + +func (s *NasService) NasFilesetStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeNasFileset(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["Status"]) == failState { + return object, fmt.Sprint(object["Status"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["Status"]))) + } + } + return object, fmt.Sprint(object["Status"]), nil + } +} + +func (s *NasService) ListTagResources(id string, resourceType string) (object interface{}, err error) { + conn, err := s.client.NewNasClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListTagResources" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "ResourceType": resourceType, + "ResourceId.1": id, + } + tags := make([]interface{}, 0) + var response map[string]interface{} + + for { + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-06-26"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + addDebug(action, response, request) + v, err := jsonpath.Get("$.TagResources.TagResource", response) + if err != nil { + return resource.NonRetryableError(WrapErrorf(err, FailedGetAttributeMsg, id, "$.TagResources.TagResource", response)) + } + if v != nil { + tags = append(tags, v.([]interface{})...) + } + return nil + }) + if err != nil { + err = WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + return + } + if response["NextToken"] == nil { + break + } + request["NextToken"] = response["NextToken"] + } + + return tags, nil +} + +func (s *NasService) SetResourceTags(d *schema.ResourceData, resourceType string) error { + + if d.HasChange("tags") { + added, removed := parsingTags(d) + conn, err := s.client.NewNasClient() + if err != nil { + return WrapError(err) + } + + removedTagKeys := make([]string, 0) + for _, v := range removed { + if !ignoredTags(v, "") { + removedTagKeys = append(removedTagKeys, v) + } + } + if len(removedTagKeys) > 0 { + action := "UntagResources" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "ResourceType": resourceType, + "ResourceId.1": d.Id(), + } + for i, key := range removedTagKeys { + request[fmt.Sprintf("TagKey.%d", i+1)] = key + } + wait := incrementalWait(2*time.Second, 1*time.Second) + err := resource.Retry(10*time.Minute, func() *resource.RetryError { + response, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-06-26"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsThrottling(err) { + wait() + return resource.RetryableError(err) + + } + return resource.NonRetryableError(err) + } + addDebug(action, response, request) + return nil + }) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + if len(added) > 0 { + action := "TagResources" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "ResourceType": resourceType, + "ResourceId.1": d.Id(), + } + count := 1 + for key, value := range added { + request[fmt.Sprintf("Tag.%d.Key", count)] = key + request[fmt.Sprintf("Tag.%d.Value", count)] = value + count++ + } + + wait := incrementalWait(2*time.Second, 1*time.Second) + err := resource.Retry(10*time.Minute, func() *resource.RetryError { + response, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-06-26"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsThrottling(err) { + wait() + return resource.RetryableError(err) + + } + return resource.NonRetryableError(err) + } + addDebug(action, response, request) + return nil + }) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + d.SetPartial("tags") + } + return nil +} + +func (s *NasService) DescribeNasAutoSnapshotPolicy(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewNasClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeAutoSnapshotPolicies" + request := map[string]interface{}{ + "AutoSnapshotPolicyId": id, + "FileSystemType": "extreme", + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-06-26"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidLifecyclePolicy.NotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("NAS:AutoSnapshotPolicy", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.AutoSnapshotPolicies.AutoSnapshotPolicy", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.AutoSnapshotPolicies.AutoSnapshotPolicy", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("NAS", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["AutoSnapshotPolicyId"]) != id { + return object, WrapErrorf(Error(GetNotFoundMessage("NAS", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *NasService) NasAutoSnapshotPolicyStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeNasAutoSnapshotPolicy(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["Status"]) == failState { + return object, fmt.Sprint(object["Status"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["Status"]))) + } + } + return object, fmt.Sprint(object["Status"]), nil + } +} + +func (s *NasService) DescribeNasLifecyclePolicy(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewNasClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeLifecyclePolicies" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "FileSystemId": parts[0], + "PageNumber": 1, + "PageSize": PageSizeMedium, + } + idExist := false + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("GET"), StringPointer("2017-06-26"), StringPointer("AK"), request, nil, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidFileSystem.NotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("NAS:LifecyclePolicy", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.LifecyclePolicies", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.LifecyclePolicies", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("NAS", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["LifecyclePolicyName"]) == parts[1] { + idExist = true + return v.(map[string]interface{}), nil + } + } + if len(v.([]interface{})) < request["PageSize"].(int) { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("NAS", id)), NotFoundWithResponse, response) + } + return +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_oos.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_oos.go index 1026114423b..948677fd1ad 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_oos.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_oos.go @@ -1,6 +1,9 @@ package alicloud import ( + "fmt" + "time" + "github.com/PaesslerAG/jsonpath" util "github.com/alibabacloud-go/tea-utils/service" "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" @@ -95,3 +98,289 @@ func (s *OosService) OosExecutionStateRefreshFunc(id string, failStates []string return object, object["Status"].(string), nil } } + +func (s *OosService) DescribeOosApplication(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewOosClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetApplication" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "Name": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"EntityNotExists.Application"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("Oos:Application", id)), NotFoundMsg, ProviderERROR) + } + + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Application", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Application", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *OosService) DescribeOosApplicationGroup(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewOosClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetApplicationGroup" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "Name": parts[1], + "ApplicationName": parts[0], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"EntityNotExists.ApplicationGroup"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("Oos:ApplicationGroup", id)), NotFoundMsg, ProviderERROR) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.ApplicationGroup", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.ApplicationGroup", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *OosService) DescribeOosPatchBaseline(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewOosClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetPatchBaseline" + request := map[string]interface{}{ + "Name": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"EntityNotExists.PatchBaseline"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("Oos:Application", id)), NotFoundMsg, ProviderERROR) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.PatchBaseline", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.PatchBaseline", response) + } + object = v.(map[string]interface{}) + return object, nil +} +func (s *OosService) DescribeOosStateConfiguration(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewOosClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListStateConfigurations" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.StateConfigurations", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.StateConfigurations", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("OOS", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["StateConfigurationId"]) != id { + return object, WrapErrorf(Error(GetNotFoundMessage("OOS", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *OosService) DescribeOosServiceSetting(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewOosClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetServiceSettings" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.ServiceSettings", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.ServiceSettings", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *OosService) DescribeOosParameter(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewOosClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetParameter" + request := map[string]interface{}{ + "Name": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"EntityNotExists.Parameter"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("Oos:Application", id)), NotFoundMsg, ProviderERROR) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Parameter", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Parameter", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *OosService) DescribeOosSecretParameter(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewOosClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetSecretParameter" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "Name": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + + if NeedRetry(err) { + + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"EntityNotExists.Parameter"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("Oos:Application", id)), NotFoundMsg, ProviderERROR) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Parameter", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Parameter", response) + } + object = v.(map[string]interface{}) + return object, nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_open_search.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_open_search.go new file mode 100644 index 00000000000..9a06bd7457f --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_open_search.go @@ -0,0 +1,80 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +type OpenSearchService struct { + client *connectivity.AliyunClient +} + +func (s *OpenSearchService) DescribeOpenSearchAppGroup(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewOpensearchClient() + if err != nil { + return nil, WrapError(err) + } + action := "/v4/openapi/app-groups/" + id + body := map[string]interface{}{ + "appGroupIdentity": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer("2017-12-25"), nil, StringPointer("GET"), StringPointer("AK"), StringPointer(action), nil, nil, body, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug("GET "+action, response, body) + if err != nil { + if IsExpectedErrors(err, []string{"App.NotFound"}) { + return response, WrapErrorf(err, NotFoundMsg, AlibabaCloudSdkGoERROR) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + if respBody, isExist := response["body"]; isExist { + response = respBody.(map[string]interface{}) + } else { + return object, WrapError(fmt.Errorf("%s failed, response: %v", "POST "+action, response)) + } + + v, err := jsonpath.Get("$.result", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.result", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *OpenSearchService) OpenSearchAppStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeOpenSearchAppGroup(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if object["status"].(string) == failState { + return object, object["status"].(string), WrapError(Error(FailedToReachTargetStatus, object["status"].(string))) + } + } + return object, object["status"].(string), nil + } +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_polardb.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_polardb.go index dba8aadd58b..da59c76de11 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_polardb.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_polardb.go @@ -61,9 +61,6 @@ func (s *PolarDBService) DescribePolarDBClusterAttribute(id string) (instance *p addDebug(request.GetActionName(), raw, request.RpcRequest, request) response, _ := raw.(*polardb.DescribeDBClusterAttributeResponse) - if len(response.DBClusterId) < 1 { - return nil, WrapErrorf(Error(GetNotFoundMessage("Cluster", id)), NotFoundMsg, ProviderERROR) - } return response, nil } @@ -428,7 +425,6 @@ func (s *PolarDBService) WaitForPolarDBEndpoints(d *schema.ResourceData, status } time.Sleep(DefaultIntervalShort * time.Second) } - return "", nil } func (s *PolarDBService) DescribePolarDBConnection(id string) (*polardb.Address, error) { @@ -993,7 +989,7 @@ func (s *PolarDBService) WaitForCluster(id string, status Status, timeout int) e return nil } -func (s *PolarDBService) DescribeDBSecurityIps(clusterId string) (ips []string, err error) { +func (s *PolarDBService) DescribeDBSecurityIps(clusterId string, dbClusterIPArrayName string) (ips []string, err error) { request := polardb.CreateDescribeDBClusterAccessWhitelistRequest() request.RegionId = s.client.RegionId @@ -1012,7 +1008,7 @@ func (s *PolarDBService) DescribeDBSecurityIps(clusterId string) (ips []string, var ipstr, separator string ipsMap := make(map[string]string) for _, ip := range resp.Items.DBClusterIPArray { - if ip.DBClusterIPArrayAttribute != "hidden" { + if ip.DBClusterIPArrayName == dbClusterIPArrayName { ipstr += separator + ip.SecurityIps separator = COMMA_SEPARATED } @@ -1342,7 +1338,7 @@ func (s *PolarDBService) ModifyDBAccessWhitelistSecurityIps(d *schema.ResourceDa return nil } -func (s *PolarDBService) DBClusterIPArrays(d *schema.ResourceData, attribute string) error { +func (s *PolarDBService) DBClusterIPArrays(d *schema.ResourceData, attribute string, dbClusterIPArrayName string) error { request := polardb.CreateDescribeDBClusterAccessWhitelistRequest() request.RegionId = s.client.RegionId request.DBClusterId = d.Id() @@ -1359,7 +1355,7 @@ func (s *PolarDBService) DBClusterIPArrays(d *schema.ResourceData, attribute str dbClusterIPArray := response.Items.DBClusterIPArray var dbClusterIPArrays = make([]map[string]interface{}, 0, len(dbClusterIPArray)) for _, i := range dbClusterIPArray { - if i.DBClusterIPArrayAttribute != "hidden" && i.DBClusterIPArrayName != "default" { + if i.DBClusterIPArrayName == dbClusterIPArrayName { l := map[string]interface{}{ "db_cluster_ip_array_name": i.DBClusterIPArrayName, "security_ips": convertPolarDBIpsSetToString(i.SecurityIps), diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_pvtz.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_pvtz.go index c1d3b747871..7f615404e1d 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_pvtz.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_pvtz.go @@ -2,6 +2,7 @@ package alicloud import ( "fmt" + "log" "strconv" "github.com/PaesslerAG/jsonpath" @@ -17,7 +18,7 @@ type PvtzService struct { client *connectivity.AliyunClient } -func (s *PvtzService) DescribePvtzZone(id string) (object map[string]interface{}, err error) { +func (s *PvtzService) DescribePvtzZoneBasic(id string) (object map[string]interface{}, err error) { var response map[string]interface{} conn, err := s.client.NewPvtzClient() if err != nil { @@ -249,3 +250,241 @@ func (s *PvtzService) WaitForPvtzZoneRecord(id string, status Status, timeout in } } + +func (s *PvtzService) DescribePvtzUserVpcAuthorization(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewPvtzClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeUserVpcAuthorizations" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "AuthType": parts[1], + "AuthorizedUserId": parts[0], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-01-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"System.Busy"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("PrivateZone:UserVpcAuthorization", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Users", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Users", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("PrivateZone", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["AuthType"]) != parts[1] { + return object, WrapErrorf(Error(GetNotFoundMessage("PrivateZone", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *PvtzService) DescribePvtzEndpoint(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewPvtzClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeResolverEndpoint" + request := map[string]interface{}{ + "EndpointId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-01-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"ResolverEndpoint.NotExists"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("PrivateZone:Endpoint", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *PvtzService) PvtzEndpointStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribePvtzEndpoint(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["Status"]) == failState { + return object, fmt.Sprint(object["Status"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["Status"]))) + } + } + return object, fmt.Sprint(object["Status"]), nil + } +} + +func (s *PvtzService) DescribePvtzRule(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewPvtzClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeResolverRule" + request := map[string]interface{}{ + "RuleId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-01-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"ResolverRule.NotExists"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("PrivateZone:Rule", id)), NotFoundMsg, ProviderERROR) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *PvtzService) DescribePvtzRuleAttachment(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewPvtzClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeResolverRule" + request := map[string]interface{}{ + "RuleId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-01-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"ResolverRule.NotExists"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("PrivateZone:RuleAttachment", id)), NotFoundMsg, ProviderERROR) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *PvtzService) DescribeSyncEcsHostTask(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewPvtzClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeSyncEcsHostTask" + request := map[string]interface{}{ + "ZoneId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-01-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if IsExpectedErrors(err, []string{"System.Busy", "Ecs.SyncTask.NotExists", "ServiceUnavailable", "Throttling.User"}) { + err = WrapErrorf(Error(GetNotFoundMessage("PvtzZone", id)), NotFoundMsg, ProviderERROR) + return object, err + } + err = WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + return object, err + } + addDebug(action, response, request) + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *PvtzService) DescribePvtzZone(id string) (object map[string]interface{}, err error) { + object, err = s.DescribePvtzZoneBasic(id) + if err != nil { + return nil, WrapError(err) + } + syncObj, err := s.DescribeSyncEcsHostTask(id) + if err != nil { + if NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_pvtz_zone pvtzService.DescribeSyncEcsHostTask Failed!!! %s", err) + return object, nil + } + return nil, WrapError(err) + } + object["SyncHostTask"] = syncObj + return object, nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_quickbi_public.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_quickbi_public.go new file mode 100644 index 00000000000..11eb5e8a023 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_quickbi_public.go @@ -0,0 +1,93 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +type QuickbiPublicService struct { + client *connectivity.AliyunClient +} + +func (s *QuickbiPublicService) DescribeQuickBiUser(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewQuickbiClient() + if err != nil { + return nil, WrapError(err) + } + action := "QueryUserInfoByUserId" + request := map[string]interface{}{ + "UserId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-08-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"User.Not.In.Organization"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("QuickBI:User", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Result", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Result", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *QuickbiPublicService) QueryUserInfoByUserId(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewQuickbiClient() + if err != nil { + return nil, WrapError(err) + } + action := "QueryUserInfoByUserId" + request := map[string]interface{}{ + "UserId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-08-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"User.Not.In.Organization"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("QuickBI:User", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Result", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Result", response) + } + object = v.(map[string]interface{}) + return object, nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_ram.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_ram.go index b3b7ff08089..fff7b9e5286 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_ram.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_ram.go @@ -212,7 +212,8 @@ func (s *RamService) DescribeRamUser(id string) (*ram.UserInGetUser, error) { addDebug(listUsersRequest.GetActionName(), raw, listUsersRequest.RegionId, listUsersRequest) response, _ := raw.(*ram.ListUsersResponse) for _, user := range response.Users.User { - if user.UserId == id { + // the d.Id() has changed from userName to userId since v1.44.0, add the logic for backward compatibility. + if user.UserId == id || user.UserName == id { userName = user.UserName break } @@ -224,8 +225,7 @@ func (s *RamService) DescribeRamUser(id string) (*ram.UserInGetUser, error) { } if userName == "" { - // the d.Id() has changed from userName to userId since v1.44.0, add the logic for backward compatibility. - userName = id + return user, WrapErrorf(fmt.Errorf("there is no ram user with id or name is %s", id), NotFoundMsg, AlibabaCloudSdkGoERROR) } getUserRequest := ram.CreateGetUserRequest() getUserRequest.RegionId = s.client.RegionId @@ -375,7 +375,7 @@ func (s *RamService) DescribeRamGroupPolicyAttachment(id string) (*ram.PolicyInL listPoliciesForGroupResponse, _ := raw.(*ram.ListPoliciesForGroupResponse) if len(listPoliciesForGroupResponse.Policies.Policy) > 0 { for _, v := range listPoliciesForGroupResponse.Policies.Policy { - if v.PolicyName == parts[1] && v.PolicyType == parts[2] { + if v.PolicyType == parts[2] && (v.PolicyName == parts[1] || strings.ToLower(v.PolicyName) == strings.ToLower(parts[1])) { return &v, nil } } @@ -664,7 +664,7 @@ func (s *RamService) DescribeRamUserPolicyAttachment(id string) (*ram.PolicyInLi if len(listPoliciesForUserResponse.Policies.Policy) > 0 { for _, v := range listPoliciesForUserResponse.Policies.Policy { - if v.PolicyName == parts[1] && v.PolicyType == parts[2] { + if v.PolicyType == parts[2] && (v.PolicyName == parts[1] || strings.ToLower(v.PolicyName) == strings.ToLower(parts[1])) { return &v, nil } } @@ -733,7 +733,7 @@ func (s *RamService) DescribeRamRolePolicyAttachment(id string) (*ram.PolicyInLi if len(listPoliciesForRoleResponse.Policies.Policy) > 0 { for _, v := range listPoliciesForRoleResponse.Policies.Policy { - if v.PolicyName == parts[1] && v.PolicyType == parts[2] { + if v.PolicyType == parts[2] && (v.PolicyName == parts[1] || strings.ToLower(v.PolicyName) == strings.ToLower(parts[1])) { return &v, nil } } @@ -828,3 +828,37 @@ func (s *RamService) DescribeRamAccountPasswordPolicy(id string) (*ram.GetPasswo return response, nil } + +func (s *RamService) DescribeRamSecurityPreference(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewImsClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetSecurityPreference" + request := map[string]interface{}{} + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-08-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.SecurityPreference", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.SecurityPreference", response) + } + object = v.(map[string]interface{}) + return object, nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_rds.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_rds.go index 5114ff06c3f..e57215fe69d 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_rds.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_rds.go @@ -235,11 +235,38 @@ func (s *RdsService) DescribeParameters(id string) (map[string]interface{}, erro return response, err } +func (s *RdsService) SetTimeZone(d *schema.ResourceData) error { + targetParameterName := "" + engine := d.Get("engine") + if engine == string(MySQL) { + targetParameterName = "default_time_zone" + } else if engine == string(PostgreSQL) { + targetParameterName = "timezone" + } + + if targetParameterName != "" { + paramsRes, err := s.DescribeParameters(d.Id()) + if err != nil { + return WrapError(err) + } + parameters := paramsRes["RunningParameters"].(map[string]interface{})["DBInstanceParameter"].([]interface{}) + for _, item := range parameters { + item := item.(map[string]interface{}) + parameterName := item["ParameterName"] + + if parameterName == targetParameterName { + d.Set("db_time_zone", item["ParameterValue"]) + break + } + } + } + return nil +} + func (s *RdsService) RefreshParameters(d *schema.ResourceData, attribute string) error { var param []map[string]interface{} documented, ok := d.GetOk(attribute) if !ok { - d.Set(attribute, param) return nil } object, err := s.DescribeParameters(d.Id()) @@ -280,8 +307,10 @@ func (s *RdsService) RefreshParameters(d *schema.ResourceData, attribute string) } } } - if err := d.Set(attribute, param); err != nil { - return WrapError(err) + if len(param) > 0 { + if err := d.Set(attribute, param); err != nil { + return WrapError(err) + } } return nil } @@ -652,6 +681,11 @@ func (s *RdsService) ModifyDBBackupPolicy(d *schema.ResourceData, updateForData, archiveBackupKeepPolicy = v.(string) } + releasedKeepPolicy := "" + if v, ok := d.GetOk("released_keep_policy"); ok { + releasedKeepPolicy = v.(string) + } + instance, err := s.DescribeDBInstance(d.Id()) if err != nil { return WrapError(err) @@ -671,6 +705,7 @@ func (s *RdsService) ModifyDBBackupPolicy(d *schema.ResourceData, updateForData, "CompressType": compressType, "BackupPolicyMode": "DataBackupPolicy", "SourceIp": s.client.SourceIp, + "ReleasedKeepPolicy": releasedKeepPolicy, } if instance["Engine"] == "SQLServer" && logBackupFrequency == "LogInterval" { request["LogBackupFrequency"] = logBackupFrequency @@ -765,7 +800,30 @@ func (s *RdsService) DescribeDBSecurityIps(instanceId string) ([]interface{}, er return response["Items"].(map[string]interface{})["DBInstanceIPArray"].([]interface{}), nil } -func (s *RdsService) GetSecurityIps(instanceId string) ([]string, error) { +func (s *RdsService) DescribeParameterTemplates(instanceId, engine, engineVersion string) ([]interface{}, error) { + action := "DescribeParameterTemplates" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "DBInstanceId": instanceId, + "Engine": engine, + "EngineVersion": engineVersion, + "SourceIp": s.client.SourceIp, + } + conn, err := s.client.NewRdsClient() + if err != nil { + return nil, WrapError(err) + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + response, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + return nil, WrapErrorf(err, DefaultErrorMsg, instanceId, action, AlibabaCloudSdkGoERROR) + } + addDebug(action, response, request) + return response["Parameters"].(map[string]interface{})["TemplateRecord"].([]interface{}), nil +} + +func (s *RdsService) GetSecurityIps(instanceId string, dbInstanceIpArrayName string) ([]string, error) { object, err := s.DescribeDBSecurityIps(instanceId) if err != nil { return nil, WrapError(err) @@ -775,11 +833,10 @@ func (s *RdsService) GetSecurityIps(instanceId string) ([]string, error) { ipsMap := make(map[string]string) for _, ip := range object { ip := ip.(map[string]interface{}) - if ip["DBInstanceIPArrayAttribute"] == "hidden" { - continue + if ip["DBInstanceIPArrayName"].(string) == dbInstanceIpArrayName { + ips += separator + ip["SecurityIPList"].(string) + separator = COMMA_SEPARATED } - ips += separator + ip["SecurityIPList"].(string) - separator = COMMA_SEPARATED } for _, ip := range strings.Split(ips, COMMA_SEPARATED) { @@ -1077,7 +1134,7 @@ func (s *RdsService) WaitForDBInstance(id string, status Status, timeout int) er return WrapError(err) } } - if object != nil && strings.ToLower(object["DBInstanceStatus"].(string)) == strings.ToLower(string(status)) { + if object != nil && strings.ToLower(fmt.Sprint(object["DBInstanceStatus"])) == strings.ToLower(string(status)) { break } time.Sleep(DefaultIntervalShort * time.Second) @@ -1388,25 +1445,28 @@ func (s *RdsService) flattenDBSecurityIPs(list []interface{}) []map[string]inter func (s *RdsService) setInstanceTags(d *schema.ResourceData) error { if d.HasChange("tags") { - oraw, nraw := d.GetChange("tags") - o := oraw.(map[string]interface{}) - n := nraw.(map[string]interface{}) - remove, add := diffRdsTags(o, n) - - if len(remove) > 0 { - conn, err := s.client.NewRdsClient() - if err != nil { - return WrapError(err) + added, removed := parsingTags(d) + conn, err := s.client.NewRdsClient() + if err != nil { + return WrapError(err) + } + removedTagKeys := make([]string, 0) + for _, v := range removed { + if !ignoredTags(v, "") { + removedTagKeys = append(removedTagKeys, v) } - action := "UntagResources" + } + if len(removedTagKeys) > 0 { + action := "UnTagResources" request := map[string]interface{}{ - "ResourceId": &[]string{d.Id()}, - "ResourceType": "INSTANCE", - "TagKey": &remove, "RegionId": s.client.RegionId, + "ResourceType": "INSTANCE", + "ResourceId.1": d.Id(), "SourceIp": s.client.SourceIp, } - + for i, key := range removedTagKeys { + request[fmt.Sprintf("TagKey.%d", i+1)] = key + } wait := incrementalWait(1*time.Second, 2*time.Second) runtime := util.RuntimeOptions{} err = resource.Retry(10*time.Minute, func() *resource.RetryError { @@ -1426,19 +1486,20 @@ func (s *RdsService) setInstanceTags(d *schema.ResourceData) error { } } - if len(add) > 0 { - conn, err := s.client.NewRdsClient() - if err != nil { - return WrapError(err) - } + if len(added) > 0 { action := "TagResources" request := map[string]interface{}{ - "ResourceId": &[]string{d.Id()}, - "Tag": &add, - "ResourceType": "INSTANCE", "RegionId": s.client.RegionId, - "SourceIp": s.client.SourceIp, + "ResourceType": "INSTANCE", + "ResourceId.1": d.Id(), + } + count := 1 + for key, value := range added { + request[fmt.Sprintf("Tag.%d.Key", count)] = key + request[fmt.Sprintf("Tag.%d.Value", count)] = value + count++ } + wait := incrementalWait(1*time.Second, 2*time.Second) runtime := util.RuntimeOptions{} err = resource.Retry(10*time.Minute, func() *resource.RetryError { @@ -1668,7 +1729,6 @@ func (s *RdsService) RdsAccountStateRefreshFunc(id string, failStates []string) } return nil, "", WrapError(err) } - for _, failState := range failStates { if object["AccountStatus"].(string) == failState { return object, object["AccountStatus"].(string), WrapError(Error(FailedToReachTargetStatus, object["AccountStatus"].(string))) @@ -1677,3 +1737,260 @@ func (s *RdsService) RdsAccountStateRefreshFunc(id string, failStates []string) return object, object["AccountStatus"].(string), nil } } + +func (s *RdsService) DescribeRdsBackup(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewRdsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeBackups" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "SourceIp": s.client.SourceIp, + "BackupId": parts[1], + "DBInstanceId": parts[0], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Items.Backup", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Items.Backup", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("RDS", id)), NotFoundWithResponse, response) + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *RdsService) DescribeBackupTasks(id string, backupJobId string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewRdsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeBackupTasks" + request := map[string]interface{}{ + "SourceIp": s.client.SourceIp, + "DBInstanceId": id, + "BackupJobId": backupJobId, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Items.BackupJob", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Items.BackupJob", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("RDS", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["BackupJobId"]) != backupJobId { + return object, WrapErrorf(Error(GetNotFoundMessage("RDS", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *RdsService) RdsBackupStateRefreshFunc(id string, backupJobId string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeBackupTasks(id, backupJobId) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if object["BackupStatus"] == failState { + return object, object["BackupStatus"].(string), WrapError(Error(FailedToReachTargetStatus, object["BackupStatus"])) + } + } + return object, object["BackupStatus"].(string), nil + } +} + +func (s *RdsService) DescribeDBInstanceHAConfig(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewRdsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeDBInstanceHAConfig" + request := map[string]interface{}{ + "SourceIp": s.client.SourceIp, + "DBInstanceId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *RdsService) DescribeRdsCloneDbInstance(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewRdsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeDBInstanceAttribute" + request := map[string]interface{}{ + "SourceIp": s.client.SourceIp, + "DBInstanceId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Items.DBInstanceAttribute", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Items.DBInstanceAttribute", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("RDS", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["DBInstanceId"]) != id { + return object, WrapErrorf(Error(GetNotFoundMessage("RDS", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *RdsService) DescribeUpgradeMajorVersionPrecheckTask(id string, taskId int) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewRdsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeUpgradeMajorVersionPrecheckTask" + request := map[string]interface{}{ + "SourceIp": s.client.SourceIp, + "DBInstanceId": id, + "TaskId": taskId, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-08-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Items", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Items", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("RDS", id)), NotFoundWithResponse, response) + } else { + if formatInt(v.([]interface{})[0].(map[string]interface{})["TaskId"]) != taskId { + return object, WrapErrorf(Error(GetNotFoundMessage("RDS", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *RdsService) RdsUpgradeMajorVersionRefreshFunc(id string, taskId int, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeUpgradeMajorVersionPrecheckTask(id, taskId) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if object["Result"] == failState { + return object, object["Result"].(string), WrapError(Error(FailedToReachTargetStatus, object["Result"])) + } + } + return object, object["Result"].(string), nil + } +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_ros.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_ros.go index 88a8828cb2b..a062e156805 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_ros.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_ros.go @@ -359,3 +359,130 @@ func (s *RosService) DescribeRosTemplate(id string) (object map[string]interface object = v.(map[string]interface{}) return object, nil } + +func (s *RosService) DescribeRosStackInstance(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewRosClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetStackInstance" + parts, err := ParseResourceId(id, 3) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "StackGroupName": parts[0], + "StackInstanceAccountId": parts[1], + "StackInstanceRegionId": parts[2], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-10"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"StackInstanceNotFound", "StackGroupNotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("ROS:StackInstance", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.StackInstance", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.StackInstance", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *RosService) RosStackInstanceStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeRosStackInstance(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["Status"]) == failState { + return object, fmt.Sprint(object["Status"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["Status"]))) + } + } + return object, fmt.Sprint(object["Status"]), nil + } +} + +func (s *RosService) DescribeRosTemplateScratch(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewRosClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetTemplateScratch" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "TemplateScratchId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-10"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"TemplateScratchNotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("ROS:TemplateScratch", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.TemplateScratch", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.TemplateScratch", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *RosService) RosTemplateScratchStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeRosTemplateScratch(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["Status"]) == failState { + return object, fmt.Sprint(object["Status"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["Status"]))) + } + } + return object, fmt.Sprint(object["Status"]), nil + } +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_sae.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_sae.go index 6f7159151bf..e0d2217025c 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_sae.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_sae.go @@ -1,13 +1,16 @@ package alicloud import ( + "encoding/json" "fmt" + "strconv" "time" "github.com/PaesslerAG/jsonpath" util "github.com/alibabacloud-go/tea-utils/service" "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) type SaeService struct { @@ -112,3 +115,446 @@ func (s *SaeService) DescribeSaeConfigMap(id string) (object map[string]interfac object = v.(map[string]interface{}) return object, nil } + +func (s *SaeService) DescribeApplicationStatus(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewServerlessClient() + if err != nil { + return nil, WrapError(err) + } + action := "/pop/v1/sam/app/describeApplicationStatus" + request := map[string]*string{ + "AppId": StringPointer(id), + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer("2019-05-06"), nil, StringPointer("GET"), StringPointer("AK"), StringPointer(action), request, nil, nil, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + if respBody, isExist := response["body"]; isExist { + response = respBody.(map[string]interface{}) + } else { + return object, WrapError(fmt.Errorf("%s failed, response: %v", "Put "+action, response)) + } + if fmt.Sprint(response["Success"]) == "false" { + return object, WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + v, err := jsonpath.Get("$.Data", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Data", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *SaeService) DescribeSaeApplication(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewServerlessClient() + if err != nil { + return nil, WrapError(err) + } + action := "/pop/v1/sam/app/describeApplicationConfig" + request := map[string]*string{ + "AppId": StringPointer(id), + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer("2019-05-06"), nil, StringPointer("GET"), StringPointer("AK"), StringPointer(action), request, nil, nil, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidAppId.NotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("SAE:Application", id)), NotFoundMsg, ProviderERROR) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + if respBody, isExist := response["body"]; isExist { + response = respBody.(map[string]interface{}) + } else { + return object, WrapError(fmt.Errorf("%s failed, response: %v", "Put "+action, response)) + } + if fmt.Sprint(response["Success"]) == "false" { + return object, WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + v, err := jsonpath.Get("$.Data", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Data", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *SaeService) DescribeSaeIngress(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewServerlessClient() + if err != nil { + return nil, WrapError(err) + } + action := "/pop/v1/sam/ingress/Ingress" + request := map[string]*string{ + "IngressId": StringPointer(id), + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer("2019-05-06"), nil, StringPointer("GET"), StringPointer("AK"), StringPointer(action), request, nil, nil, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + if IsExpectedErrors(err, []string{"InvalidParameter.WithMessage"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("SAE:Ingress", id)), NotFoundMsg, ProviderERROR) + } + addDebug(action, response, request) + + if respBody, isExist := response["body"]; isExist { + response = respBody.(map[string]interface{}) + } else { + return object, WrapError(fmt.Errorf("%s failed, response: %v", "GET "+action, response)) + } + if fmt.Sprint(response["Success"]) == "false" { + return object, WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + v, err := jsonpath.Get("$.Data", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Data", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *SaeService) DescribeApplicationImage(id, imageUrl string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewServerlessClient() + if err != nil { + return nil, WrapError(err) + } + action := "/pop/v1/sam/container/describeApplicationImage" + request := map[string]*string{ + "AppId": StringPointer(id), + "ImageUrl": StringPointer(imageUrl), + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer("2019-05-06"), nil, StringPointer("GET"), StringPointer("AK"), StringPointer(action), request, nil, nil, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + if respBody, isExist := response["body"]; isExist { + response = respBody.(map[string]interface{}) + } else { + return object, WrapError(fmt.Errorf("%s failed, response: %v", "Put "+action, response)) + } + if fmt.Sprint(response["Success"]) == "false" { + return object, WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + v, err := jsonpath.Get("$.Data", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Data", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *SaeService) DescribeIngress(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewServerlessClient() + if err != nil { + return nil, WrapError(err) + } + + action := "DescribeIngress" + request := map[string]*string{ + "IngressId": StringPointer(id), + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer("2019-05-06"), nil, StringPointer("GET"), StringPointer("AK"), StringPointer(action), request, nil, nil, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + if respBody, isExist := response["body"]; isExist { + response = respBody.(map[string]interface{}) + } else { + return object, WrapError(fmt.Errorf("%s failed, response: %v", "GET "+action, response)) + } + if fmt.Sprint(response["Success"]) == "false" { + return object, WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + v, err := jsonpath.Get("$.Data", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Data", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *SaeService) DescribeApplicationSlb(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewServerlessClient() + if err != nil { + return nil, WrapError(err) + } + action := "/pop/v1/sam/app/slb" + request := map[string]*string{ + "AppId": StringPointer(id), + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer("2019-05-06"), nil, StringPointer("GET"), StringPointer("AK"), StringPointer(action), request, nil, nil, &util.RuntimeOptions{}) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + if respBody, isExist := response["body"]; isExist { + response = respBody.(map[string]interface{}) + } else { + return object, WrapError(fmt.Errorf("%s failed, response: %v", "Put "+action, response)) + } + if fmt.Sprint(response["Success"]) == "false" { + return object, WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + v, err := jsonpath.Get("$.Data", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Data", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *SaeService) UpdateSlb(d *schema.ResourceData) error { + if d.HasChange("intranet") || d.HasChange("internet") || d.HasChange("internet_slb_id") || d.HasChange("intranet_slb_id") { + update := false + request := map[string]*string{ + "AppId": StringPointer(d.Id()), + } + //unbind intranet + if d.HasChange("intranet") { + oraw, nraw := d.GetChange("intranet") + remove := oraw.(*schema.Set).Difference(nraw.(*schema.Set)).List() + if len(remove) != 0 { + update = true + request["Intranet"] = StringPointer(strconv.FormatBool(true)) + } + } + //unbind internet + if d.HasChange("internet") { + oraw, nraw := d.GetChange("internet") + remove := oraw.(*schema.Set).Difference(nraw.(*schema.Set)).List() + if len(remove) != 0 { + update = true + request["Internet"] = StringPointer(strconv.FormatBool(true)) + } + } + if update { + action := "/pop/v1/sam/app/slb" + conn, err := s.client.NewServerlessClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + var response map[string]interface{} + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer("2019-05-06"), nil, StringPointer("DELETE"), StringPointer("AK"), StringPointer(action), request, nil, nil, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"Application.InvalidStatus", "Application.ChangerOrderRunning"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), "POST "+action, AlibabaCloudSdkGoERROR) + } + if respBody, isExist := response["body"]; isExist { + response = respBody.(map[string]interface{}) + } else { + return WrapError(fmt.Errorf("%s failed, response: %v", "POST "+action, response)) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", "POST "+action, response)) + } + return nil + } + + update = false + request = map[string]*string{ + "AppId": StringPointer(d.Id()), + } + if d.HasChange("internet_slb_id") { + update = true + if v, exist := d.GetOk("internet_slb_id"); exist { + request["InternetSlbId"] = StringPointer(v.(string)) + } + + } + if d.HasChange("intranet_slb_id") { + update = true + if v, exist := d.GetOk("intranet_slb_id"); exist { + request["IntranetSlbId"] = StringPointer(v.(string)) + } + + } + if d.HasChange("intranet") { + update = true + for _, intranet := range d.Get("intranet").(*schema.Set).List() { + intranetMap := intranet.(map[string]interface{}) + intranetReq := []interface{}{ + map[string]interface{}{ + "httpsCertId": intranetMap["https_cert_id"], + "protocol": intranetMap["protocol"], + "targetPort": intranetMap["target_port"], + "port": intranetMap["port"], + }, + } + obj, err := json.Marshal(intranetReq) + if err != nil { + return WrapError(err) + } + request["Intranet"] = StringPointer(string(obj)) + } + } + + if d.HasChange("internet") { + update = true + for _, internet := range d.Get("internet").(*schema.Set).List() { + internetMap := internet.(map[string]interface{}) + internetReq := []interface{}{ + map[string]interface{}{ + "httpsCertId": internetMap["https_cert_id"], + "protocol": internetMap["protocol"], + "targetPort": internetMap["target_port"], + "port": internetMap["port"], + }, + } + obj, err := json.Marshal(internetReq) + if err != nil { + return WrapError(err) + } + request["Internet"] = StringPointer(string(obj)) + } + } + + if update { + action := "/pop/v1/sam/app/slb" + conn, err := s.client.NewServerlessClient() + if err != nil { + return WrapError(err) + } + wait := incrementalWait(3*time.Second, 3*time.Second) + var response map[string]interface{} + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer("2019-05-06"), nil, StringPointer("POST"), StringPointer("AK"), StringPointer(action), request, nil, nil, &util.RuntimeOptions{}) + if err != nil { + if IsExpectedErrors(err, []string{"Application.InvalidStatus", "Application.ChangerOrderRunning"}) || NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), "POST "+action, AlibabaCloudSdkGoERROR) + } + if respBody, isExist := response["body"]; isExist { + response = respBody.(map[string]interface{}) + } else { + return WrapError(fmt.Errorf("%s failed, response: %v", "POST "+action, response)) + } + if fmt.Sprint(response["Success"]) == "false" { + return WrapError(fmt.Errorf("%s failed, response: %v", "POST "+action, response)) + } + } + } + return nil +} + +func (s *SaeService) SaeApplicationStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeApplicationStatus(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil if nothing matched + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["LastChangeOrderStatus"]) == failState { + return object, fmt.Sprint(object["LastChangeOrderStatus"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["LastChangeOrderStatus"]))) + } + } + return object, fmt.Sprint(object["LastChangeOrderStatus"]), nil + } +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_sag.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_sag.go index 8e77828d1b5..9347d92252f 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_sag.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_sag.go @@ -205,82 +205,6 @@ func (s *SagService) DescribeSagAclRule(id string) (c smartag.Acr, err error) { return c, WrapErrorf(Error(GetNotFoundMessage("Sag Acl Rule", id)), NotFoundMsg, ProviderERROR) } -func (s *SagService) DescribeSagNetworkopt(id string) (c smartag.NetworkOptimization, err error) { - request := smartag.CreateDescribeNetworkOptimizationsRequest() - request.RegionId = s.client.RegionId - request.NetworkOptId = id - - var raw interface{} - err = resource.Retry(5*time.Minute, func() *resource.RetryError { - raw, err = s.client.WithSagClient(func(sagClient *smartag.Client) (interface{}, error) { - return sagClient.DescribeNetworkOptimizations(request) - }) - if err != nil { - if IsExpectedErrors(err, []string{AliyunGoClientFailure, "ServiceUnavailable", Throttling, "Throttling.User"}) { - time.Sleep(DefaultIntervalShort * time.Second) - return resource.RetryableError(err) - } - return resource.NonRetryableError(err) - } - addDebug(request.GetActionName(), raw, request.RpcRequest, request) - return nil - }) - if err != nil { - if IsExpectedErrors(err, []string{"SagNetworkoptNotExist"}) { - return c, WrapErrorf(err, NotFoundMsg, AlibabaCloudSdkGoERROR) - } - return c, WrapErrorf(err, DefaultErrorMsg, id, request.GetActionName(), AlibabaCloudSdkGoERROR) - } - - response, _ := raw.(*smartag.DescribeNetworkOptimizationsResponse) - if len(response.NetworkOptimizations.NetworkOptimization) <= 0 || response.NetworkOptimizations.NetworkOptimization[0].InstanceId != id { - return c, WrapErrorf(Error(GetNotFoundMessage("Sag Networkopt", id)), NotFoundMsg, ProviderERROR) - } - c = response.NetworkOptimizations.NetworkOptimization[0] - return c, nil -} - -func (s *SagService) DescribeSagNetworkoptSetting(id string) (c smartag.Setting, err error) { - parts, err := ParseResourceId(id, 3) - if err != nil { - return c, WrapError(err) - } - - request := smartag.CreateDescribeNetworkOptimizationSettingsRequest() - request.RegionId = s.client.RegionId - request.NetworkOptId = parts[0] - - var raw interface{} - err = resource.Retry(5*time.Minute, func() *resource.RetryError { - raw, err = s.client.WithSagClient(func(sagClient *smartag.Client) (interface{}, error) { - return sagClient.DescribeNetworkOptimizationSettings(request) - }) - if err != nil { - if IsExpectedErrors(err, []string{AliyunGoClientFailure, "ServiceUnavailable", Throttling, "Throttling.User"}) { - time.Sleep(DefaultIntervalShort * time.Second) - return resource.RetryableError(err) - } - return resource.NonRetryableError(err) - } - addDebug(request.GetActionName(), raw, request.RpcRequest, request) - return nil - }) - if err != nil { - if IsExpectedErrors(err, []string{"SagNetworkoptSettingNotExist"}) { - return c, WrapErrorf(err, NotFoundMsg, AlibabaCloudSdkGoERROR) - } - return c, WrapErrorf(err, DefaultErrorMsg, id, request.GetActionName(), AlibabaCloudSdkGoERROR) - } - - response, _ := raw.(*smartag.DescribeNetworkOptimizationSettingsResponse) - for _, value := range response.Settings.Setting { - if value.Type == parts[1] && value.Domain == parts[2] { - return value, nil - } - } - return c, WrapErrorf(Error(GetNotFoundMessage("Sag Networkopt Setting", id)), NotFoundMsg, ProviderERROR) -} - func (s *SagService) DescribeSagClientUser(id string) (c smartag.User, err error) { parts, err := ParseResourceId(id, 2) if err != nil { diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_sas.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_sas.go new file mode 100644 index 00000000000..2d51b855cc4 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_sas.go @@ -0,0 +1,115 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +type SasService struct { + client *connectivity.AliyunClient +} + +func (s *SasService) DescribeAllGroups(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewSasClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeAllGroups" + request := map[string]interface{}{} + idExist := false + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-12-03"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Groups", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Groups", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("SecurityCenter", id)), NotFoundWithResponse, response) + } + for _, vv := range v.([]interface{}) { + if fmt.Sprint(vv.(map[string]interface{})["GroupId"]) == id { + idExist = true + return vv.(map[string]interface{}), nil + } + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("SecurityCenter", id)), NotFoundWithResponse, response) + } + return object, nil +} + +func (s *SasService) DescribeSecurityCenterServiceLinkedRole(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewSasClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeServiceLinkedRoleStatus" + request := map[string]interface{}{} + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("GET"), StringPointer("2018-12-03"), StringPointer("AK"), request, nil, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.RoleStatus", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.RoleStatus", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *SasService) SecurityCenterServiceLinkedRoleStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeSecurityCenterServiceLinkedRole(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["Status"]) == failState { + return object, fmt.Sprint(object["Status"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["Status"]))) + } + } + return object, fmt.Sprint(object["Status"]), nil + } +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_sddp.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_sddp.go index 2d47dd80d58..40d59d479c6 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_sddp.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_sddp.go @@ -69,3 +69,85 @@ func (s *SddpService) DescribeSddpRule(id string) (object map[string]interface{} } return } + +func (s *SddpService) DescribeSddpConfig(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewSddpClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeConfigs" + request := map[string]interface{}{ + "Lang": "zh", + } + idExist := false + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-01-03"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.ConfigList", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.ConfigList", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("SDDP", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["Code"]) == id { + idExist = true + return v.(map[string]interface{}), nil + } + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("SDDP", id)), NotFoundWithResponse, response) + } + return object, nil +} + +func (s *SddpService) DescribeSddpInstance(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewSddpClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeUserStatus" + request := map[string]interface{}{} + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-01-03"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.UserStatus", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.UserStatus", response) + } + object = v.(map[string]interface{}) + return object, nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_servicemesh.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_servicemesh.go new file mode 100644 index 00000000000..ff34ae5dc95 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_servicemesh.go @@ -0,0 +1,110 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +type ServicemeshService struct { + client *connectivity.AliyunClient +} + +func (s *ServicemeshService) DescribeServiceMeshServiceMesh(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewServicemeshClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeServiceMeshDetail" + request := map[string]interface{}{ + "ServiceMeshId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-11"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"ServiceMesh.NotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("ServiceMesh:ServiceMesh", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.ServiceMesh", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.ServiceMesh", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *ServicemeshService) DescribeServiceMeshDetail(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewServicemeshClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeServiceMeshDetail" + request := map[string]interface{}{ + "ServiceMeshId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-01-11"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.ServiceMesh", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.ServiceMesh", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *ServicemeshService) ServiceMeshServiceMeshStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeServiceMeshServiceMesh(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["ServiceMeshInfo"].(map[string]interface{})["State"]) == failState { + return object, fmt.Sprint(object["ServiceMeshInfo"].(map[string]interface{})["State"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["ServiceMeshInfo.State"]))) + } + } + return object, fmt.Sprint(object["ServiceMeshInfo"].(map[string]interface{})["State"]), nil + } +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_sgw.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_sgw.go index 6739c565233..e3064db5f27 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_sgw.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_sgw.go @@ -128,3 +128,480 @@ func (s *SgwService) DescribeGateway(id string) (object map[string]interface{}, object = v.(map[string]interface{}) return object, nil } + +func (s *SgwService) DescribeCloudStorageGatewayGatewaySmbUser(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewHcsSgwClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeGatewaySMBUsers" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "GatewayId": parts[0], + "PageSize": PageSizeLarge, + "PageNumber": 1, + } + idExist := false + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-05-11"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"GatewayNotExist"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudStorageGateway:Gateway", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return object, WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + v, err := jsonpath.Get("$.Users.User", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Users.User", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudStorageGateway", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["Username"]) == parts[1] { + idExist = true + return v.(map[string]interface{}), nil + } + } + if len(v.([]interface{})) < request["PageSize"].(int) { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudStorageGateway", id)), NotFoundWithResponse, response) + } + return +} + +func (s *SgwService) DescribeTasks(id, taskId string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewHcsSgwClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeTasks" + request := map[string]interface{}{ + "TargetId": id, + "PageSize": PageSizeLarge, + "PageNumber": 1, + } + if taskId != "" { + request["TaskId"] = taskId + } + idExist := false + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-05-11"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"GatewayNotExist"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudStorageGateway:Gateway:Task", id+":"+taskId)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return object, WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + v, err := jsonpath.Get("$.Tasks.SimpleTask", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Tasks.SimpleTask", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudStorageGateway Task", id+":"+taskId)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if taskId != "" && fmt.Sprint(v.(map[string]interface{})["TaskId"]) == taskId { + idExist = true + return v.(map[string]interface{}), nil + } + } + if len(v.([]interface{})) < request["PageSize"].(int) { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudStorageGateway Task", id+":"+taskId)), NotFoundWithResponse, response) + } + return +} + +func (s *SgwService) CloudStorageGatewayTaskStateRefreshFunc(id, taskId string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeTasks(id, taskId) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["StateCode"]) == failState { + return object, fmt.Sprint(object["StateCode"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["StateCode"]))) + } + } + return object, fmt.Sprint(object["StateCode"]), nil + } +} + +func (s *SgwService) DescribeCloudStorageGatewayGatewayCacheDisk(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewHcsSgwClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeGatewayCaches" + parts, err := ParseResourceId(id, 3) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "GatewayId": parts[0], + } + idExist := false + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-05-11"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"GatewayNotExist"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudStorageGateway:Gateway:CacheDisk", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return object, WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + v, err := jsonpath.Get("$.Caches.Cache", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Caches.Cache", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudStorageGateway", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["CacheId"]) == parts[1] { + idExist = true + return v.(map[string]interface{}), nil + } + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudStorageGateway", id)), NotFoundWithResponse, response) + } + return object, nil +} + +func (s *SgwService) DescribeCloudStorageGatewayGatewayLogging(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewHcsSgwClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeGatewayLogging" + request := map[string]interface{}{ + "GatewayId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-05-11"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"GatewayNotExist"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudStorageGateway:GatewayLogging", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return object, WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + if v, ok := object["GatewayLoggingStatus"]; ok && v == "None" { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudStorageGateway:GatewayLogging", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, nil +} + +func (s *SgwService) DescribeCloudStorageGatewayGatewayBlockVolume(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewHcsSgwClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeGatewayBlockVolumes" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "GatewayId": parts[0], + "IndexId": parts[1], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-05-11"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"GatewayNotExist"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudStorageGateway:BlockVolume", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return object, WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + v, err := jsonpath.Get("$.BlockVolumes.BlockVolume", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.BlockVolumes.BlockVolume", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudStorageGateway", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["IndexId"]) != parts[1] { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudStorageGateway", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *SgwService) DescribeCloudStorageGatewayGatewayFileShare(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewHcsSgwClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeGatewayFileShares" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "GatewayId": parts[0], + "IndexId": parts[1], + "Refresh": true, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-05-11"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"GatewayNotExist"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudStorageGateway:Gateway:CacheDisk", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return object, WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + v, err := jsonpath.Get("$.FileShares.FileShare", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.FileShares.FileShare", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudStorageGateway", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["IndexId"]) != parts[1] { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudStorageGateway", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *SgwService) DescribeExpressSyncShares(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewHcsSgwClient() + if err != nil { + return nil, WrapError(err) + } + parts, err := ParseResourceId(id, 3) + if err != nil { + return nil, err + } + + action := "DescribeExpressSyncShares" + request := map[string]interface{}{ + "ExpressSyncIds": parts[0], + } + idExist := false + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-05-11"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"GatewayNotExist", "ExpressSyncNotExist"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudStorageGateway:ExpressSyncShareAttachment", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return object, WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + v, err := jsonpath.Get("$.Shares.Share", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Shares.Share", response) + } + + for _, v := range v.([]interface{}) { + item := v.(map[string]interface{}) + if fmt.Sprint(item["GatewayId"]) == parts[1] && fmt.Sprint(item["ShareName"]) == parts[2] { + idExist = true + return item, nil + } + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudStorageGateway", id)), NotFoundWithResponse, response) + } + return object, nil +} + +func (s *SgwService) DescribeExpressSyncs(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewHcsSgwClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeExpressSyncs" + request := map[string]interface{}{} + idExist := false + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-05-11"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"GatewayNotExist", "ExpressSyncNotExist"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudStorageGateway:ExpressSync", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + if fmt.Sprint(response["Success"]) == "false" { + return object, WrapError(fmt.Errorf("%s failed, response: %v", action, response)) + } + v, err := jsonpath.Get("$.ExpressSyncs.ExpressSync", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.ExpressSyncs.ExpressSync", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudStorageGateway", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["ExpressSyncId"]) == id { + idExist = true + return v.(map[string]interface{}), nil + } + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("CloudStorageGateway", id)), NotFoundWithResponse, response) + } + return object, nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_slb.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_slb.go index 74e4d67fe4f..91078485962 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_slb.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_slb.go @@ -202,49 +202,44 @@ func (s *SlbService) DescribeSlbListener(id string) (listener map[string]interfa return } -func (s *SlbService) DescribeSlbAcl(id string) (*slb.DescribeAccessControlListAttributeResponse, error) { - response := &slb.DescribeAccessControlListAttributeResponse{} - request := slb.CreateDescribeAccessControlListAttributeRequest() - request.RegionId = s.client.RegionId - request.AclId = id - - raw, err := s.client.WithSlbClient(func(slbClient *slb.Client) (interface{}, error) { - return slbClient.DescribeAccessControlListAttribute(request) - }) +func (s *SlbService) DescribeSlbAcl(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewSlbClient() if err != nil { - if err != nil { - if IsExpectedErrors(err, []string{"AclNotExist"}) { - return response, WrapErrorf(err, NotFoundMsg, AlibabaCloudSdkGoERROR) - } - return response, WrapErrorf(err, DefaultErrorMsg, id, request.GetActionName(), AlibabaCloudSdkGoERROR) - } + return nil, WrapError(err) } - addDebug(request.GetActionName(), raw, request.RpcRequest, request) - response, _ = raw.(*slb.DescribeAccessControlListAttributeResponse) - return response, nil -} - -func (s *SlbService) WaitForSlbAcl(id string, status Status, timeout int) error { - deadline := time.Now().Add(time.Duration(timeout) * time.Second) - for { - object, err := s.DescribeSlbAcl(id) + action := "DescribeAccessControlListAttribute" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "AclId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-15"), StringPointer("AK"), nil, request, &runtime) if err != nil { - if NotFoundError(err) { - if status == Deleted { - return nil - } - } else { - return WrapError(err) + if NeedRetry(err) { + wait() + return resource.RetryableError(err) } - } else { - return nil + return resource.NonRetryableError(err) } - - time.Sleep(DefaultIntervalShort * time.Second) - if time.Now().After(deadline) { - return WrapErrorf(err, WaitTimeoutMsg, id, GetFunc(1), timeout, object.AclId, id, ProviderERROR) + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"AclNotExist"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("SLB:Acl", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) } + object = v.(map[string]interface{}) + return object, nil } func (s *SlbService) WaitForSlb(id string, status Status, timeout int) error { @@ -675,7 +670,6 @@ func (s *SlbService) WaitForSlbDomainExtension(id string, status Status, timeout return WrapErrorf(err, WaitTimeoutMsg, id, GetFunc(1), timeout, Null, string(status), ProviderERROR) } } - return nil } func (s *SlbService) setInstanceTags(d *schema.ResourceData, resourceType TagResourceType) error { @@ -824,7 +818,7 @@ func (s *SlbService) DescribeTags(resourceId string, resourceTags map[string]int return Client.ListTagResources(request) }) if err != nil { - if IsExpectedErrors(err, []string{Throttling}) { + if IsExpectedErrors(err, []string{Throttling, "Throttling.User"}) { time.Sleep(2 * time.Second) return resource.RetryableError(err) } @@ -1074,3 +1068,65 @@ func (s *SlbService) DescribeSlbCaCertificate(id string) (object map[string]inte object = v.([]interface{})[0].(map[string]interface{}) return object, nil } + +func (s *SlbService) DescribeSlbTlsCipherPolicy(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewSlbClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListTLSCipherPolicies" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "TLSCipherPolicyId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2014-05-15"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.TLSCipherPolicies", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.TLSCipherPolicies", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("SLB", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["InstanceId"]) != id { + return object, WrapErrorf(Error(GetNotFoundMessage("SLB", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *SlbService) convertAclEntriesToString(v []interface{}) (string, error) { + arrayMaps := make([]interface{}, len(v)) + for i, vv := range v { + item := vv.(map[string]interface{}) + temp := map[string]interface{}{ + "comment": item["comment"], + "entry": item["entry"], + } + + arrayMaps[i] = temp + } + maps, err := json.Marshal(arrayMaps) + if err != nil { + return "", WrapError(err) + } + return string(maps), nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_swas_open.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_swas_open.go new file mode 100644 index 00000000000..5070d210f3b --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_swas_open.go @@ -0,0 +1,255 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +type SwasOpenService struct { + client *connectivity.AliyunClient +} + +func (s *SwasOpenService) DescribeSimpleApplicationServerInstance(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewSwasClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListInstances" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "InstanceIds": "[\"" + id + "\"]", + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InternalError"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("SimpleApplicationServer:Instance", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Instances", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Instances", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("SimpleApplicationServer", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["InstanceId"]) != id { + return object, WrapErrorf(Error(GetNotFoundMessage("SimpleApplicationServer", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *SwasOpenService) SimpleApplicationServerInstanceStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeSimpleApplicationServerInstance(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["Status"]) == failState { + return object, fmt.Sprint(object["Status"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["Status"]))) + } + } + return object, fmt.Sprint(object["Status"]), nil + } +} +func (s *SwasOpenService) DescribeSimpleApplicationServerFirewallRule(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewSwasClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListFirewallRules" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "InstanceId": parts[0], + "PageNumber": 1, + "PageSize": 10, + } + idExist := false + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.FirewallRules", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.FirewallRules", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("SimpleApplicationServer", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["RuleId"]) == parts[1] { + idExist = true + return v.(map[string]interface{}), nil + } + } + if len(v.([]interface{})) < request["PageSize"].(int) { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("SimpleApplicationServer", id)), NotFoundWithResponse, response) + } + return +} + +func (s *SwasOpenService) DescribeSimpleApplicationServerSnapshot(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewSwasClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListSnapshots" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "SnapshotIds": fmt.Sprintf(`["%s"]`, id), + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidDiskId.NotFound", "InvalidInstanceId.NotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("SimpleApplicationServer:Snapshot", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Snapshots", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Snapshots", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("SimpleApplicationServer", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["SnapshotId"]) != id { + return object, WrapErrorf(Error(GetNotFoundMessage("SimpleApplicationServer", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *SwasOpenService) SimpleApplicationServerSnapshotStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeSimpleApplicationServerSnapshot(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["Status"]) == failState { + return object, fmt.Sprint(object["Status"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["Status"]))) + } + } + return object, fmt.Sprint(object["Status"]), nil + } +} + +func (s *SwasOpenService) DescribeSimpleApplicationServerCustomImage(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewSwasClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListImages" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "ImageIds": fmt.Sprintf(`["%s"]`, id), + "ImageType": "custom", + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-01"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Images", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Images", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("SimpleApplicationServer", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["ImageId"]) != id { + return object, WrapErrorf(Error(GetNotFoundMessage("SimpleApplicationServer", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_vod.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_vod.go new file mode 100644 index 00000000000..99aca242c64 --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_vod.go @@ -0,0 +1,154 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +type VodService struct { + client *connectivity.AliyunClient +} + +func (s *VodService) DescribeVodDomain(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewVodClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeVodDomainDetail" + request := map[string]interface{}{ + "DomainName": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-03-21"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidDomain.NotFound"}) { + return nil, WrapErrorf(err, NotFoundMsg, AlibabaCloudSdkGoERROR) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.DomainDetail", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.DomainDetail", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *VodService) VodStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeVodDomain(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if object["DomainStatus"].(string) == failState { + return object, object["DomainStatus"].(string), WrapError(Error(FailedToReachTargetStatus, object["DomainStatus"].(string))) + } + } + return object, object["DomainStatus"].(string), nil + } +} + +func (s *VodService) SetResourceTags(d *schema.ResourceData, resourceType string) error { + + if d.HasChange("tags") { + added, removed := parsingTags(d) + conn, err := s.client.NewVodClient() + if err != nil { + return WrapError(err) + } + + removedTagKeys := make([]string, 0) + for _, v := range removed { + if !ignoredTags(v, "") { + removedTagKeys = append(removedTagKeys, v) + } + } + if len(removedTagKeys) > 0 { + action := "UnTagVodResources" + request := map[string]interface{}{ + "ResourceType": resourceType, + "ResourceId.1": d.Id(), + } + for i, key := range removedTagKeys { + request[fmt.Sprintf("TagKey.%d", i+1)] = key + } + wait := incrementalWait(2*time.Second, 1*time.Second) + err := resource.Retry(10*time.Minute, func() *resource.RetryError { + response, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-03-21"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsThrottling(err) { + wait() + return resource.RetryableError(err) + + } + return resource.NonRetryableError(err) + } + addDebug(action, response, request) + return nil + }) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + if len(added) > 0 { + action := "TagVodResources" + request := map[string]interface{}{ + "ResourceType": resourceType, + "ResourceId.1": d.Id(), + } + count := 1 + for key, value := range added { + request[fmt.Sprintf("Tag.%d.Key", count)] = key + request[fmt.Sprintf("Tag.%d.Value", count)] = value + count++ + } + + wait := incrementalWait(2*time.Second, 1*time.Second) + err := resource.Retry(10*time.Minute, func() *resource.RetryError { + response, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2017-03-21"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + if err != nil { + if IsThrottling(err) { + wait() + return resource.RetryableError(err) + + } + return resource.NonRetryableError(err) + } + addDebug(action, response, request) + return nil + }) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + d.SetPartial("tags") + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_vpc.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_vpc.go index 8a4ce56a93d..b307fe25bbb 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_vpc.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_vpc.go @@ -1276,7 +1276,7 @@ func (s *VpcService) ignoreTag(t vpc.TagResource) bool { return false } -func (s *VpcService) setInstanceSecondaryCidrBlocks(d *schema.ResourceData) error { +func (s *VpcService) SetInstanceSecondaryCidrBlocks(d *schema.ResourceData) error { if d.HasChange("secondary_cidr_blocks") { oraw, nraw := d.GetChange("secondary_cidr_blocks") removed := oraw.([]interface{}) @@ -2028,3 +2028,1062 @@ func (s *VpcService) ExpressConnectPhysicalConnectionStateRefreshFunc(id string, return object, fmt.Sprint(object["Status"]), nil } } + +func (s *VpcService) DescribeExpressConnectVirtualBorderRouter(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewVpcClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeVirtualBorderRouters" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "PageNumber": 1, + "PageSize": 50, + } + idExist := false + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.VirtualBorderRouterSet.VirtualBorderRouterType", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.VirtualBorderRouterSet.VirtualBorderRouterType", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("ExpressConnect", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["VbrId"]) == id { + idExist = true + return v.(map[string]interface{}), nil + } + } + if len(v.([]interface{})) < request["PageSize"].(int) { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("ExpressConnect", id)), NotFoundWithResponse, response) + } + return +} + +func (s *VpcService) ExpressConnectVirtualBorderRouterStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeExpressConnectVirtualBorderRouter(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["Status"]) == failState { + return object, fmt.Sprint(object["Status"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["Status"]))) + } + } + return object, fmt.Sprint(object["Status"]), nil + } +} + +func (s *VpcService) DescribeVpcDhcpOptionsSet(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewVpcClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetDhcpOptionsSet" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "DhcpOptionsSetId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"InvalidRegionId.NotFound"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("VPC:DhcpOptionsSet", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + if _, ok := object["DhcpOptionsSetId"]; !ok { + return object, WrapErrorf(Error(GetNotFoundMessage("VPC:DhcpOptionsSet", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + + return object, nil +} + +func (s *VpcService) VpcDhcpOptionsSetStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeVpcDhcpOptionsSet(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["Status"]) == failState { + return object, fmt.Sprint(object["Status"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["Status"]))) + } + } + return object, fmt.Sprint(object["Status"]), nil + } +} + +func (s *VpcService) DescribeVpcDhcpOptionsSetAttachment(id string) (object map[string]interface{}, err error) { + parts, err := ParseResourceId(id, 2) + if err != nil { + return object, WrapError(err) + } + object, err = s.DescribeVpcDhcpOptionsSet(parts[1]) + if err != nil { + return object, WrapError(err) + } + return object, nil +} + +func (s *VpcService) DescribeVpcDhcpOptionsSetAttachmentStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + parts, err := ParseResourceId(id, 2) + if err != nil { + return nil, "", WrapError(err) + } + object, err := s.DescribeVpcDhcpOptionsSetAttachment(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + status := "" + if associateVpcsList, ok := object["AssociateVpcs"]; ok { + for _, associateVpcsListItem := range associateVpcsList.([]interface{}) { + if associateVpcsListItem != nil { + associateVpcsListItemMap, ok := associateVpcsListItem.(map[string]interface{}) + if ok && associateVpcsListItemMap["VpcId"] == parts[0] { + status = associateVpcsListItemMap["AssociateStatus"].(string) + break + } + } + } + } + + for _, failState := range failStates { + if status == failState { + return object, fmt.Sprint(object["AssociateStatus"]), WrapError(Error(FailedToReachTargetStatus, status)) + } + } + return object, status, nil + } +} + +func (s *VpcService) DescribeVpcNatIpCidr(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewVpcClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListNatIpCidrs" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "NatGatewayId": parts[0], + "NatIpCidr": parts[1], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + request["ClientToken"] = buildClientToken("ListNatIpCidrs") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.NatIpCidrs", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.NatIpCidrs", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("VPC", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["NatIpCidr"]) != parts[1] { + return object, WrapErrorf(Error(GetNotFoundMessage("VPC", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *VpcService) DescribeVpcNatIp(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewVpcClient() + if err != nil { + return nil, WrapError(err) + } + + parts, err := ParseResourceId(id, 2) + if err != nil { + return nil, WrapError(err) + } + action := "ListNatIps" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "NatGatewayId": parts[0], + "NatIpIds": []string{parts[1]}, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + request["ClientToken"] = buildClientToken("ListNatIps") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.NatIps", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.NatIps", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("VPC", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["NatIpId"]) != parts[1] { + return object, WrapErrorf(Error(GetNotFoundMessage("VPC", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *VpcService) VpcNatIpStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeVpcNatIp(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + for _, failState := range failStates { + if fmt.Sprint(object["NatIpStatus"]) == failState { + return object, fmt.Sprint(object["NatIpStatus"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["NatIpStatus"]))) + } + } + return object, fmt.Sprint(object["NatIpStatus"]), nil + } +} + +func (s *VpcService) DescribeVpcTrafficMirrorFilter(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewVpcClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListTrafficMirrorFilters" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "TrafficMirrorFilterIds": []string{id}, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.TrafficMirrorFilters", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.TrafficMirrorFilters", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("VPC", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["TrafficMirrorFilterId"]) != id { + return object, WrapErrorf(Error(GetNotFoundMessage("VPC", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *VpcService) VpcTrafficMirrorFilterStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeVpcTrafficMirrorFilter(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["TrafficMirrorFilterStatus"]) == failState { + return object, fmt.Sprint(object["TrafficMirrorFilterStatus"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["TrafficMirrorFilterStatus"]))) + } + } + return object, fmt.Sprint(object["TrafficMirrorFilterStatus"]), nil + } +} + +func (s *VpcService) DescribeVpcTrafficMirrorFilterEgressRule(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewVpcClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListTrafficMirrorFilters" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "MaxResults": 10, + "TrafficMirrorFilterIds": []string{parts[0]}, + } + idExist := false + + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.TrafficMirrorFilters", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.TrafficMirrorFilters", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("VPC", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + EgressRules := v.(map[string]interface{})["EgressRules"] + if EgressRulesMap, ok := EgressRules.([]interface{}); ok { + for _, v := range EgressRulesMap { + if fmt.Sprint(v.(map[string]interface{})["TrafficMirrorFilterRuleId"]) == parts[1] { + idExist = true + return v.(map[string]interface{}), nil + } + } + } + } + + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("VPC", id)), NotFoundWithResponse, response) + } + return +} + +func (s *VpcService) VpcTrafficMirrorFilterEgressRuleStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeVpcTrafficMirrorFilterEgressRule(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["TrafficMirrorFilterRuleStatus"]) == failState { + return object, fmt.Sprint(object["TrafficMirrorFilterRuleStatus"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["TrafficMirrorFilterRuleStatus"]))) + } + } + return object, fmt.Sprint(object["TrafficMirrorFilterRuleStatus"]), nil + } +} + +func (s *VpcService) DescribeVpcTrafficMirrorFilterIngressRule(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewVpcClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListTrafficMirrorFilters" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "MaxResults": 10, + "TrafficMirrorFilterIds": []string{parts[0]}, + } + idExist := false + + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.TrafficMirrorFilters", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.TrafficMirrorFilters", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("VPC", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + EgressRules := v.(map[string]interface{})["IngressRules"] + if EgressRulesMap, ok := EgressRules.([]interface{}); ok { + for _, v := range EgressRulesMap { + if fmt.Sprint(v.(map[string]interface{})["TrafficMirrorFilterRuleId"]) == parts[1] { + idExist = true + return v.(map[string]interface{}), nil + } + } + } + } + + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("VPC", id)), NotFoundWithResponse, response) + } + return +} + +func (s *VpcService) VpcTrafficMirrorFilterIngressRuleStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeVpcTrafficMirrorFilterIngressRule(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["TrafficMirrorFilterRuleStatus"]) == failState { + return object, fmt.Sprint(object["TrafficMirrorFilterRuleStatus"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["TrafficMirrorFilterRuleStatus"]))) + } + } + return object, fmt.Sprint(object["TrafficMirrorFilterRuleStatus"]), nil + } +} + +func (s *VpcService) DescribeVpcTrafficMirrorSession(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewVpcClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListTrafficMirrorSessions" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "TrafficMirrorSessionIds": []string{id}, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.TrafficMirrorSessions", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.TrafficMirrorSessions", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("VPC", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["TrafficMirrorSessionId"]) != id { + return object, WrapErrorf(Error(GetNotFoundMessage("VPC", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *VpcService) VpcTrafficMirrorSessionStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeVpcTrafficMirrorSession(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["TrafficMirrorSessionStatus"]) == failState { + return object, fmt.Sprint(object["TrafficMirrorSessionStatus"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["TrafficMirrorSessionStatus"]))) + } + } + return object, fmt.Sprint(object["TrafficMirrorSessionStatus"]), nil + } +} + +func (s *VpcService) DescribeVpcIpv6Gateway(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewVpcClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeIpv6GatewayAttribute" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "Ipv6GatewayId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + if Ipv6GatewayId, ok := object["Ipv6GatewayId"]; !ok || fmt.Sprint(Ipv6GatewayId) == "" { + return object, WrapErrorf(Error(GetNotFoundMessage("VPC", id)), NotFoundWithResponse, response) + } + return object, nil +} + +func (s *VpcService) VpcIpv6GatewayStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeVpcIpv6Gateway(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["Status"]) == failState { + return object, fmt.Sprint(object["Status"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["Status"]))) + } + } + return object, fmt.Sprint(object["Status"]), nil + } +} + +func (s *VpcService) DescribeVpcIpv6EgressRule(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewVpcClient() + if err != nil { + return nil, WrapError(err) + } + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + action := "DescribeIpv6EgressOnlyRules" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "PageSize": PageSizeLarge, + "PageNumber": 1, + "Ipv6GatewayId": parts[0], + } + idExist := false + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Ipv6EgressOnlyRules.Ipv6EgressOnlyRule", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Ipv6EgressOnlyRules.Ipv6EgressOnlyRule", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("VPC", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["Ipv6EgressOnlyRuleId"]) == parts[1] { + idExist = true + return v.(map[string]interface{}), nil + } + } + if len(v.([]interface{})) < request["PageSize"].(int) { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("VPC", id)), NotFoundWithResponse, response) + } + return +} + +func (s *VpcService) VpcIpv6EgressRuleStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeVpcIpv6EgressRule(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + for _, failState := range failStates { + + if fmt.Sprint(object["Status"]) == failState { + return object, fmt.Sprint(object["Status"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["Status"]))) + } + } + return object, fmt.Sprint(object["Status"]), nil + } +} + +func (s *VpcService) DescribeVpcIpv6InternetBandwidth(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewVpcClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeIpv6Addresses" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "Ipv6InternetBandwidthId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Ipv6Addresses.Ipv6Address", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Ipv6Addresses.Ipv6Address", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("VPC", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["Ipv6InternetBandwidth"].(map[string]interface{})["Ipv6InternetBandwidthId"]) != id { + return object, WrapErrorf(Error(GetNotFoundMessage("VPC", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *VpcService) DescribeVpcBgpGroup(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewVpcClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeBgpGroups" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "BgpGroupId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.BgpGroups.BgpGroup", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.BgpGroups.BgpGroup", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("VPC", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["BgpGroupId"]) != id { + return object, WrapErrorf(Error(GetNotFoundMessage("VPC", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *VpcService) VpcBgpGroupStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeVpcBgpGroup(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["Status"]) == failState { + return object, fmt.Sprint(object["Status"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["Status"]))) + } + } + return object, fmt.Sprint(object["Status"]), nil + } +} + +func (s *VpcService) DescribeVpcVbrHa(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewVpcClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeVbrHa" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "VbrHaId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + request["ClientToken"] = buildClientToken("DescribeVbrHa") + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + if vbrHaId, ok := object["VbrHaId"]; !ok || fmt.Sprint(vbrHaId) == "" { + return object, WrapErrorf(Error(GetNotFoundMessage("VPC", id)), NotFoundWithResponse, response) + } + return object, nil +} + +func (s *VpcService) VpcVbrHaStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeVpcVbrHa(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["Status"]) == failState { + return object, fmt.Sprint(object["Status"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["Status"]))) + } + } + return object, fmt.Sprint(object["Status"]), nil + } +} + +func (s *VpcService) DescribeVpcBgpPeer(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewVpcClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeBgpPeers" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "BgpPeerId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.BgpPeers.BgpPeer", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.BgpPeers.BgpPeer", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("VPC", id)), NotFoundWithResponse, response) + } else { + if fmt.Sprint(v.([]interface{})[0].(map[string]interface{})["BgpPeerId"]) != id { + return object, WrapErrorf(Error(GetNotFoundMessage("VPC", id)), NotFoundWithResponse, response) + } + } + object = v.([]interface{})[0].(map[string]interface{}) + return object, nil +} + +func (s *VpcService) VpcBgpPeerStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeVpcBgpPeer(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["Status"]) == failState { + return object, fmt.Sprint(object["Status"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["Status"]))) + } + } + return object, fmt.Sprint(object["Status"]), nil + } +} +func (s *VpcService) DescribeVpcBgpNetwork(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewVpcClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeBgpNetworks" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "RouterId": parts[0], + "PageNumber": 1, + "PageSize": PageSizeMedium, + } + idExist := false + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-04-28"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.BgpNetworks.BgpNetwork", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.BgpNetworks.BgpNetwork", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("VPC", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["DstCidrBlock"]) == parts[1] { + idExist = true + return v.(map[string]interface{}), nil + } + } + if len(v.([]interface{})) < request["PageSize"].(int) { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("VPC", id)), NotFoundWithResponse, response) + } + return +} + +func (s *VpcService) VpcBgpNetworkStateRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + object, err := s.DescribeVpcBgpNetwork(id) + if err != nil { + if NotFoundError(err) { + // Set this to nil as if we didn't find anything. + return nil, "", nil + } + return nil, "", WrapError(err) + } + + for _, failState := range failStates { + if fmt.Sprint(object["Status"]) == failState { + return object, fmt.Sprint(object["Status"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["Status"]))) + } + } + return object, fmt.Sprint(object["Status"]), nil + } +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_vs.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_vs.go new file mode 100644 index 00000000000..845a47e662b --- /dev/null +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_vs.go @@ -0,0 +1,55 @@ +package alicloud + +import ( + "fmt" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +type VsService struct { + client *connectivity.AliyunClient +} + +func (s *VsService) DescribeVideoSurveillanceSystemGroup(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewVsClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeGroup" + request := map[string]interface{}{ + "Id": id, + "IncludeStats": "true", + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2018-12-12"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"Param.Invalid.Id", "NotFound.Group"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("VideoSurveillanceSystem:Group", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_waf_openapi.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_waf_openapi.go index 132b1d94670..e52ff381178 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_waf_openapi.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_waf_openapi.go @@ -2,9 +2,12 @@ package alicloud import ( "encoding/json" + "fmt" + "time" "github.com/PaesslerAG/jsonpath" util "github.com/alibabacloud-go/tea-utils/service" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" ) @@ -48,7 +51,18 @@ func (s *Waf_openapiService) DescribeWafDomain(id string) (object map[string]int } runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-10"), StringPointer("AK"), nil, request, &runtime) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-10"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) if err != nil { if IsExpectedErrors(err, []string{"ComboError", "DomainNotExist"}) { err = WrapErrorf(Error(GetNotFoundMessage("WafDomain", id)), NotFoundMsg, ProviderERROR) @@ -92,3 +106,145 @@ func (s *Waf_openapiService) DescribeWafInstance(id string) (object map[string]i object = v.(map[string]interface{}) return object, nil } + +func (s *Waf_openapiService) DescribeWafCertificate(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewWafClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeCertificates" + parts, err := ParseResourceId(id, 3) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "Domain": parts[1], + "InstanceId": parts[0], + } + idExist := false + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-10"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Certificates", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Certificates", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("WAF", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["CertificateId"]) == parts[2] { + idExist = true + return v.(map[string]interface{}), nil + } + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("WAF", id)), NotFoundWithResponse, response) + } + return object, nil +} + +func (s *Waf_openapiService) DescribeProtectionModuleStatus(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewWafClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeProtectionModuleStatus" + parts, err := ParseResourceId(id, 3) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "DefenseType": parts[2], + "Domain": parts[1], + "InstanceId": parts[0], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-10"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *Waf_openapiService) DescribeWafProtectionModule(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewWafClient() + if err != nil { + return nil, WrapError(err) + } + action := "DescribeProtectionModuleMode" + parts, err := ParseResourceId(id, 3) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "DefenseType": parts[2], + "Domain": parts[1], + "InstanceId": parts[0], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-09-10"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$", response) + } + object = v.(map[string]interface{}) + return object, nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_yundun_bastionhost.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_yundun_bastionhost.go index b26a109e262..3caffde5cf2 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_yundun_bastionhost.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/service_alicloud_yundun_bastionhost.go @@ -1,6 +1,7 @@ package alicloud import ( + "fmt" "log" "regexp" "strings" @@ -8,7 +9,6 @@ import ( "github.com/PaesslerAG/jsonpath" util "github.com/alibabacloud-go/tea-utils/service" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" "github.com/aliyun/alibaba-cloud-sdk-go/services/bssopenapi" "github.com/aliyun/alibaba-cloud-sdk-go/services/ram" "github.com/aliyun/alibaba-cloud-sdk-go/services/yundun_bastionhost" @@ -54,30 +54,7 @@ var bastionhostpolicyRequired = []BastionhostPolicyRequired{ }, } -func (s *YundunBastionhostService) DescribeYundunBastionhostInstance(id string) (v yundun_bastionhost.Instance, err error) { - request := yundun_bastionhost.CreateDescribeInstanceBastionhostRequest() - var instanceIds []string - instanceIds = append(instanceIds, id) - request.InstanceId = &instanceIds - request.PageSize = requests.NewInteger(PageSizeSmall) - request.CurrentPage = requests.NewInteger(1) - raw, err := s.client.WithBastionhostClient(func(BastionhostClient *yundun_bastionhost.Client) (interface{}, error) { - return BastionhostClient.DescribeInstanceBastionhost(request) - }) - if err != nil { - return v, WrapErrorf(err, DefaultErrorMsg, id, request.GetActionName(), AlibabaCloudSdkGoERROR) - } - addDebug(request.GetActionName(), raw, request.RpcRequest, request) - response := raw.(*yundun_bastionhost.DescribeInstanceBastionhostResponse) - - if len(response.Instances) == 0 || response.Instances[0].InstanceId != id { - return v, WrapErrorf(Error(GetNotFoundMessage("Yundun_bastionhost Instance", id)), NotFoundMsg, ProviderERROR) - } - v = response.Instances[0] - return -} - -func (s *YundunBastionhostService) DescribeBastionhostInstanceAttribute(id string) (object map[string]interface{}, err error) { +func (s *YundunBastionhostService) DescribeBastionhostInstance(id string) (object map[string]interface{}, err error) { var response map[string]interface{} conn, err := s.client.NewBastionhostClient() if err != nil { @@ -104,7 +81,7 @@ func (s *YundunBastionhostService) DescribeBastionhostInstanceAttribute(id strin }) addDebug(action, response, request) if err != nil { - if IsExpectedErrors(err, []string{"OBJECT_NOT_FOUND"}) { + if IsExpectedErrors(err, []string{"Commodity.BizError.InvalidStatus"}) { return object, WrapErrorf(Error(GetNotFoundMessage("Instance", id)), NotFoundWithResponse, response) } return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) @@ -172,7 +149,7 @@ func (s *YundunBastionhostService) UpdateInstanceSpec(schemaSpecMap map[string]s params := make([]bssopenapi.ModifyInstanceParameter, 0, len(schemaSpecMap)) for schemaName, spec := range schemaSpecMap { - params = append(params, bssopenapi.ModifyInstanceParameter{schemaName, d.Get(spec).(string)}) + params = append(params, bssopenapi.ModifyInstanceParameter{Code: schemaName, Value: d.Get(spec).(string)}) } request.Parameter = ¶ms @@ -208,7 +185,7 @@ func (s *YundunBastionhostService) UpdateInstanceSpec(schemaSpecMap map[string]s func (s *YundunBastionhostService) BastionhostInstanceRefreshFunc(id string, failStates []string) resource.StateRefreshFunc { return func() (interface{}, string, error) { - object, err := s.DescribeYundunBastionhostInstance(id) + object, err := s.DescribeBastionhostInstance(id) if err != nil { if NotFoundError(err) { // Set this to nil if nothing matched @@ -218,11 +195,11 @@ func (s *YundunBastionhostService) BastionhostInstanceRefreshFunc(id string, fai } for _, failState := range failStates { - if object.InstanceStatus == failState { - return object, object.InstanceStatus, WrapError(Error(FailedToReachTargetStatus, object.InstanceStatus)) + if fmt.Sprint(object["InstanceStatus"]) == failState { + return object, fmt.Sprint(object["InstanceStatus"]), WrapError(Error(FailedToReachTargetStatus, fmt.Sprint(object["InstanceStatus"]))) } } - return object, object.InstanceStatus, nil + return object, fmt.Sprint(object["InstanceStatus"]), nil } } @@ -306,28 +283,6 @@ func (s *YundunBastionhostService) ProcessRolePolicy() error { return nil } -func (s *YundunBastionhostService) WaitForYundunBastionhostInstance(instanceId string, status Status, timeoutSenconds time.Duration) error { - deadline := time.Now().Add(timeoutSenconds * time.Second) - for { - _, err := s.DescribeYundunBastionhostInstance(instanceId) - - if err != nil { - if NotFoundError(err) { - if status == Deleted { - return nil - } - } else { - return WrapError(err) - } - } - - if time.Now().After(deadline) { - return WrapErrorf(err, WaitTimeoutMsg, instanceId, GetFunc(1), timeoutSenconds, "", "", ProviderERROR) - } - time.Sleep(DefaultIntervalShort * time.Second) - } -} - func (s *YundunBastionhostService) DescribeTags(resourceId string, resourceTags map[string]interface{}, resourceType TagResourceType) (tags []yundun_bastionhost.TagResource, err error) { request := yundun_bastionhost.CreateListTagResourcesRequest() request.RegionId = s.client.RegionId @@ -510,8 +465,8 @@ func (s *YundunBastionhostService) DescribeBastionhostUserGroup(id string) (obje }) addDebug(action, response, request) if err != nil { - if IsExpectedErrors(err, []string{"OBJECT_NOT_FOUND"}) { - return object, WrapErrorf(Error(GetNotFoundMessage("UserGroup", id)), NotFoundWithResponse, response) + if IsExpectedErrors(err, []string{"Commodity.BizError.InvalidStatus", "OBJECT_NOT_FOUND"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("Bastionhost:UserGroup", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) } return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) } @@ -522,3 +477,575 @@ func (s *YundunBastionhostService) DescribeBastionhostUserGroup(id string) (obje object = v.(map[string]interface{}) return object, nil } + +func (s *YundunBastionhostService) DescribeBastionhostUser(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewBastionhostClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetUser" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "InstanceId": parts[0], + "UserId": parts[1], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"Commodity.BizError.InvalidStatus", "OBJECT_NOT_FOUND"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("Bastionhost:User", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.User", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.User", response) + } + object = v.(map[string]interface{}) + return object, nil +} +func (s *YundunBastionhostService) DescribeBastionhostHostGroup(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewBastionhostClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetHostGroup" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "HostGroupId": parts[1], + "InstanceId": parts[0], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"Commodity.BizError.InvalidStatus", "OBJECT_NOT_FOUND"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("Bastionhost:HostGroup", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.HostGroup", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.HostGroup", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *YundunBastionhostService) DescribeBastionhostUserAttachment(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewBastionhostClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListUsers" + parts, err := ParseResourceId(id, 3) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "InstanceId": parts[0], + "UserGroupId": parts[1], + "PageNumber": 1, + "PageSize": 50, + } + idExist := false + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"Commodity.BizError.InvalidStatus"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("Bastionhost:UserAttachment", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Users", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Users", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("Bastionhost", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["UserId"]) == parts[2] { + idExist = true + return v.(map[string]interface{}), nil + } + } + if len(v.([]interface{})) < request["PageSize"].(int) { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("Bastionhost", id)), NotFoundWithResponse, response) + } + return +} + +func (s *YundunBastionhostService) DescribeBastionhostHost(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewBastionhostClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetHost" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "HostId": parts[1], + "InstanceId": parts[0], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(false) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"Commodity.BizError.InvalidStatus", "OBJECT_NOT_FOUND"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("Bastionhost:Host", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Host", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Host", response) + } + object = v.(map[string]interface{}) + return object, nil +} + +func (s *YundunBastionhostService) DescribeBastionhostHostAccount(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewBastionhostClient() + if err != nil { + return nil, WrapError(err) + } + action := "GetHostAccount" + parts, err := ParseResourceId(id, 2) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "HostAccountId": parts[1], + "InstanceId": parts[0], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"Commodity.BizError.InvalidStatus", "OBJECT_NOT_FOUND"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("Bastionhost:HostAccount", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.HostAccount", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.HostAccount", response) + } + object = v.(map[string]interface{}) + return object, nil +} +func (s *YundunBastionhostService) DescribeBastionhostHostAttachment(id string) (object map[string]interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewBastionhostClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListHosts" + parts, err := ParseResourceId(id, 3) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "HostGroupId": parts[1], + "InstanceId": parts[0], + "PageNumber": 1, + "PageSize": 0, + } + idExist := false + for { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"Commodity.BizError.InvalidStatus"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("Bastionhost:HostAttachment", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.Hosts", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.Hosts", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("Bastionhost", id)), NotFoundWithResponse, response) + } + for _, v := range v.([]interface{}) { + if fmt.Sprint(v.(map[string]interface{})["HostId"]) == parts[2] { + idExist = true + return v.(map[string]interface{}), nil + } + } + if len(v.([]interface{})) < request["PageSize"].(int) { + break + } + request["PageNumber"] = request["PageNumber"].(int) + 1 + } + if !idExist { + return object, WrapErrorf(Error(GetNotFoundMessage("Bastionhost", id)), NotFoundWithResponse, response) + } + return +} +func (s *YundunBastionhostService) DescribeBastionhostHostAccountUserAttachment(id string) (object []interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewBastionhostClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListHostAccountsForUser" + parts, err := ParseResourceId(id, 3) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "HostId": parts[2], + "InstanceId": parts[0], + "UserId": parts[1], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(10*time.Second, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"Commodity.BizError.InvalidStatus", "OBJECT_NOT_FOUND"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("Bastionhost:HostAccountUserAttachment", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.HostAccounts", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.HostAccounts", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("Bastionhost", id)), NotFoundWithResponse, response) + } + return v.([]interface{}), nil +} + +func (s *YundunBastionhostService) DescribeBastionhostHostAccountUserGroupAttachment(id string) (object []interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewBastionhostClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListHostAccountsForUserGroup" + parts, err := ParseResourceId(id, 3) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "HostId": parts[2], + "InstanceId": parts[0], + "UserGroupId": parts[1], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(10*time.Second, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"Commodity.BizError.InvalidStatus", "OBJECT_NOT_FOUND"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("Bastionhost:HostAccountUserGroupAttachment", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.HostAccounts", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.HostAccounts", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("Bastionhost", id)), NotFoundWithResponse, response) + } + return v.([]interface{}), nil +} + +func (s *YundunBastionhostService) DescribeBastionhostHostGroupAccountUserAttachment(id string) (object []interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewBastionhostClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListHostGroupAccountNamesForUser" + parts, err := ParseResourceId(id, 3) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "HostGroupId": parts[2], + "InstanceId": parts[0], + "UserId": parts[1], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(10*time.Second, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"Commodity.BizError.InvalidStatus", "OBJECT_NOT_FOUND"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("Bastionhost:HostGroupAccountUserAttachment", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.HostAccountNames", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.HostAccountNames", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("Bastionhost", id)), NotFoundWithResponse, response) + } + return v.([]interface{}), nil +} + +func (s *YundunBastionhostService) DescribeBastionhostHostGroupAccountUserGroupAttachment(id string) (object []interface{}, err error) { + var response map[string]interface{} + conn, err := s.client.NewBastionhostClient() + if err != nil { + return nil, WrapError(err) + } + action := "ListHostGroupAccountNamesForUserGroup" + parts, err := ParseResourceId(id, 3) + if err != nil { + err = WrapError(err) + return + } + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "HostGroupId": parts[2], + "InstanceId": parts[0], + "UserGroupId": parts[1], + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(10*time.Second, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + if IsExpectedErrors(err, []string{"Commodity.BizError.InvalidStatus", "OBJECT_NOT_FOUND"}) { + return object, WrapErrorf(Error(GetNotFoundMessage("Bastionhost:HostGroupAccountUserGroupAttachment", id)), NotFoundMsg, ProviderERROR, fmt.Sprint(response["RequestId"])) + } + return object, WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + v, err := jsonpath.Get("$.HostAccountNames", response) + if err != nil { + return object, WrapErrorf(err, FailedGetAttributeMsg, id, "$.HostAccountNames", response) + } + if len(v.([]interface{})) < 1 { + return object, WrapErrorf(Error(GetNotFoundMessage("Bastionhost", id)), NotFoundWithResponse, response) + } + return v.([]interface{}), nil +} + +func (s *YundunBastionhostService) EnableInstancePublicAccess(id string) (err error) { + var response map[string]interface{} + conn, err := s.client.NewBastionhostClient() + if err != nil { + return WrapError(err) + } + action := "EnableInstancePublicAccess" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "InstanceId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + return nil +} +func (s *YundunBastionhostService) DisableInstancePublicAccess(id string) (err error) { + var response map[string]interface{} + conn, err := s.client.NewBastionhostClient() + if err != nil { + return WrapError(err) + } + action := "DisableInstancePublicAccess" + request := map[string]interface{}{ + "RegionId": s.client.RegionId, + "InstanceId": id, + } + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 3*time.Second) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-12-09"), StringPointer("AK"), nil, request, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, id, action, AlibabaCloudSdkGoERROR) + } + return nil +} diff --git a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/tags.go b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/tags.go index a73bc401885..ff16c1eed4e 100644 --- a/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/tags.go +++ b/vendor/github.com/aliyun/terraform-provider-alicloud/alicloud/tags.go @@ -18,7 +18,6 @@ import ( "github.com/aliyun/alibaba-cloud-sdk-go/services/elasticsearch" "github.com/aliyun/alibaba-cloud-sdk-go/services/ess" "github.com/aliyun/alibaba-cloud-sdk-go/services/ots" - "github.com/aliyun/alibaba-cloud-sdk-go/services/rds" "github.com/aliyun/alibaba-cloud-sdk-go/services/vpc" "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" @@ -349,19 +348,6 @@ func diffTags(oldTags, newTags []Tag) ([]Tag, []Tag) { return tagsFromMap(create), remove } -func diffRdsTags(oldTags, newTags map[string]interface{}) (remove []string, add []rds.TagResourcesTag) { - for k, _ := range oldTags { - remove = append(remove, k) - } - for k, v := range newTags { - add = append(add, rds.TagResourcesTag{ - Key: k, - Value: v.(string), - }) - } - return -} - func diffGpdbTags(oldTags, newTags []gpdb.TagResourcesTag) ([]gpdb.TagResourcesTag, []gpdb.TagResourcesTag) { // First, we're creating everything we have create := make(map[string]interface{}) @@ -583,13 +569,12 @@ func elasticsearchTagIgnored(tagKey, tagValue string) bool { return false } -func ignoredTags(tagKey, tagValue string) bool { +func ignoredTags(tagKey string, tagValue interface{}) bool { filter := []string{"^aliyun", "^acs:", "^http://", "^https://"} for _, v := range filter { - log.Printf("[DEBUG] Matching prefix %v with %v\n", v, tagKey) ok, _ := regexp.MatchString(v, tagKey) if ok { - log.Printf("[DEBUG] Found Alibaba Cloud specific tag %s (val: %s), ignoring.\n", tagKey, tagValue) + log.Printf("[DEBUG] Found Alibaba Cloud specific tag with key: %s and value: %s, ignoring.\n", tagKey, tagValue) return true } } diff --git a/vendor/github.com/deckarep/golang-set/.travis.yml b/vendor/github.com/deckarep/golang-set/.travis.yml deleted file mode 100644 index c760d24d1ec..00000000000 --- a/vendor/github.com/deckarep/golang-set/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -language: go - -go: - - 1.8 - - 1.9 - - tip - -script: - - go test -race ./... - - go test -bench=. - diff --git a/vendor/github.com/deckarep/golang-set/threadunsafe.go b/vendor/github.com/deckarep/golang-set/threadunsafe.go index 10bdd46f155..927eb23195a 100644 --- a/vendor/github.com/deckarep/golang-set/threadunsafe.go +++ b/vendor/github.com/deckarep/golang-set/threadunsafe.go @@ -76,6 +76,9 @@ func (set *threadUnsafeSet) Contains(i ...interface{}) bool { func (set *threadUnsafeSet) IsSubset(other Set) bool { _ = other.(*threadUnsafeSet) + if set.Cardinality() > other.Cardinality() { + return false + } for elem := range *set { if !other.Contains(elem) { return false diff --git a/vendor/github.com/denverdino/aliyungo/cs/kubernets_cluster.go b/vendor/github.com/denverdino/aliyungo/cs/kubernets_cluster.go index c6dfcf509a7..dbca3b5d405 100644 --- a/vendor/github.com/denverdino/aliyungo/cs/kubernets_cluster.go +++ b/vendor/github.com/denverdino/aliyungo/cs/kubernets_cluster.go @@ -190,6 +190,15 @@ type ClusterArgs struct { RdsInstances []string `json:"rds_instances"` EncryptionProviderKey string `json:"encryption_provider_key"` MaintenanceWindow MaintenanceWindow `json:"maintenance_window"` + + //controlplane log parms + ControlplaneLogProject string `json:"controlplane_log_project"` + ControlplaneLogTTL string `json:"controlplane_log_ttl"` + ControlplaneComponents []string `json:"controlplane_log_components"` + + // Operating system hardening + SocEnabled *bool `json:"soc_enabled"` + CisEnabled *bool `json:"cis_enabled"` } //addon diff --git a/vendor/github.com/denverdino/aliyungo/cs/node_pool.go b/vendor/github.com/denverdino/aliyungo/cs/node_pool.go index ee391e0aa45..be0da02c3b9 100644 --- a/vendor/github.com/denverdino/aliyungo/cs/node_pool.go +++ b/vendor/github.com/denverdino/aliyungo/cs/node_pool.go @@ -31,6 +31,7 @@ type ScalingGroup struct { LoginPassword string `json:"login_password"` KeyPair string `json:"key_pair"` SecurityGroupId string `json:"security_group_id"` + SecurityGroupIds []string `json:"security_group_ids"` SystemDiskCategory ecs.DiskCategory `json:"system_disk_category"` SystemDiskSize int64 `json:"system_disk_size"` SystemDiskPerformanceLevel string `json:"system_disk_performance_level"` @@ -38,12 +39,13 @@ type ScalingGroup struct { Tags []Tag `json:"tags"` ImageId string `json:"image_id"` Platform string `json:"platform"` - // 支持包年包月 - InstanceChargeType string `json:"instance_charge_type"` - Period int `json:"period"` - PeriodUnit string `json:"period_unit"` - AutoRenew bool `json:"auto_renew"` - AutoRenewPeriod int `json:"auto_renew_period"` + OSType string `json:"os_type"` + ImageType string `json:"image_type"` + InstanceChargeType string `json:"instance_charge_type"` + Period int `json:"period"` + PeriodUnit string `json:"period_unit"` + AutoRenew bool `json:"auto_renew"` + AutoRenewPeriod int `json:"auto_renew_period"` // spot实例 SpotStrategy string `json:"spot_strategy"` SpotPriceLimit []SpotPrice `json:"spot_price_limit"` @@ -56,6 +58,13 @@ type ScalingGroup struct { // 公网ip InternetChargeType string `json:"internet_charge_type"` InternetMaxBandwidthOut int `json:"internet_max_bandwidth_out"` + // Operating system hardening + SocEnabled *bool `json:"soc_enabled"` + CisEnabled *bool `json:"cis_enabled"` + // ipv6 + SupportIPv6 bool `json:"support_ipv6"` + // deploymentset + DeploymentSetId string `json:"deploymentset_id"` } type AutoScaling struct { diff --git a/vendor/github.com/denverdino/aliyungo/ecs/instances.go b/vendor/github.com/denverdino/aliyungo/ecs/instances.go index 77ca8eb00ca..f0bac0bd384 100644 --- a/vendor/github.com/denverdino/aliyungo/ecs/instances.go +++ b/vendor/github.com/denverdino/aliyungo/ecs/instances.go @@ -230,13 +230,15 @@ const ( // // You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/datatype&instanceattributestype type InstanceAttributesType struct { + AutoReleaseTime string InstanceId string InstanceName string Description string ImageId string RegionId common.Region ZoneId string - CPU int + Cpu int + CpuOptions CpuOptionsType Memory int ClusterId string InstanceType string @@ -248,26 +250,114 @@ type InstanceAttributesType struct { SecurityGroupIds struct { SecurityGroupId []string } - PublicIpAddress IpAddressSetType - InnerIpAddress IpAddressSetType - InstanceNetworkType string //enum Classic | Vpc - InternetMaxBandwidthIn int - InternetMaxBandwidthOut int - InternetChargeType common.InternetChargeType - CreationTime util.ISO6801Time //time.Time - VpcAttributes VpcAttributesType - EipAddress EipAddressAssociateType - IoOptimized StringOrBool - InstanceChargeType common.InstanceChargeType - ExpiredTime util.ISO6801Time - Tags struct { + PublicIpAddress IpAddressSetType + InnerIpAddress IpAddressSetType + InstanceNetworkType string //enum Classic | Vpc + InternetMaxBandwidthIn int + InternetMaxBandwidthOut int + InternetChargeType common.InternetChargeType + CreationTime util.ISO6801Time //time.Time + CreditSpecification string + DedicatedHostAttribute DedicatedHostAttributeType + DedicatedInstanceAttribute DedicatedInstanceAttributeType + DeletionProtection bool + DeploymentSetGroupNo int + DeploymentSetId string + DeviceAvailable bool + EcsCapacityReservationAttr EcsCapacityReservationAttrType + VpcAttributes VpcAttributesType + EipAddress EipAddressAssociateType + IoOptimized StringOrBool + InstanceChargeType common.InstanceChargeType + ExpiredTime util.ISO6801Time + GPUAmount int + GPUSpec string + HibernationOptions HibernationOptionsType + HpcClusterId string + ISP string + LocalStorageAmount int + LocalStorageCapacity int + MetadataOptions MetadataOptionsType + NetworkInterfaces struct { + NetworkInterface []InstanceNetworkInterfaceType + } + OSName string + OSNameEn string + OSType string + RdmaIpAddress RdmaIpAddressType + Recyclable bool + ResourceGroupId string + SaleCycle string + SpotDuration int + StartTime string + StoppedMode string + Tags struct { Tag []TagItemType } + VlanId string SpotStrategy SpotStrategyType SpotPriceLimit float64 KeyPairName string } +type CpuOptionsType struct { + CoreCount int + Numa string + ThreadsPerCore int +} + +type DedicatedHostAttributeType struct { + DedicatedHostClusterId string + DedicatedHostId string + DedicatedHostName string +} + +type DedicatedInstanceAttributeType struct { + Affinity string + Tenancy string +} + +type EcsCapacityReservationAttrType struct { + CapacityReservationId string + CapacityReservationPreference string +} + +type HibernationOptionsType struct { + Configured bool +} + +type MetadataOptionsType struct { + HttpEndpoint string + HttpPutResponseHopLimit int + HttpTokens string +} + +type InstanceNetworkInterfaceType struct { + Ipv6Sets struct { + Ipv6Set []Ipv6SetType + } + MacAddress string + NetworkInterfaceId string + PrimaryIpAddress string + Type string + PrivateIpSets struct { + PrivateIpSet []PrivateIpSetType + } +} + +type Ipv6SetType struct { + Ipv6Address string +} + +type PrivateIpSetType struct { + Primary bool + PrivateIpAddress string +} + +type RdmaIpAddressType struct { + RdmaIpAddress []string +} + type DescribeInstanceAttributeResponse struct { common.Response InstanceAttributesType @@ -401,16 +491,34 @@ type DescribeInstancesArgs struct { PrivateIpAddresses string InnerIpAddresses string PublicIpAddresses string + EipAddresses string + InstanceChargeType common.InstanceChargeType + InternetChargeType common.InternetChargeType + ImageId string + LockReason string SecurityGroupId string - Tag map[string]string InstanceType string SpotStrategy SpotStrategyType common.Pagination + NextToken string + MaxResults int + Filter []Filter + IoOptimized *bool + InstanceTypeFamily string + KeyPairName string + ResourceGroupId string + HpcClusterId string + RdmaIpAddresses string + DryRun bool + HttpEndpoint string + HttpTokens string + Tag []TagType } type DescribeInstancesResponse struct { common.Response common.PaginationResult + NextToken string Instances struct { Instance []InstanceAttributesType } @@ -488,6 +596,9 @@ type DataDiskType struct { Description string Device string DeleteWithInstance bool + PerformanceLevel string + KMSKeyId string + Encrypted bool } type SystemDiskType struct { @@ -547,6 +658,7 @@ type CreateInstanceArgs struct { RegionId common.Region ZoneId string ImageId string + ImageFamily string InstanceType string SecurityGroupId string InstanceName string @@ -556,7 +668,13 @@ type CreateInstanceArgs struct { InternetMaxBandwidthOut int HostName string Password string + PasswordInherit bool + DeploymentSetId string + ClusterId string + VlanId string + InnerIpAddress string IoOptimized IoOptimized + UseAdditionalService *bool SystemDisk SystemDiskType DataDisk []DataDiskType VSwitchId string @@ -570,9 +688,35 @@ type CreateInstanceArgs struct { AutoRenewPeriod int SpotStrategy SpotStrategyType SpotPriceLimit float64 + SpotDuration *int + SpotInterruptionBehavior string KeyPairName string RamRoleName string SecurityEnhancementStrategy SecurityEnhancementStrategy + ResourceGroupId string + HpcClusterId string + DryRun bool + DedicatedHostId string + CreditSpecification string + DeletionProtection bool + Affinity string + Tenancy string + StorageSetId string + StorageSetPartitionNumber int + HttpEndpoint string + HttpTokens string + PrivatePoolOptions []PrivatePoolOptionsType + Tag []TagType +} + +type PrivatePoolOptionsType struct { + MatchCriteria string + Id string +} + +type TagType struct { + Key string + Value string } type CreateInstanceResponse struct { diff --git a/vendor/gopkg.in/ini.v1/.golangci.yml b/vendor/gopkg.in/ini.v1/.golangci.yml new file mode 100644 index 00000000000..b7256bae133 --- /dev/null +++ b/vendor/gopkg.in/ini.v1/.golangci.yml @@ -0,0 +1,21 @@ +linters-settings: + nakedret: + max-func-lines: 0 # Disallow any unnamed return statement + +linters: + enable: + - deadcode + - errcheck + - gosimple + - govet + - ineffassign + - staticcheck + - structcheck + - typecheck + - unused + - varcheck + - nakedret + - gofmt + - rowserrcheck + - unconvert + - goimports diff --git a/vendor/gopkg.in/ini.v1/README.md b/vendor/gopkg.in/ini.v1/README.md index 5d65658b294..1e42944524f 100644 --- a/vendor/gopkg.in/ini.v1/README.md +++ b/vendor/gopkg.in/ini.v1/README.md @@ -24,7 +24,7 @@ Package ini provides INI file read and write functionality in Go. ## Installation -The minimum requirement of Go is **1.6**. +The minimum requirement of Go is **1.12**. ```sh $ go get gopkg.in/ini.v1 diff --git a/vendor/gopkg.in/ini.v1/codecov.yml b/vendor/gopkg.in/ini.v1/codecov.yml index fc947f23082..31f646ee065 100644 --- a/vendor/gopkg.in/ini.v1/codecov.yml +++ b/vendor/gopkg.in/ini.v1/codecov.yml @@ -6,4 +6,4 @@ coverage: threshold: 1% comment: - layout: 'diff, files' + layout: 'diff' diff --git a/vendor/gopkg.in/ini.v1/file.go b/vendor/gopkg.in/ini.v1/file.go index b96d172cf41..7b4e560d1bb 100644 --- a/vendor/gopkg.in/ini.v1/file.go +++ b/vendor/gopkg.in/ini.v1/file.go @@ -142,6 +142,12 @@ func (f *File) GetSection(name string) (*Section, error) { return secs[0], err } +// HasSection returns true if the file contains a section with given name. +func (f *File) HasSection(name string) bool { + section, _ := f.GetSection(name) + return section != nil +} + // SectionsByName returns all sections with given name. func (f *File) SectionsByName(name string) ([]*Section, error) { if len(name) == 0 { @@ -168,8 +174,9 @@ func (f *File) SectionsByName(name string) ([]*Section, error) { func (f *File) Section(name string) *Section { sec, err := f.GetSection(name) if err != nil { - // Note: It's OK here because the only possible error is empty section name, - // but if it's empty, this piece of code won't be executed. + if name == "" { + name = DefaultSection + } sec, _ = f.NewSection(name) return sec } diff --git a/vendor/gopkg.in/ini.v1/ini.go b/vendor/gopkg.in/ini.v1/ini.go index 23f07422ef5..ac2a93a5b39 100644 --- a/vendor/gopkg.in/ini.v1/ini.go +++ b/vendor/gopkg.in/ini.v1/ini.go @@ -1,5 +1,3 @@ -// +build go1.6 - // Copyright 2014 Unknwon // // Licensed under the Apache License, Version 2.0 (the "License"): you may @@ -125,6 +123,8 @@ type LoadOptions struct { ReaderBufferSize int // AllowNonUniqueSections indicates whether to allow sections with the same name multiple times. AllowNonUniqueSections bool + // AllowDuplicateShadowValues indicates whether values for shadowed keys should be deduplicated. + AllowDuplicateShadowValues bool } // DebugFunc is the type of function called to log parse events. diff --git a/vendor/gopkg.in/ini.v1/key.go b/vendor/gopkg.in/ini.v1/key.go index 8baafd9ea6d..0302c291bf5 100644 --- a/vendor/gopkg.in/ini.v1/key.go +++ b/vendor/gopkg.in/ini.v1/key.go @@ -54,14 +54,16 @@ func (k *Key) addShadow(val string) error { return errors.New("cannot add shadow to auto-increment or boolean key") } - // Deduplicate shadows based on their values. - if k.value == val { - return nil - } - for i := range k.shadows { - if k.shadows[i].value == val { + if !k.s.f.options.AllowDuplicateShadowValues { + // Deduplicate shadows based on their values. + if k.value == val { return nil } + for i := range k.shadows { + if k.shadows[i].value == val { + return nil + } + } } shadow := newKey(k.s, k.name, val) @@ -781,10 +783,8 @@ func (k *Key) parseUint64s(strs []string, addInvalid, returnOnInvalid bool) ([]u return vals, err } - type Parser func(str string) (interface{}, error) - // parseTimesFormat transforms strings to times in given format. func (k *Key) parseTimesFormat(format string, strs []string, addInvalid, returnOnInvalid bool) ([]time.Time, error) { vals := make([]time.Time, 0, len(strs)) @@ -801,7 +801,6 @@ func (k *Key) parseTimesFormat(format string, strs []string, addInvalid, returnO return vals, err } - // doParse transforms strings to different types func (k *Key) doParse(strs []string, addInvalid, returnOnInvalid bool, parser Parser) ([]interface{}, error) { vals := make([]interface{}, 0, len(strs)) diff --git a/vendor/gopkg.in/ini.v1/parser.go b/vendor/gopkg.in/ini.v1/parser.go index 65147166f98..ac1c980ab5e 100644 --- a/vendor/gopkg.in/ini.v1/parser.go +++ b/vendor/gopkg.in/ini.v1/parser.go @@ -131,7 +131,7 @@ func readKeyName(delimiters string, in []byte) (string, int, error) { // Check if key name surrounded by quotes. var keyQuote string if line[0] == '"' { - if len(line) > 6 && string(line[0:3]) == `"""` { + if len(line) > 6 && line[0:3] == `"""` { keyQuote = `"""` } else { keyQuote = `"` @@ -232,7 +232,7 @@ func (p *parser) readValue(in []byte, bufferSize int) (string, error) { } var valQuote string - if len(line) > 3 && string(line[0:3]) == `"""` { + if len(line) > 3 && line[0:3] == `"""` { valQuote = `"""` } else if line[0] == '`' { valQuote = "`" @@ -289,12 +289,8 @@ func (p *parser) readValue(in []byte, bufferSize int) (string, error) { hasSurroundedQuote(line, '"')) && !p.options.PreserveSurroundedQuote { line = line[1 : len(line)-1] } else if len(valQuote) == 0 && p.options.UnescapeValueCommentSymbols { - if strings.Contains(line, `\;`) { - line = strings.Replace(line, `\;`, ";", -1) - } - if strings.Contains(line, `\#`) { - line = strings.Replace(line, `\#`, "#", -1) - } + line = strings.ReplaceAll(line, `\;`, ";") + line = strings.ReplaceAll(line, `\#`, "#") } else if p.options.AllowPythonMultilineValues && lastChar == '\n' { return p.readPythonMultilines(line, bufferSize) } @@ -306,15 +302,9 @@ func (p *parser) readPythonMultilines(line string, bufferSize int) (string, erro parserBufferPeekResult, _ := p.buf.Peek(bufferSize) peekBuffer := bytes.NewBuffer(parserBufferPeekResult) - indentSize := 0 for { peekData, peekErr := peekBuffer.ReadBytes('\n') - if peekErr != nil { - if peekErr == io.EOF { - p.debug("readPythonMultilines: io.EOF, peekData: %q, line: %q", string(peekData), line) - return line, nil - } - + if peekErr != nil && peekErr != io.EOF { p.debug("readPythonMultilines: failed to peek with error: %v", peekErr) return "", peekErr } @@ -333,19 +323,6 @@ func (p *parser) readPythonMultilines(line string, bufferSize int) (string, erro return line, nil } - // Determine indent size and line prefix. - currentIndentSize := len(peekMatches[1]) - if indentSize < 1 { - indentSize = currentIndentSize - p.debug("readPythonMultilines: indent size is %d", indentSize) - } - - // Make sure each line is indented at least as far as first line. - if currentIndentSize < indentSize { - p.debug("readPythonMultilines: end of value, current indent: %d, expected indent: %d, line: %q", currentIndentSize, indentSize, line) - return line, nil - } - // Advance the parser reader (buffer) in-sync with the peek buffer. _, err := p.buf.Discard(len(peekData)) if err != nil { @@ -353,8 +330,7 @@ func (p *parser) readPythonMultilines(line string, bufferSize int) (string, erro return "", err } - // Handle indented empty line. - line += "\n" + peekMatches[1][indentSize:] + peekMatches[2] + line += "\n" + peekMatches[0] } } @@ -465,6 +441,8 @@ func (f *File) parse(reader io.Reader) (err error) { // Reset auto-counter and comments p.comment.Reset() p.count = 1 + // Nested values can't span sections + isLastValueEmpty = false inUnparseableSection = false for i := range f.options.UnparseableSections { diff --git a/vendor/gopkg.in/ini.v1/section.go b/vendor/gopkg.in/ini.v1/section.go index afaa97c97ee..a3615d820b7 100644 --- a/vendor/gopkg.in/ini.v1/section.go +++ b/vendor/gopkg.in/ini.v1/section.go @@ -217,7 +217,7 @@ func (s *Section) KeysHash() map[string]string { defer s.f.lock.RUnlock() } - hash := map[string]string{} + hash := make(map[string]string, len(s.keysHash)) for key, value := range s.keysHash { hash[key] = value } diff --git a/vendor/modules.txt b/vendor/modules.txt index 221090e3c99..8f1dc3c50bb 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -456,17 +456,17 @@ github.com/alibabacloud-go/endpoint-util/service # github.com/alibabacloud-go/openapi-util v0.0.7 ## explicit; go 1.14 github.com/alibabacloud-go/openapi-util/service -# github.com/alibabacloud-go/tea v1.1.15 +# github.com/alibabacloud-go/tea v1.1.17 ## explicit; go 1.14 github.com/alibabacloud-go/tea/tea github.com/alibabacloud-go/tea/utils -# github.com/alibabacloud-go/tea-roa v1.2.8 +# github.com/alibabacloud-go/tea-roa v1.3.0 ## explicit; go 1.14 github.com/alibabacloud-go/tea-roa/client # github.com/alibabacloud-go/tea-roa-utils v1.1.5 ## explicit; go 1.14 github.com/alibabacloud-go/tea-roa-utils/service -# github.com/alibabacloud-go/tea-rpc v1.1.8 +# github.com/alibabacloud-go/tea-rpc v1.2.0 ## explicit; go 1.14 github.com/alibabacloud-go/tea-rpc/client # github.com/alibabacloud-go/tea-rpc-utils v1.1.2 @@ -475,7 +475,7 @@ github.com/alibabacloud-go/tea-rpc-utils/service # github.com/alibabacloud-go/tea-utils v1.3.9 ## explicit; go 1.14 github.com/alibabacloud-go/tea-utils/service -# github.com/aliyun/alibaba-cloud-sdk-go v1.61.1154 +# github.com/aliyun/alibaba-cloud-sdk-go v1.61.1264 ## explicit; go 1.13 github.com/aliyun/alibaba-cloud-sdk-go/sdk github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth @@ -520,7 +520,6 @@ github.com/aliyun/alibaba-cloud-sdk-go/services/polardb github.com/aliyun/alibaba-cloud-sdk-go/services/pvtz github.com/aliyun/alibaba-cloud-sdk-go/services/r-kvstore github.com/aliyun/alibaba-cloud-sdk-go/services/ram -github.com/aliyun/alibaba-cloud-sdk-go/services/rds github.com/aliyun/alibaba-cloud-sdk-go/services/resourcemanager github.com/aliyun/alibaba-cloud-sdk-go/services/slb github.com/aliyun/alibaba-cloud-sdk-go/services/sls @@ -535,7 +534,7 @@ github.com/aliyun/alibaba-cloud-sdk-go/services/yundun_dbaudit github.com/aliyun/aliyun-datahub-sdk-go/datahub github.com/aliyun/aliyun-datahub-sdk-go/datahub/pbmodel github.com/aliyun/aliyun-datahub-sdk-go/datahub/util -# github.com/aliyun/aliyun-log-go-sdk v0.1.21 +# github.com/aliyun/aliyun-log-go-sdk v0.1.27 ## explicit; go 1.13 github.com/aliyun/aliyun-log-go-sdk # github.com/aliyun/aliyun-mns-go-sdk v0.0.0-20210305050620-d1b5875bda58 @@ -558,7 +557,7 @@ github.com/aliyun/credentials-go/credentials/utils # github.com/aliyun/fc-go-sdk v0.0.0-20200925033337-c013428cbe21 ## explicit github.com/aliyun/fc-go-sdk -# github.com/aliyun/terraform-provider-alicloud v1.132.0 +# github.com/aliyun/terraform-provider-alicloud v1.153.0 ## explicit; go 1.13 github.com/aliyun/terraform-provider-alicloud/alicloud github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity @@ -871,11 +870,11 @@ github.com/davecgh/go-spew/spew # github.com/dchest/bcrypt_pbkdf v0.0.0-20150205184540-83f37f9c154a ## explicit github.com/dchest/bcrypt_pbkdf -# github.com/deckarep/golang-set v1.7.1 -## explicit +# github.com/deckarep/golang-set v1.8.0 +## explicit; go 1.17 github.com/deckarep/golang-set -# github.com/denverdino/aliyungo v0.0.0-20210518071019-eb3bbb144d8a -## explicit +# github.com/denverdino/aliyungo v0.0.0-20211216040745-6cc94847413f +## explicit; go 1.15 github.com/denverdino/aliyungo/cdn github.com/denverdino/aliyungo/common github.com/denverdino/aliyungo/cs @@ -2719,7 +2718,7 @@ gopkg.in/go-playground/validator.v9 # gopkg.in/inf.v0 v0.9.1 ## explicit gopkg.in/inf.v0 -# gopkg.in/ini.v1 v1.62.0 +# gopkg.in/ini.v1 v1.66.2 ## explicit gopkg.in/ini.v1 # gopkg.in/jcmturner/aescts.v1 v1.0.1